Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIatTime = errors.New("jwt in bad format,iat>=exp")
View Source
var ErrTimeExp = errors.New("jwt is expiration")
同一類型的多個錯誤實例
Functions ¶
func GetNewJwtToken ¶
func GetNewJwtToken(hs256Key []byte, userClaims *UserClaims) (string, error)
創建一個新的jwt,
Types ¶
type UserClaims ¶
type UserClaims struct { ClientId string `json:"client_id"` //頒發給哪個端 UserId string `json:"user_id"` //用戶id Iat int64 `json:"iat"` //發放時間 Exp int64 `json:"exp"` //過期時間 Jti string `json:"jti"` //token 的id ,唯一標識 Iss string `json:"iss"` //簽發者 是sys_user_control }
jwt payload的內容,如果是app角色,則appid為空。,web端默認web
func CheckJwtToken ¶
func CheckJwtToken(hs256Key []byte, jwtString string) (userClaims UserClaims, err error)
檢查jwt是否有效
Click to show internal directories.
Click to hide internal directories.