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) 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) GetTokenSecret(token, secret string) string
- func (self *Subject) Iss(iss string) *Subject
- 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时间1 Exp int64 `json:"exp"` // 授权token过期时间 Dev string `json:"dev"` // 设备类型,web/app Jti string `json:"jti"` // 唯一身份标识,主要用来作为一次性token,从而回避重放攻击 Ext string `json:"ext"` // 扩展信息 }
type Subject ¶
func (*Subject) GetTokenSecret ¶
Click to show internal directories.
Click to hide internal directories.