Documentation ¶
Index ¶
- Variables
- func GenerateJWTToken(customClaims *CustomClaims) (string, error)
- func GetCustomData(tokenStr string, signingKey ...string) (string, error)
- func SetIssuer(issuer string)
- func SetSigningMethod(method jwt.SigningMethod)
- func VerifyJWTToken(tokenStr string, signingKey ...string) (bool, error)
- type CustomClaims
- type CustomData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Issuer = "Anonymous" SigningKey = []byte("Please replace the default signing key") SigningMethod jwt.SigningMethod = jwt.SigningMethodHS256 ErrCustomClaimsInValid = errors.New("custom claims invalid") )
Functions ¶
func GenerateJWTToken ¶
func GenerateJWTToken(customClaims *CustomClaims) (string, error)
func SetSigningMethod ¶
func SetSigningMethod(method jwt.SigningMethod)
Types ¶
type CustomClaims ¶
type CustomClaims struct { SigningKey []byte Data string `json:"data"` // any string, can be JSON marshal {"a":1} jwt.StandardClaims }
func NewCustomClaims ¶
func NewCustomClaims(data string, ttl time.Duration, signingKey ...string) *CustomClaims
NewCustomClaims custom request authorization
Click to show internal directories.
Click to hide internal directories.