Documentation ¶
Index ¶
- Constants
- func GetTokenSecret(token, secret string) string
- type Header
- type JwtConfig
- type Payload
- type Subject
- func (self *Subject) AddHeader(config JwtConfig) *Subject
- func (self *Subject) Aud(aud string) *Subject
- func (self *Subject) CheckReady() bool
- func (self *Subject) Create(sub string) *Subject
- func (self *Subject) Dev(dev string) *Subject
- func (self *Subject) Expired(exp int64) *Subject
- func (self *Subject) Generate(config JwtConfig) string
- func (self *Subject) GetAud() string
- func (self *Subject) GetDev() string
- func (self *Subject) GetExp() int64
- func (self *Subject) GetExt() string
- func (self *Subject) GetIat() int64
- func (self *Subject) GetIss() string
- func (self *Subject) GetJti() string
- func (self *Subject) GetRawBytes() []byte
- func (self *Subject) GetSub() string
- func (self *Subject) GetTokenSecret(token, secret string) string
- func (self *Subject) Iss(iss string) *Subject
- func (self *Subject) ResetPayloadBytes(b []byte)
- func (self *Subject) ResetTokenBytes(b []byte)
- func (self *Subject) Signature(text, key string) string
- func (self *Subject) Verify(token, key string, decode bool) error
Constants ¶
View Source
const ( JWT = "JWT" HS256 = "HS256" SHA256 = "SHA256" MD5 = "MD5" AES = "AES" RSA = "RSA" FIVE_MINUTES = int64(300) TWO_WEEK = int64(1209600) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Payload ¶
type Payload struct { Sub string `json:"sub"` // 用户主体 Aud string `json:"aud"` // 接收token主体 Iss string `json:"iss"` // 签发token主体 Iat int64 `json:"iat"` // 授权token时间 Exp int64 `json:"exp"` // 授权token过期时间 Dev string `json:"dev"` // 设备类型,web/app Jti string `json:"jti"` // 唯一身份标识,主要用来作为一次性token,从而回避重放攻击 Ext string `json:"ext"` // 扩展信息 }
type Subject ¶
func (*Subject) CheckReady ¶ added in v1.0.104
func (*Subject) GetRawBytes ¶ added in v1.0.105
func (*Subject) GetTokenSecret ¶
func (*Subject) ResetPayloadBytes ¶ added in v1.0.111
func (*Subject) ResetTokenBytes ¶ added in v1.0.111
Click to show internal directories.
Click to hide internal directories.