Documentation
¶
Index ¶
- Constants
- Variables
- func Sign(token Token, key []byte) (string, error)
- func Verify(t string, key []byte) error
- type Algorithm
- type Header
- type Payload
- type Token
- func (t Token) Get(key string) (interface{}, error)
- func (t Token) GetAudience() ([]string, error)
- func (t Token) GetExpirationTime() (time.Time, error)
- func (t Token) GetHeader() Header
- func (t Token) GetIssuedAt() (time.Time, error)
- func (t Token) GetIssuer() (string, error)
- func (t Token) GetJWTID() (string, error)
- func (t Token) GetNotBefore() (time.Time, error)
- func (t Token) GetPayload() Payload
- func (t Token) GetSubject() (string, error)
- func (t *Token) Set(key string, value interface{})
- func (t *Token) SetAudience(aud ...string)
- func (t *Token) SetExpirationTime(exp time.Time)
- func (t *Token) SetIssuedAt(iat time.Time)
- func (t *Token) SetIssuer(iss string)
- func (t *Token) SetJWTID(jti string)
- func (t *Token) SetNotBefore(nbf time.Time)
- func (t *Token) SetSubject(sub string)
- func (t Token) Validate() error
Constants ¶
View Source
const ( ClaimIssuer = "iss" ClaimSubject = "sub" ClaimAudience = "aud" ClaimExpirationTime = "exp" ClaimNotBefore = "nbf" ClaimIssuedAt = "iat" ClaimJWTID = "jti" )
Registered Claim Names.
Variables ¶
View Source
var ( ErrClaimNotFound = errors.New("claim not found") ErrInvalidClaimType = errors.New("invalid claim type") ErrTokenExpired = errors.New("token expired") ErrTokenShouldNotBeAccepted = errors.New("token should not be accepted for processing yet") ErrInvalidToken = errors.New("invalid token provided") ErrInvalidTokenSignature = errors.New("invalid token signature") ErrUnsupportedAlgorithm = errors.New("unsupported algorithm") ErrUnsupportedTokenType = errors.New("unsupported token type") ErrInvalidPem = errors.New("invalid pem received") )
Functions ¶
Types ¶
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token struct.
func (Token) GetAudience ¶
func (Token) GetPayload ¶
func (Token) GetSubject ¶
func (*Token) SetAudience ¶
func (*Token) SetExpirationTime ¶
func (*Token) SetIssuedAt ¶
func (*Token) SetNotBefore ¶
func (*Token) SetSubject ¶
Click to show internal directories.
Click to hide internal directories.