Documentation ¶
Overview ¶
Package jwt is authentication by JWT
Index ¶
- Constants
- func CreateBasicToken(t int64, clientID, userName string) (string, error)
- func CreateToken(t int64, clientID, userName, option string) (string, error)
- func InitAudience(str string)
- func InitEncrypted(mode uint8)
- func InitKeys(priKey, pubKey string) (err error)
- func InitSecretKey(str string)
- func JudgeJWT(tokenString string) error
- func JudgeJWTWithClaim(tokenString, clientID, userName string) error
- func JudgeJWTWithCustomClaim(tokenString, clientID, userName, option string) error
- type CustomClaims
Constants ¶
View Source
const ( //HMAC is for signature HMAC uint8 = 1 //RSA is for signature RSA uint8 = 2 )
Variables ¶
This section is empty.
Functions ¶
func CreateBasicToken ¶
CreateBasicToken is to encode Header,Payload,Signature by Base64 and concatenate these by dot. This is for basic claim
func CreateToken ¶
CreateToken is to encode Header,Payload,Signature by Base64 and concatenate these by dot. This is for user defined claim
func JudgeJWTWithClaim ¶
JudgeJWTWithClaim is to check token by clientID and userName It may be too strict to check
func JudgeJWTWithCustomClaim ¶
JudgeJWTWithCustomClaim is to check token by clientId and userName and option It may be too strict to check
Types ¶
type CustomClaims ¶
type CustomClaims struct { Option string `json:"option"` jwt.StandardClaims }
CustomClaims is structure of json for jwt claim
Click to show internal directories.
Click to hide internal directories.