authenticator

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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 New

func New(conf *config.Config) (*Authenticator, error)

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 OAuthState struct {
	CSRF      string `json:"csrf"`
	Redirect  string `json:"redirect"`
	IssuedAt  int64  `json:"iat"`
	ExpiresAt int64  `json:"exp"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL