Documentation
¶
Index ¶
- Constants
- Variables
- func AuthenticateToken(ctx context.Context, a Authenticator, token string, allowAnonymous bool) (context.Context, *principal.Principal, error)
- func ExtractBearer(header string) (string, bool)
- type Authenticator
- type ExchangeCodeRequest
- type LoginRequest
- type LoginURLBuilder
- type LogoutRequest
- type LogoutURLBuilder
- type OAuthExchanger
- type Options
- type RefreshTokenRequest
- type TokenExtractor
- type TokenResponse
Constants ¶
View Source
const DefaultLoginScope = "openid profile email"
Variables ¶
Functions ¶
func AuthenticateToken ¶
func ExtractBearer ¶
Types ¶
type Authenticator ¶
type ExchangeCodeRequest ¶ added in v0.1.2
ExchangeCodeRequest exchanges an OAuth authorization code for tokens.
type LoginRequest ¶
type LoginRequest struct {
RedirectURI string
State string
Scope string
Prompt string
Extra url.Values
}
LoginRequest describes the minimum information required to start an OAuth/OIDC login flow.
type LoginURLBuilder ¶
type LoginURLBuilder interface {
LoginURL(req LoginRequest) (string, error)
}
LoginURLBuilder is implemented by providers that can start a browser login flow.
type LogoutRequest ¶
type LogoutRequest struct {
IDTokenHint string
PostLogoutRedirectURI string
State string
Extra url.Values
}
LogoutRequest describes logout URL construction. Providers may ignore unsupported fields.
type LogoutURLBuilder ¶
type LogoutURLBuilder interface {
LogoutURL(req LogoutRequest) (string, error)
}
LogoutURLBuilder is implemented by providers that can produce a browser logout URL.
type OAuthExchanger ¶ added in v0.1.2
type OAuthExchanger interface {
ExchangeCode(ctx context.Context, req ExchangeCodeRequest) (*TokenResponse, error)
RefreshToken(ctx context.Context, req RefreshTokenRequest) (*TokenResponse, error)
}
OAuthExchanger is implemented by providers that can exchange OAuth codes and refresh tokens.
type Options ¶
type Options struct {
AllowAnonymous bool
TokenExtractor TokenExtractor
}
type RefreshTokenRequest ¶ added in v0.1.2
RefreshTokenRequest exchanges a refresh token for a new access token.
type TokenResponse ¶ added in v0.1.2
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
IDToken string `json:"id_token,omitempty"`
TokenType string `json:"token_type,omitempty"`
ExpiresIn int64 `json:"expires_in,omitempty"`
Scope string `json:"scope,omitempty"`
Raw []byte `json:"-"`
}
TokenResponse is a provider-neutral OAuth/OIDC token response.
Click to show internal directories.
Click to hide internal directories.