Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // HS256 Method HS256 = jwt.SigningMethodHS256 // HS384 Method HS384 = jwt.SigningMethodHS384 // HS512 Method HS512 = jwt.SigningMethodHS512 )
Functions ¶
func GenerateToken ¶
GenerateToken generate token
func GenerateTokenStandard ¶
GenerateTokenStandard generate token
func VerifyTokenStandard ¶
VerifyTokenStandard verify token
Types ¶
type CustomClaims ¶
type CustomClaims struct { UID string `json:"uid"` Role string `json:"role"` jwt.StandardClaims }
CustomClaims add custom fields to StandardClaims' payload
func VerifyToken ¶
func VerifyToken(tokenString string) (*CustomClaims, error)
VerifyToken verify token
type Option ¶
type Option func(*options)
Option set the jwt options.
func WithSigningMethod ¶
func WithSigningMethod(sm *jwt.SigningMethodHMAC) Option
WithSigningMethod set signing method value
Click to show internal directories.
Click to hide internal directories.