Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyKeyID raises when input kid is empty. ErrEmptyKeyID = errors.New("cache: empty kid") // ErrCacheNotFound raises when cache value not found. ErrCacheNotFound = errors.New("cache: value not found") // ErrInvalidValue raises when type conversion to JWK has been failed. ErrInvalidValue = errors.New("cache: invalid value") )
View Source
var ( // ErrConnectionFailed raises when JWKS endpoint cannot be reached. ErrConnectionFailed = errors.New("jwks: connection failed") // ErrInvalidURL raises when input url has invalid format. ErrInvalidURL = errors.New("jwks: invalid url value or format") // ErrKeyIDNotProvided raises when input kid is not present. ErrKeyIDNotProvided = errors.New("jwks: kid is not provided") // ErrPublicKeyNotFound raises when no public key is found. ErrPublicKeyNotFound = errors.New("jwks: public key not found") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Add(ctx context.Context, key *JWK) error Get(ctx context.Context, kid string) (*JWK, error) Remove(ctx context.Context, kid string) error Contains(ctx context.Context, kid string) (bool, error) Len(ctx context.Context) (int, error) Purge(ctx context.Context) error }
Cache works with cache layer.
func NewMemoryCache ¶
NewMemoryCache returns a new instance of memory cache.
type Manager ¶
type Manager interface { FetchKey(ctx context.Context, kid string) (*JWK, error) CacheSize(ctx context.Context) (int, error) }
Manager fetches and returns JWK from public source.
type Option ¶
type Option func(m *manager)
Option is used for configuring key manager.
func WithHTTPClient ¶
WithHTTPClient sets custom http client.
func WithLogger ¶
WithLogger sets custom logger. Default log level is `disabled`.
func WithLookup ¶
WithLookup defines cache lookup option. Default is `true`.
func WithMaxRetries ¶
WithMaxRetries defines max retries count if request has been failed. Default is `5`.
Click to show internal directories.
Click to hide internal directories.