Documentation ¶
Index ¶
- func CallbackHandler(config *oa2.Config, sessionSecret string, tokenTTL time.Duration, ...) http.Handler
- func CheckTokenHandler(sessionSecret string, tokenContextKey any) func(http.Handler) http.Handler
- func LoginHandler(config *oa2.Config) http.Handler
- func TokenLoginHandler(sessionSecret string, tokenTTL time.Duration, parseTok ParseTokenFunc) http.Handler
- type ParseTokenFunc
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallbackHandler ¶
func CallbackHandler( config *oa2.Config, sessionSecret string, tokenTTL time.Duration, parseTok ParseTokenFunc, ) http.Handler
CallbackHandler creates a session token and returns it to the client. It is designed to handle the OAuth2 callback endpoint.
func CheckTokenHandler ¶
func CheckTokenHandler( sessionSecret string, tokenContextKey any, ) func(http.Handler) http.Handler
CheckTokenHandler checks if a request is authenticated through OAuth2. If it is, it will add the token to the request's context.
func LoginHandler ¶
LoginHandler triggers the respective login flow for the user.
func TokenLoginHandler ¶
func TokenLoginHandler( sessionSecret string, tokenTTL time.Duration, parseTok ParseTokenFunc, ) http.Handler
TokenLoginHandler logs a user who already has an access token in.
Types ¶
type ParseTokenFunc ¶
ParseTokenFunc is a function to verify an external token and create private claims for the internal token from it.
type TokenResponse ¶
type TokenResponse struct { TokenType string `json:"tokenType"` AccessToken string `json:"accessToken"` ExpiresIn int `json:"expiresIn"` }
TokenResponse is what the client will get upon successful login.
Click to show internal directories.
Click to hide internal directories.