Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMalformed = errors.New("jwt: malformed token")
ErrMalformed indicates a token doesn't have a valid format, as per the RFC 7519.
var ErrNotJSONObject = errors.New("jwt: payload is not a valid JSON object")
ErrNotJSONObject is the error for when a JWT payload is not a JSON object.
Functions ¶
This section is empty.
Types ¶
type Audience ¶
type Audience []string
Audience is a special claim that may either be a single string or an array of strings, as per the RFC 7519.
func (Audience) MarshalJSON ¶
MarshalJSON implements a marshaling function for "aud" claim.
func (*Audience) UnmarshalJSON ¶
UnmarshalJSON implements an unmarshaling function for "aud" claim.
type CryptoCodec ¶
type CryptoCodec interface {
Encode(key, plaintext []byte) ([]byte, error)
Decode(key, ciphertext []byte) ([]byte, error)
// contains filtered or unexported methods
}
func NewCookieCodec ¶
func NewCookieCodec(hashKey, blockKey []byte) CryptoCodec
func NewJwtCodec ¶
func NewJwtCodec(alg string) CryptoCodec
type GobEncoder ¶
type GobEncoder struct{}
GobEncoder encodes cookie values using encoding/gob. This is the simplest encoder and can handle complex types via gob.Register.
func (GobEncoder) Decode ¶
func (e GobEncoder) Decode(src []byte, dst interface{}) error
Decode decodes a value using gob.
func (GobEncoder) Encode ¶
func (e GobEncoder) Encode(src interface{}) ([]byte, error)
type JSONEncoder ¶
type JSONEncoder struct{}
func (JSONEncoder) Decode ¶
func (e JSONEncoder) Decode(src []byte, dst interface{}) error
Decode decodes a value using encoding/json.
func (JSONEncoder) Encode ¶
func (e JSONEncoder) Encode(src interface{}) ([]byte, error)
Encode encodes a value using encoding/json.
type ObjectCodec ¶
type Payload ¶
type Payload struct {
Issuer string `json:"iss,omitempty"`
Subject string `json:"sub,omitempty"`
Audience Audience `json:"aud,omitempty"`
ExpirationTime *core.Time `json:"exp,omitempty"`
NotBefore *core.Time `json:"nbf,omitempty"`
IssuedAt *core.Time `json:"iat,omitempty"`
JWTID string `json:"jti,omitempty"`
}
Payload is a JWT payload according to the RFC 7519.