Documentation
¶
Index ¶
- type Authenticator
- func (a *Authenticator) Audience() string
- func (a *Authenticator) Auth0Enabled() bool
- func (a *Authenticator) AuthEnabled() bool
- func (a *Authenticator) GenerateToken(userID, email, name, role string) (string, error)
- func (a *Authenticator) GetSignedState(state OAuthState) (string, error)
- func (a *Authenticator) VerifyAccessToken(ctx context.Context, token string) (*UserClaims, error)
- func (a *Authenticator) VerifyIDToken(ctx context.Context, token *oauth2.Token) (*oidc.IDToken, error)
- func (a *Authenticator) VerifyLocalToken(tokenString string) (*UserClaims, error)
- func (a *Authenticator) VerifySignedState(encodedState string) (*OAuthState, error)
- type OAuthState
- type UserClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator struct {
*oidc.Provider
oauth2.Config
// contains filtered or unexported fields
}
func (*Authenticator) Audience ¶
func (a *Authenticator) Audience() string
func (*Authenticator) Auth0Enabled ¶
func (a *Authenticator) Auth0Enabled() bool
func (*Authenticator) AuthEnabled ¶
func (a *Authenticator) AuthEnabled() bool
func (*Authenticator) GenerateToken ¶
func (a *Authenticator) GenerateToken(userID, email, name, role string) (string, error)
GenerateToken creates a new JWT token for a user
func (*Authenticator) GetSignedState ¶
func (a *Authenticator) GetSignedState(state OAuthState) (string, error)
func (*Authenticator) VerifyAccessToken ¶
func (a *Authenticator) VerifyAccessToken(ctx context.Context, token string) (*UserClaims, error)
VerifyAccessToken verifies an access token (tries local JWT first, then Auth0 if enabled)
func (*Authenticator) VerifyIDToken ¶
func (a *Authenticator) VerifyIDToken(ctx context.Context, token *oauth2.Token) (*oidc.IDToken, error)
VerifyIDToken verifies that an *oauth2.Token is a valid *oidc.IDToken.
func (*Authenticator) VerifyLocalToken ¶
func (a *Authenticator) VerifyLocalToken(tokenString string) (*UserClaims, error)
VerifyLocalToken verifies a locally-issued JWT token and returns the claims
func (*Authenticator) VerifySignedState ¶
func (a *Authenticator) VerifySignedState(encodedState string) (*OAuthState, error)
type OAuthState ¶
type UserClaims ¶
type UserClaims struct {
jwt.RegisteredClaims
UserID string `json:"user_id"`
Email string `json:"email"`
Name string `json:"name"`
Role string `json:"role"`
}
UserClaims represents the claims stored in our JWT tokens
Click to show internal directories.
Click to hide internal directories.