Documentation ¶
Index ¶
- Variables
- func New(key []byte, algo *Algorithm, claims *Claims) ([]byte, error)
- func NewHS256(key []byte, claims *Claims) ([]byte, error)
- func NewHS256Custom(key []byte, claims interface{}) ([]byte, error)
- func NewHS384(key []byte, claims *Claims) ([]byte, error)
- func NewHS384Custom(key []byte, claims interface{}) ([]byte, error)
- func NewHS512(key []byte, claims *Claims) ([]byte, error)
- func NewHS512Custom(key []byte, claims interface{}) ([]byte, error)
- func NewWithCustom(key []byte, algo *Algorithm, claims interface{}) ([]byte, error)
- func Parse(token []byte, header *Header, claims *Claims) ([]byte, []byte, error)
- func ParseAndValidate(token, key []byte, algo *Algorithm, claims *Claims) error
- func ParseAndValidateCustom(token, key []byte, algo *Algorithm, claims interface{}, ...) error
- func ParseCustom(token []byte, header *Header, claims interface{}) ([]byte, []byte, error)
- func ParseHS256(key, token []byte, claims *Claims) error
- func ParseHS256Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error
- func ParseHS384(key, token []byte, claims *Claims) error
- func ParseHS384Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error
- func ParseHS512(key, token []byte, claims *Claims) error
- func ParseHS512Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error
- func Verify(algo *Algorithm, message, sign, key []byte) error
- type Algorithm
- type Claims
- func (c *Claims) CheckAud(check string) bool
- func (c *Claims) CheckExp(check int64) bool
- func (c *Claims) CheckIss(check string) bool
- func (c *Claims) CheckNbf(check int64) bool
- func (c *Claims) Decode(data []byte) error
- func (c *Claims) Encode() (string, error)
- func (v Claims) MarshalEasyJSON(w *jwriter.Writer)
- func (v Claims) MarshalJSON() ([]byte, error)
- func (v *Claims) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *Claims) UnmarshalJSON(data []byte) error
- type Header
- type ValidatorFunction
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewHS256Custom ¶
func NewHS384Custom ¶
func NewHS512Custom ¶
func NewWithCustom ¶
func ParseAndValidate ¶
func ParseAndValidateCustom ¶
func ParseAndValidateCustom(token, key []byte, algo *Algorithm, claims interface{}, validator ValidatorFunction) error
func ParseCustom ¶
func ParseHS256 ¶
func ParseHS256Custom ¶
func ParseHS256Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error
func ParseHS384 ¶
func ParseHS384Custom ¶
func ParseHS384Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error
func ParseHS512 ¶
func ParseHS512Custom ¶
func ParseHS512Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error
Types ¶
type Claims ¶
type Claims struct { Audience string `json:"aud,omitempty"` ExpiresAt int64 `json:"exp,omitempty"` ID string `json:"jti,omitempty"` IssuedAt int64 `json:"iat,omitempty"` Issuer string `json:"iss,omitempty"` NotBefore int64 `json:"nbf,omitempty"` Subject string `json:"sub,omitempty"` }
func (Claims) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Claims) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Claims) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Claims) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Header ¶
func (Header) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Header) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Header) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Header) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ValidatorFunction ¶
type ValidatorFunction func(claims interface{}) bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.