Documentation
¶
Index ¶
- Variables
- type Keyfunc
- func New(options Options) (Keyfunc, error)
- func NewDefault(urls []string) (Keyfunc, error)
- func NewDefaultCtx(ctx context.Context, urls []string) (Keyfunc, error)
- func NewDefaultOverrideCtx(ctx context.Context, urls []string, override Override) (Keyfunc, error)
- func NewJWKJSON(raw json.RawMessage) (Keyfunc, error)
- func NewJWKSetJSON(raw json.RawMessage) (Keyfunc, error)
- type Options
- type Override
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyfunc is returned when a keyfunc error occurs. ErrKeyfunc = errors.New("failed keyfunc") )
Functions ¶
This section is empty.
Types ¶
type Keyfunc ¶
type Keyfunc interface {
Keyfunc(token *jwt.Token) (any, error)
KeyfuncCtx(ctx context.Context) jwt.Keyfunc
Storage() jwkset.Storage
VerificationKeySet(ctx context.Context) (jwt.VerificationKeySet, error)
}
Keyfunc is meant to be used as the jwt.Keyfunc function for github.com/golang-jwt/jwt/v5. It uses github.com/MicahParks/jwkset as a JWK Set storage.
func NewDefault ¶
NewDefault creates a new Keyfunc with a default JWK Set storage and options.
This will launch "refresh goroutine" to automatically refresh the remote HTTP resources.
func NewDefaultCtx ¶ added in v3.2.5
NewDefaultCtx creates a new Keyfunc with a default JWK Set storage and options. The context is used to end the "refresh goroutine".
This will launch "refresh goroutine" to automatically refresh the remote HTTP resources.
func NewDefaultOverrideCtx ¶ added in v3.4.0
NewDefaultOverrideCtx creates a new Keyfunc with a default JWK Set storage and options. The context is used to end the "refresh goroutine". The override parameter is used to change specific default behaviors.
This will launch "refresh goroutine" to automatically refresh remote HTTP resources.
func NewJWKJSON ¶ added in v3.1.0
func NewJWKJSON(raw json.RawMessage) (Keyfunc, error)
NewJWKJSON creates a new Keyfunc from raw JWK JSON.
func NewJWKSetJSON ¶ added in v3.1.0
func NewJWKSetJSON(raw json.RawMessage) (Keyfunc, error)
NewJWKSetJSON creates a new Keyfunc from raw JWK Set JSON.
type Override ¶ added in v3.4.0
type Override struct {
// Client is from https://pkg.go.dev/github.com/MicahParks/jwkset#HTTPClientStorageOptions
Client *http.Client
// HTTPTimeout is from https://pkg.go.dev/github.com/MicahParks/jwkset#HTTPClientStorageOptions
HTTPTimeout time.Duration
// RateLimitWaitMax is from https://pkg.go.dev/github.com/MicahParks/jwkset#HTTPClientOptions
RateLimitWaitMax time.Duration
// RefreshErrorHandlerFunc is a function that accepts the URL of the remote JWK Set storage and returns the
// RefreshErrorHandler from https://pkg.go.dev/github.com/MicahParks/jwkset#HTTPClientStorageOptions
RefreshErrorHandlerFunc func(u string) func(ctx context.Context, err error)
// RefreshInterval is from https://pkg.go.dev/github.com/MicahParks/jwkset#HTTPClientStorageOptions
RefreshInterval time.Duration
// RefreshUnknownKID is from https://pkg.go.dev/github.com/MicahParks/jwkset#HTTPClientOptions
RefreshUnknownKID *rate.Limiter
// ValidationSkipAll is copied to SkipAll in https://pkg.go.dev/github.com/MicahParks/jwkset#JWKValidateOptions
ValidationSkipAll bool
}
Override is used to change specific default behaviors.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
advanced
command
|
|
|
aws_cognito
command
|
|
|
hmac
command
|
|
|
http
command
|
|
|
json
command
|
|
|
keycloak
command
|
|
|
multi_with_given
command
|