Documentation
¶
Index ¶
- Constants
- func AuthErrorResponse(clientStorage storage.Client, w http.ResponseWriter, r *http.Request, ...)
- func CheckUsernamePassword(userStorage storage.User, requestStorage storage.AuthRequest, ...) error
- func Contains[T comparable](sl []T, elem T) bool
- func GenerateAuthCode(requestStorage storage.AuthRequest, authCodeStorage storage.AuthCode, ...) (oidc.AuthCode, error)
- func ResponseJSON(w http.ResponseWriter, code int, payload any) error
- func SwitchCodeToToken(authCodeStorage storage.AuthCode, tokenStorage storage.AccessToken, ...) (oidc.AccessToken, error)
- func ValidateClientRedirectURI(clientStorage storage.Client, clientID string, redirectURI string) (bool, error)
- func WriteResponse(w http.ResponseWriter, code int, message string)
Constants ¶
View Source
const ( InvalidRequest string = "invalid_request" AccessDenied string = "access_denied" UnsupportedResponseType string = "unsupported_response_type" InvalidScope string = "invalid_scope" ServerError string = "server_error" )
this are error codes in callback response
Variables ¶
This section is empty.
Functions ¶
func AuthErrorResponse ¶
func AuthErrorResponse(clientStorage storage.Client, w http.ResponseWriter, r *http.Request, authReq oidc.AuthRequest, errorCode string)
returns json object with errorCode, also it has redirection uri with error params errorCode - is OAuth Error code (https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2), you can find then in pkg
func CheckUsernamePassword ¶
func Contains ¶
func Contains[T comparable](sl []T, elem T) bool
func GenerateAuthCode ¶
func GenerateAuthCode(requestStorage storage.AuthRequest, authCodeStorage storage.AuthCode, authReq oidc.AuthRequest, username string) (oidc.AuthCode, error)
add auth code obj to auth code storage and returns new created auth code delete auth request and get auth code
func ResponseJSON ¶
func ResponseJSON(w http.ResponseWriter, code int, payload any) error
func SwitchCodeToToken ¶
func SwitchCodeToToken(authCodeStorage storage.AuthCode, tokenStorage storage.AccessToken, authCode oidc.AuthCode, redirectURI string, grantType string) (oidc.AccessToken, error)
Requires authRequest obj, deletes it and add generated token into token storage
func ValidateClientRedirectURI ¶
func ValidateClientRedirectURI(clientStorage storage.Client, clientID string, redirectURI string) (bool, error)
returns true if redirectURI is valid for clientID, otherwise false
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, code int, message string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.