Documentation ¶
Overview ¶
Package jwt provides the logic for reading and validating JWT tokens
Index ¶
- func GetUserClaimFromContext[T any](ctx context.Context, claim string) (T, bool)
- func GetUserEmailFromContext(ctx context.Context) (string, error)
- func GetUserSubjectFromContext(ctx context.Context) string
- func GetUserTokenFromContext(ctx context.Context) (openid.Token, error)
- func WithAuthTokenContext(ctx context.Context, token openid.Token) context.Context
- type JwkSetJwtValidator
- type KeySetCache
- type KeySetFetcher
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUserClaimFromContext ¶
GetUserClaimFromContext returns the specified claim from the user subject in the context if found and of the correct type
func GetUserEmailFromContext ¶
GetUserEmailFromContext returns the user email from the context, or an empty string
func GetUserSubjectFromContext ¶
GetUserSubjectFromContext returns the user subject from the context, or nil
func GetUserTokenFromContext ¶
GetUserTokenFromContext returns the user token from the context
Types ¶
type JwkSetJwtValidator ¶
type JwkSetJwtValidator struct {
// contains filtered or unexported fields
}
JwkSetJwtValidator is a JWT validator that uses a JWK set URL to validate the tokens
func (*JwkSetJwtValidator) ParseAndValidate ¶
func (j *JwkSetJwtValidator) ParseAndValidate(tokenString string) (openid.Token, error)
ParseAndValidate validates a token string and returns an openID token, or an error if the token is invalid
type KeySetCache ¶
type KeySetCache struct {
// contains filtered or unexported fields
}
KeySetCache is a KeySetFetcher that fetches the JWK set from a cache
type KeySetFetcher ¶
KeySetFetcher provides the functions to fetch a JWK set