Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetSigningAlgorithm ¶
func GetSigningAlgorithm(name string) (algorithms.SigningAlgorithm, error)
GetSigningAlgorithm returns the signing algorithm for the given algorithm name.
Types ¶
type CustomClaims ¶
type CustomClaims map[string]interface{}
CustomClaims represents a custom claims set.
func (CustomClaims) Get ¶
func (cc CustomClaims) Get(key string) (value interface{})
func (CustomClaims) Valid ¶
func (cc CustomClaims) Valid(t int64) error
Valid returns an error if the CustomClaims object is not valid. Otherwise nil is returned; indicating the claims set is valid.
type JOSEHeader ¶
type JOSEHeader map[string]interface{}
JOSEHeader represents the JOSE header of a JWT. It is common, that only the typ and alg fields are set; identifying the algorithm used in generating the JWT's signature.
type RegisteredClaims ¶
type RegisteredClaims struct { Issuer string `json:"iss,omitempty"` Subject string `json:"sub,omitempty"` Audience string `json:"aud,omitempty"` ExpirationTime int64 `json:"exp,omitempty"` NotBefore int64 `json:"nbf,omitempty"` IssuedAt int64 `json:"iat,omitempty"` JWTID string `json:"jti,omitempty"` }
RegisteredClaims implements a claims set using the registered (standard) claims according to the IANA "JSON Web Token Claims" registry.
func (RegisteredClaims) Get ¶
func (rc RegisteredClaims) Get(key string) (value interface{})
func (RegisteredClaims) Valid ¶
func (rc RegisteredClaims) Valid(t int64) error
Valid returns an error if the RegisteredClaims object is not valid. Otherwise nil is returned; indicating the claims set is valid.
type Token ¶
type Token struct { Header JOSEHeader Claims Claims Data string Signature string Algorithm algorithms.SigningAlgorithm }
Token represents a JSON Web Token (JWT).
func New ¶
func New(claims Claims, alg algorithms.SigningAlgorithm) *Token
NewToken returns a new JWT instance.
func (*Token) SigningString ¶
SigningString returns the base64 encoded string for generating the signature of the JWT.