Documentation ¶
Index ¶
- func DecodeJWKSet(r io.Reader) ([]*jose.JsonWebKey, error)
- func VerifyExp(skew time.Duration, exp int64) bool
- func VerifyJWS(jws *jose.JsonWebSignature, jwks []*jose.JsonWebKey) ([]byte, *jose.JsonWebKey, error)
- type JWKSet
- type JWKSetResponse
- type JWKsCacher
- type JWKsFetcher
- type JWKsHTTPFetcher
- type JWKsInMemoryFetcher
- type JWKsS3Fetcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJWKSet ¶
DecodeJWKSet decodes the data with reading from r into JWKs.
func VerifyExp ¶
VerifyExp verifies exp (expiration time). It will return true if the current time is before exp. Otherwise, it will return false. See http://openid.net/specs/openid-connect-core-1_0.html#IDToken
Types ¶
type JWKSet ¶
type JWKSet struct {
Keys []*jose.JsonWebKey `json:"keys"`
}
JWKSet represents JWK Set. See https://tools.ietf.org/html/rfc7517#section-5
type JWKSetResponse ¶
type JWKSetResponse struct { Keys []*jose.JsonWebKey TTL time.Duration // This would be used as TTL for caching. }
JWKSetResponse represents a response of JWK Set. This contains a TTL (Time to Live) for caching purpose.
type JWKsCacher ¶
type JWKsCacher struct {
// contains filtered or unexported fields
}
JWKsCacher fetches JWKs via Cache if available.
func NewCacher ¶
func NewCacher(defaultExpiration, cleanupInterval time.Duration, f JWKsFetcher) *JWKsCacher
NewCacher returns JWKsCacher with initializing cache store.
func (*JWKsCacher) FetchJWKs ¶
func (c *JWKsCacher) FetchJWKs(cacheKey string) (*JWKSetResponse, error)
FetchJWKs tries to retrieve JWKs from Cache. If the cache is not available, it will call Fetcher.FetchJWKs and cache the result for future request.
type JWKsFetcher ¶
type JWKsFetcher interface { // FetchJWKs retrieves JWKSet from path. FetchJWKs(path string) (*JWKSetResponse, error) }
JWKsFetcher is an interface that represents JWKs fetcher.
type JWKsHTTPFetcher ¶
JWKsHTTPFetcher fetches JWKs via HTTP.
func (*JWKsHTTPFetcher) FetchJWKs ¶
func (f *JWKsHTTPFetcher) FetchJWKs(uri string) (*JWKSetResponse, error)
FetchJWKs implements JWKsFetcher interface by using http.Client. FetchJWKs tries to retrieve JWKSet from uri.
type JWKsInMemoryFetcher ¶
type JWKsInMemoryFetcher struct {
RAWJWKs []byte
}
JWKsInMemoryFetcher fetches JWKs from its memory.
func (*JWKsInMemoryFetcher) FetchJWKs ¶
func (f *JWKsInMemoryFetcher) FetchJWKs(_ string) (*JWKSetResponse, error)
FetchJWKs implements JWKsFetcher interface by using internal JWKs.
type JWKsS3Fetcher ¶
JWKsS3Fetcher fetches JWKs via S3.
func (*JWKsS3Fetcher) FetchJWKs ¶
func (f *JWKsS3Fetcher) FetchJWKs(path string) (*JWKSetResponse, error)
FetchJWKs implements JWKsS3Fetcher by using S3. It tries to retrieve an S3 object from path. path must be in s3://<bucket>/<key>.