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 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 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
Directories
¶
Path | Synopsis |
---|---|
Package dynamic provides the logic for reading and validating JWT tokens using a JWKS URL from the token's `iss` claim.
|
Package dynamic provides the logic for reading and validating JWT tokens using a JWKS URL from the token's `iss` claim. |
Package merged provides the logic for reading and validating JWT tokens
|
Package merged provides the logic for reading and validating JWT tokens |
Package mock_jwt is a generated GoMock package.
|
Package mock_jwt is a generated GoMock package. |
Package noop provides a no-op implementation of the Validator interface
|
Package noop provides a no-op implementation of the Validator interface |