Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAuthCallbackError = errors.New("auth callback returned error") ErrAuthRedirectToAuth = errors.New("redirecting to auth endpoint") CookieNameToken = "auth-token" )
Functions ¶
func CheckAuth ¶
func CheckAuth(a *AuthProvider, w http.ResponseWriter, r *http.Request, logger *logr.Logger) (string, error, bool)
CheckAuth checks if the user is authenticated and returns the token if so. If the user is not authenticated, it will redirect to the auth endpoint. If the user is authenticated but the token is invalid, it will return an error.
Returns:
- token: The token if the user is authenticated
- error: An error if the user is not authenticated or the token is invalid
- bool: if a redirect to the auth endpoint was performed
Types ¶
type AuthProvider ¶
Click to show internal directories.
Click to hide internal directories.