Documentation ¶
Overview ¶
Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html.
See the exemplas for usage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAlgorithm = errors.New("jwt: invalid algorithm")
ErrInvalidAlgorithm is returned when the token header key alg doesn't match
var ErrInvalidAudience = errors.New("jwt: invalid audience")
ErrInvalidAudience is returned when the claims.Audience doesn't match
var ErrInvalidIssuer = errors.New("jwt: invalid issuer")
ErrInvalidIssuer is returned when the claims.Issuer doesn't match
var ErrInvalidNumberOfSegments = errors.New("jwt: token contains an invalid number of segments")
ErrInvalidNumberOfSegments is returned when the token has less than 3 parts
var ErrInvalidSignature = errors.New("jwt: invalid signature")
ErrInvalidSignature is returned when the token signature doesn't match
var ErrInvalidSubject = errors.New("jwt: invalid subject")
ErrInvalidSubject is returned when the claims.Subject doesn't match
var ErrMalformedTokenClaims = errors.New("jwt: malformed token claims string")
ErrMalformedTokenClaims is returned when a error ocurrend with the jsaon Unmarshalling from token claims segment
var ErrMalformedTokenHeader = errors.New("jwt: malformed token header string")
ErrMalformedTokenHeader is returned when a error ocurrend with the jsaon Unmarshalling from token head segment
var ErrTokenExpired = errors.New("jwt: token expired")
ErrTokenExpired is used when the token has a claims.ExpiresAt < now
var ErrTokenNotValidYet = errors.New("jwt: token is not valid yet")
ErrTokenNotValidYet is returned when the client try to use a token before the claims.NotBefore time
var ErrTokenUsedBeforeIssued = errors.New("jwt: token used before issued")
ErrTokenUsedBeforeIssued is returned when the client try to use a token with now <= claims.IssuedAt >= now.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct { Audience string `json:"aud"` ExpiresAt int64 `json:"exp"` ID string `json:"jti"` IssuedAt int64 `json:"iat"` Issuer string `json:"iss"` NotBefore int64 `json:"nbf"` Subject string `json:"sub"` }
Claims is a structured version of Claims Section, as referenced at https://tools.ietf.org/html/rfc7519#section-4.1