Documentation ¶
Overview ¶
Package authkit provides convenient methods to deal with authentication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrJWKNotFound informs that JWK was not found. ErrJWKNotFound = errors.New("JWK not found") )
Functions ¶
This section is empty.
Types ¶
type JSONWebKeyer ¶
type JSONWebKeyer interface {
JSONWebKeyForToken(token *jwt.JSONWebToken) (jose.JSONWebKey, error)
}
JSONWebKeyer can provide a JWK for a JWT.
type JWKSClient ¶
type JWKSClient struct {
// contains filtered or unexported fields
}
JWKSClient represents a client for a remote JWK Set.
func NewJWKSClient ¶
func NewJWKSClient(url string) *JWKSClient
NewJWKSClient returns a new client for a remote JWK Set represented by url.
func (*JWKSClient) JSONWebKey ¶
func (c *JWKSClient) JSONWebKey(ID string) (jose.JSONWebKey, error)
JSONWebKey returns a JWK by its id.
func (*JWKSClient) JSONWebKeyForToken ¶
func (c *JWKSClient) JSONWebKeyForToken(token *jwt.JSONWebToken) (jose.JSONWebKey, error)
JSONWebKeyForToken returns a JWK for the token.
type RS256Validator ¶
type RS256Validator struct {
// contains filtered or unexported fields
}
RS256Validator validates RS256 JWTs.
func NewRS256Validator ¶
func NewRS256Validator(audience, issuer string, keyer JSONWebKeyer) *RS256Validator
NewRS256Validator returns new validator for RS256 JWTs. It checks tokens for RS256 algorithm, audience, issuer, expiration, and uses keyer to retrieve public key to verify token signature.
func (*RS256Validator) ValidClaims ¶
func (v *RS256Validator) ValidClaims(token string, dst ...interface{}) error
ValidClaims validates token and decodes its claims into dst if valid.
Click to show internal directories.
Click to hide internal directories.