Documentation ¶
Index ¶
- type GolddenJwt
- func (gj *GolddenJwt) CreateToken(claims jwtgo.MapClaims) (tokenStr string, err error)
- func (gj *GolddenJwt) CreateTokenAndSetCookie(claims jwtgo.MapClaims, ctx *gin.Context) (tokenStr string, err error)
- func (gj *GolddenJwt) GetClaimsFromToken(tokenStr string) (claims jwtgo.MapClaims, err error)
- func (gj *GolddenJwt) GinJwtMiddleware(ctx *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GolddenJwt ¶
type GolddenJwt struct { Exp int // contains filtered or unexported fields }
func NewGolddenJwt ¶
func NewGolddenJwt(exp int, puk, prk string) (gj *GolddenJwt, err error)
func (*GolddenJwt) CreateToken ¶
func (gj *GolddenJwt) CreateToken(claims jwtgo.MapClaims) (tokenStr string, err error)
createToken 生成一个RS256验证的Token Token里面包括的值,可以自己根据情况添加,
func (*GolddenJwt) CreateTokenAndSetCookie ¶
func (gj *GolddenJwt) CreateTokenAndSetCookie(claims jwtgo.MapClaims, ctx *gin.Context) (tokenStr string, err error)
createToken 生成一个RS256验证的Token Token里面包括的值,可以自己根据情况添加,
func (*GolddenJwt) GetClaimsFromToken ¶
func (gj *GolddenJwt) GetClaimsFromToken(tokenStr string) (claims jwtgo.MapClaims, err error)
getSubFromToken 获取Token的主题(也可以更改获取其他值) 参数tokenStr指的是 从客户端传来的待验证Token 验证Token过程中,如果Token生成过程中,指定了iat与exp参数值,将会自动根据时间戳进行时间验证
func (*GolddenJwt) GinJwtMiddleware ¶
func (gj *GolddenJwt) GinJwtMiddleware(ctx *gin.Context)
Click to show internal directories.
Click to hide internal directories.