Documentation
¶
Index ¶
- Constants
- func AccessTokenOAuth(ctx *context.Context)
- func Activate(ctx *context.Context)
- func ActivateEmail(ctx *context.Context)
- func ActivatePost(ctx *context.Context)
- func AuthorizeOAuth(ctx *context.Context)
- func AutoSignIn(ctx *context.Context) (bool, error)
- func ConnectOpenID(ctx *context.Context)
- func ConnectOpenIDPost(ctx *context.Context)
- func ForgotPasswd(ctx *context.Context)
- func ForgotPasswdPost(ctx *context.Context)
- func GrantApplicationOAuth(ctx *context.Context)
- func HandleSignOut(ctx *context.Context)
- func InfoOAuth(ctx *context.Context)
- func IntrospectOAuth(ctx *context.Context)
- func LinkAccount(ctx *context.Context)
- func LinkAccountPostRegister(ctx *context.Context)
- func LinkAccountPostSignIn(ctx *context.Context)
- func MustChangePassword(ctx *context.Context)
- func MustChangePasswordPost(ctx *context.Context)
- func OIDCKeys(ctx *context.Context)
- func OIDCWellKnown(ctx *context.Context)
- func RegisterOpenID(ctx *context.Context)
- func RegisterOpenIDPost(ctx *context.Context)
- func ResetPasswd(ctx *context.Context)
- func ResetPasswdPost(ctx *context.Context)
- func SignIn(ctx *context.Context)
- func SignInOAuth(ctx *context.Context)
- func SignInOAuthCallback(ctx *context.Context)
- func SignInOpenID(ctx *context.Context)
- func SignInOpenIDPost(ctx *context.Context)
- func SignInPost(ctx *context.Context)
- func SignOut(ctx *context.Context)
- func SignUp(ctx *context.Context)
- func SignUpPost(ctx *context.Context)
- func TwoFactor(ctx *context.Context)
- func TwoFactorPost(ctx *context.Context)
- func TwoFactorScratch(ctx *context.Context)
- func TwoFactorScratchPost(ctx *context.Context)
- func WebAuthn(ctx *context.Context)
- func WebAuthnLoginAssertion(ctx *context.Context)
- func WebAuthnLoginAssertionPost(ctx *context.Context)
- type AccessTokenError
- type AccessTokenErrorCode
- type AccessTokenResponse
- type AuthorizeError
- type AuthorizeErrorCode
- type TokenType
Constants ¶
const (
// AccessTokenErrorCodeInvalidRequest represents an error code specified in RFC 6749
AccessTokenErrorCodeInvalidRequest AccessTokenErrorCode = "invalid_request"
// AccessTokenErrorCodeInvalidClient represents an error code specified in RFC 6749
AccessTokenErrorCodeInvalidClient = "invalid_client"
// AccessTokenErrorCodeInvalidGrant represents an error code specified in RFC 6749
AccessTokenErrorCodeInvalidGrant = "invalid_grant"
// AccessTokenErrorCodeUnauthorizedClient represents an error code specified in RFC 6749
AccessTokenErrorCodeUnauthorizedClient = "unauthorized_client"
// AccessTokenErrorCodeUnsupportedGrantType represents an error code specified in RFC 6749
AccessTokenErrorCodeUnsupportedGrantType = "unsupported_grant_type"
// AccessTokenErrorCodeInvalidScope represents an error code specified in RFC 6749
AccessTokenErrorCodeInvalidScope = "invalid_scope"
)
const (
// TplActivate template path for activate user
TplActivate base.TplName = "user/auth/activate"
)
Variables ¶
This section is empty.
Functions ¶
func AccessTokenOAuth ¶
func AccessTokenOAuth(ctx *context.Context)
AccessTokenOAuth manages all access token requests by the client
func ActivateEmail ¶
func ActivateEmail(ctx *context.Context)
ActivateEmail render the activate email page
func ActivatePost ¶
func ActivatePost(ctx *context.Context)
ActivatePost handles account activation with password check
func AuthorizeOAuth ¶
func AuthorizeOAuth(ctx *context.Context)
AuthorizeOAuth manages authorize requests
func AutoSignIn ¶
func AutoSignIn(ctx *context.Context) (bool, error)
AutoSignIn reads cookie and try to auto-login.
func ConnectOpenID ¶
func ConnectOpenID(ctx *context.Context)
ConnectOpenID shows a form to connect an OpenID URI to an existing account
func ConnectOpenIDPost ¶
func ConnectOpenIDPost(ctx *context.Context)
ConnectOpenIDPost handles submission of a form to connect an OpenID URI to an existing account
func ForgotPasswd ¶
func ForgotPasswd(ctx *context.Context)
ForgotPasswd render the forget password page
func ForgotPasswdPost ¶
func ForgotPasswdPost(ctx *context.Context)
ForgotPasswdPost response for forget password request
func GrantApplicationOAuth ¶
func GrantApplicationOAuth(ctx *context.Context)
GrantApplicationOAuth manages the post request submitted when a user grants access to an application
func HandleSignOut ¶
func HandleSignOut(ctx *context.Context)
HandleSignOut resets the session and sets the cookies
func InfoOAuth ¶
func InfoOAuth(ctx *context.Context)
InfoOAuth manages request for userinfo endpoint
func IntrospectOAuth ¶
func IntrospectOAuth(ctx *context.Context)
IntrospectOAuth introspects an oauth token
func LinkAccount ¶
func LinkAccount(ctx *context.Context)
LinkAccount shows the page where the user can decide to login or create a new account
func LinkAccountPostRegister ¶
func LinkAccountPostRegister(ctx *context.Context)
LinkAccountPostRegister handle the creation of a new account for an external account using signUp
func LinkAccountPostSignIn ¶
func LinkAccountPostSignIn(ctx *context.Context)
LinkAccountPostSignIn handle the coupling of external account with another account using signIn
func MustChangePassword ¶
func MustChangePassword(ctx *context.Context)
MustChangePassword renders the page to change a user's password
func MustChangePasswordPost ¶
func MustChangePasswordPost(ctx *context.Context)
MustChangePasswordPost response for updating a user's password after their account was created by an admin
func OIDCWellKnown ¶
func OIDCWellKnown(ctx *context.Context)
OIDCWellKnown generates JSON so OIDC clients know Gitea's capabilities
func RegisterOpenID ¶
func RegisterOpenID(ctx *context.Context)
RegisterOpenID shows a form to create a new user authenticated via an OpenID URI
func RegisterOpenIDPost ¶
func RegisterOpenIDPost(ctx *context.Context)
RegisterOpenIDPost handles submission of a form to create a new user authenticated via an OpenID URI
func ResetPasswd ¶
func ResetPasswd(ctx *context.Context)
ResetPasswd render the account recovery page
func ResetPasswdPost ¶
func ResetPasswdPost(ctx *context.Context)
ResetPasswdPost response from account recovery request
func SignInOAuth ¶
func SignInOAuth(ctx *context.Context)
SignInOAuth handles the OAuth2 login buttons
func SignInOAuthCallback ¶
func SignInOAuthCallback(ctx *context.Context)
SignInOAuthCallback handles the callback from the given provider
func SignInOpenIDPost ¶
func SignInOpenIDPost(ctx *context.Context)
SignInOpenIDPost response for openid sign in request
func SignUpPost ¶
func SignUpPost(ctx *context.Context)
SignUpPost response for sign up information submission
func TwoFactor ¶
func TwoFactor(ctx *context.Context)
TwoFactor shows the user a two-factor authentication page.
func TwoFactorPost ¶
func TwoFactorPost(ctx *context.Context)
TwoFactorPost validates a user's two-factor authentication token.
func TwoFactorScratch ¶
func TwoFactorScratch(ctx *context.Context)
TwoFactorScratch shows the scratch code form for two-factor authentication.
func TwoFactorScratchPost ¶
func TwoFactorScratchPost(ctx *context.Context)
TwoFactorScratchPost validates and invalidates a user's two-factor scratch token.
func WebAuthnLoginAssertion ¶
func WebAuthnLoginAssertion(ctx *context.Context)
WebAuthnLoginAssertion submits a WebAuthn challenge to the browser
func WebAuthnLoginAssertionPost ¶
func WebAuthnLoginAssertionPost(ctx *context.Context)
WebAuthnLoginAssertionPost validates the signature and logs the user in
Types ¶
type AccessTokenError ¶
type AccessTokenError struct {
ErrorCode AccessTokenErrorCode `json:"error" form:"error"`
ErrorDescription string `json:"error_description"`
}
AccessTokenError represents an error response specified in RFC 6749 https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
type AccessTokenErrorCode ¶
type AccessTokenErrorCode string
AccessTokenErrorCode represents an error code specified in RFC 6749 https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
type AccessTokenResponse ¶
type AccessTokenResponse struct {
AccessToken string `json:"access_token"`
TokenType TokenType `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
IDToken string `json:"id_token,omitempty"`
}
AccessTokenResponse represents a successful access token response https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2
type AuthorizeError ¶
type AuthorizeError struct {
ErrorCode AuthorizeErrorCode `json:"error" form:"error"`
ErrorDescription string
State string
}
AuthorizeError represents an error type specified in RFC 6749 https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2.1
type AuthorizeErrorCode ¶
type AuthorizeErrorCode string
AuthorizeErrorCode represents an error code specified in RFC 6749 https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2.1
const (
// ErrorCodeInvalidRequest represents the according error in RFC 6749
ErrorCodeInvalidRequest AuthorizeErrorCode = "invalid_request"
// ErrorCodeUnauthorizedClient represents the according error in RFC 6749
ErrorCodeUnauthorizedClient AuthorizeErrorCode = "unauthorized_client"
// ErrorCodeAccessDenied represents the according error in RFC 6749
ErrorCodeAccessDenied AuthorizeErrorCode = "access_denied"
// ErrorCodeUnsupportedResponseType represents the according error in RFC 6749
ErrorCodeUnsupportedResponseType AuthorizeErrorCode = "unsupported_response_type"
// ErrorCodeInvalidScope represents the according error in RFC 6749
ErrorCodeInvalidScope AuthorizeErrorCode = "invalid_scope"
// ErrorCodeServerError represents the according error in RFC 6749
ErrorCodeServerError AuthorizeErrorCode = "server_error"
// ErrorCodeTemporaryUnavailable represents the according error in RFC 6749
ErrorCodeTemporaryUnavailable AuthorizeErrorCode = "temporarily_unavailable"
)