Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMissingKID is returned by Authenticate Strategy method, // when failed to retrieve kid from token header. ErrMissingKID = errors.New("Token missing " + headerKID + " header") // ErrInvalidAlg is returned by Authenticate Strategy method, // when jwt token alg header does not match key algorithm. ErrInvalidAlg = errors.New("Invalid signing algorithm, token alg header does not match key algorithm") )
Functions ¶
func IssueToken ¶
func IssueToken(k SecretsKeeper, dest ...interface{}) (string, error)
IssueToken issue jwt access token from the given dest.
func ParseToken ¶
func ParseToken(k SecretsKeeper, token string, dest ...interface{}) error
ParseToken parse jwt access token to the given dest.
Types ¶
type SecretsKeeper ¶
type SecretsKeeper interface { // KID return's secret/key id. // KID must return the most recently used id if more than one secret/key exists. // https://tools.ietf.org/html/rfc7515#section-4.1.4 KID() string // Get return's secret/key and the corresponding sign algorithm. Get(kid string) (key interface{}, algorithm string, err error) }
SecretsKeeper hold all secrets/keys to sign and parse JWT token
Click to show internal directories.
Click to hide internal directories.