Documentation ¶
Index ¶
- Variables
- type Token
- func (token *Token) Algorithm() string
- func (token *Token) Audience() string
- func (token *Token) Decode(tokenStr string) error
- func (token *Token) Encode() (string, error)
- func (token *Token) Expiration() (time.Time, bool)
- func (token *Token) IssuedAt() (time.Time, bool)
- func (token *Token) Issuer() string
- func (token *Token) NotBefore() (time.Time, bool)
- func (token *Token) SetAudience(audience string)
- func (token *Token) SetClaim(key string, value interface{})
- func (token *Token) SetExpiration(ts time.Time)
- func (token *Token) SetIssuedAt(ts time.Time)
- func (token *Token) SetIssuer(issuer string)
- func (token *Token) SetNotBefore(ts time.Time)
- func (token *Token) SetSubject(subject string)
- func (token *Token) String() string
- func (token *Token) Subject() string
- func (token *Token) Type() string
- func (token *Token) Valid() bool
- func (token *Token) Validate() error
- func (token *Token) VerifySignature(tokenStr string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("token is not valid") ErrInvalidHeader = errors.New("token has invalid header") ErrInvalidType = errors.New("invalid token type") ErrInvalidAlgorithm = errors.New("invalid or unsupported signing algorithm") ErrInvalidTimestamp = errors.New("invalid timestamp") ErrMalformedToken = errors.New("malformed token content") ErrContextNotSet = errors.New("token context has not been set") )
Errors related to JSON web tokens
Functions ¶
This section is empty.
Types ¶
type Token ¶
type Token struct { Context tokencontext.Context `json:"-"` Header map[string]interface{} `json:"header,omitempty"` Payload map[string]interface{} `json:"payload,omitempty"` }
func NewToken ¶
func NewToken(ctx tokencontext.Context) *Token
func (*Token) SetAudience ¶
func (*Token) SetExpiration ¶
func (*Token) SetIssuedAt ¶
func (*Token) SetNotBefore ¶
func (*Token) SetSubject ¶
func (*Token) VerifySignature ¶
Click to show internal directories.
Click to hide internal directories.