Documentation ¶
Index ¶
- Constants
- func Callback(h *Handler) gin.HandlerFunc
- func Login(h *Handler) gin.HandlerFunc
- func Register(r *gin.Engine, h *Handler)
- type Client
- type ExtraClaims
- type Handler
- func (h *Handler) Exchange(ctx context.Context, code string) (*oauth2.Token, error)
- func (h *Handler) GetAuthCodeURL(state *State) (string, error)
- func (h *Handler) Refresh(ctx context.Context, refreshToken string) (*oauth2.Token, error)
- func (h *Handler) Verify(ctx context.Context, token *oauth2.Token) (*oidc.IDToken, error)
- func (h *Handler) VerifyStateAndClaims(ctx context.Context, token *oauth2.Token, encoded string) (*State, *ExtraClaims, error)
- type HandlerConfig
- type State
Constants ¶
const QueryTokenKey = "token"
Variables ¶
This section is empty.
Functions ¶
func Callback ¶
func Callback(h *Handler) gin.HandlerFunc
func Login ¶
func Login(h *Handler) gin.HandlerFunc
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetAuthCodeURL ¶
GetAuthCodeURL will connect to the server and retrieve the URL, which the client will be redirected to as part of the OIDC flow. Make sure to start the callback server via StartCallbackServer first or this function will return an error.
func (*Client) GetToken ¶
GetToken return the current value of the token. If the token has not been retrieved, the value will be an empty string.
func (*Client) StartCallbackServer ¶
func (*Client) StopCallbackServer ¶
StopCallbackServer will shutdown the server, which receives the token by being the final redirect as part of the OIDC flow.
func (*Client) WaitUntilTokenReceived ¶
WaitUntilTokenReceived will block until either the token was received or the context is done. The token can only be received if the callback server is running and the user is finishing the OIDC flow with his browser.
type ExtraClaims ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(config *HandlerConfig) (*Handler, error)