Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKIDNotFound indicates that the given key ID was not found in the JWKS. ErrKIDNotFound = errors.New("the given key ID was not found in the JWKS") // ErrMissingAssets indicates there are required assets missing to create a public key. ErrMissingAssets = errors.New("required assets are missing to create a public key") )
View Source
var ( // ErrKID indicates that the JWT had an invalid kid. ErrKID = errors.New("the JWT has an invalid kid") // ErrUnsupportedKeyType indicates the JWT key type is an unsupported type. ErrUnsupportedKeyType = errors.New("the JWT key type is unsupported") )
Functions ¶
This section is empty.
Types ¶
type ErrorHandler ¶
type ErrorHandler func(err error)
ErrorHandler is a function signature that consumes an error.
type JSONKey ¶
type JSONKey struct { Curve string `json:"crv"` Exponent string `json:"e"` ID string `json:"kid"` Modulus string `json:"n"` X string `json:"x"` Y string `json:"y"` // contains filtered or unexported fields }
JSONKey represents a raw key inside a JWKS.
type JWKS ¶
JWKS represents a JSON Web Key Set.
func New ¶
func New(jwksBytes json.RawMessage) (jwks *JWKS, err error)
New creates a new JWKS from a raw JSON message.
func (*JWKS) EndBackground ¶
func (j *JWKS) EndBackground()
EndBackground ends the background goroutine to update the JWKs. It can only happen once and is only effective if the JWKS has a background goroutine refreshing the JWKS keys.
type Options ¶
type Options struct { // Client is the HTTP client used to get the JWKS via HTTP. Client *http.Client // RefreshInterval is the duration to refresh the JWKS in the background via a new HTTP request. If this is not nil, // then a background refresh will be performed in a separate goroutine until the JWKS method EndBackground is // called. RefreshInterval *time.Duration // RefreshTimeout is the duration for the context used to create the HTTP request for a refresh of the JWKS. This // defaults to one minute. This is only effectual if RefreshInterval is not nil. RefreshTimeout *time.Duration // RefreshErrorHandler is a function that consumes errors that happen during a JWKS refresh. This is only effectual // if RefreshInterval is not nil. RefreshErrorHandler ErrorHandler // RefreshUnknownKID indicates that the JWKS should be refreshed via HTTP every time a kid that isn't know is found. // This means the RefreshUnknownKID *bool }
Options represents the configuration options for a JWKS.
Click to show internal directories.
Click to hide internal directories.