Documentation
¶
Index ¶
- func Check(token string) bool
- func IsExpire(token string) bool
- func Refresh(token string) string
- func SetSignature(sign string)
- type Header
- type JWT
- func (jwt *JWT) GetPayload() Payload
- func (jwt *JWT) SetDuration(duration time.Duration) *JWT
- func (jwt *JWT) SetExpire(expire time.Duration) *JWT
- func (jwt *JWT) SetExternal(external map[string]interface{}) *JWT
- func (jwt *JWT) SetIssuer(issuer string) *JWT
- func (jwt *JWT) SetOwner(owner string) *JWT
- func (jwt *JWT) SetPurpose(purpose string) *JWT
- func (jwt *JWT) SetRecipient(recipient string) *JWT
- func (jwt *JWT) String() string
- type Payload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetSignature ¶
func SetSignature(sign string)
Types ¶
type JWT ¶
type JWT struct { Header *Header `json:"header"` Payload *Payload `json:"payload"` Signature string `json:"signature"` }
func (*JWT) GetPayload ¶
func (*JWT) SetExternal ¶
func (*JWT) SetPurpose ¶
func (*JWT) SetRecipient ¶
type Payload ¶
type Payload struct { // 签发者 Issuer string `json:"issuer"` // 令牌所有者,存放ID等标识 Owner string `json:"owner"` // 用途,默认值authentication表示用于登录认证 Purpose string `json:"purpose"` // 接受方,表示申请该令牌的设备来源,如浏览器、Android等 Recipient string `json:"recipient"` // 令牌签发时间 Time int64 `json:"time"` // 过期时间 Expire int64 `json:"expire"` // 令牌持续时间,即生命周期 Duration time.Duration `json:"duration"` // 其他扩展的自定义参数 External map[string]interface{} `json:"external"` }
func GetPayload ¶
Click to show internal directories.
Click to hide internal directories.