Documentation ¶
Index ¶
- Constants
- Variables
- func GetGoldenClaims(ctx *gin.Context) (jwtgo.MapClaims, error)
- func RefreshCookie(ctx *gin.Context) (tokenStr string, err error)
- type GoldenJwt
- func (gj *GoldenJwt) CreateToken(claims jwtgo.MapClaims) (tokenStr string, err error)
- func (gj *GoldenJwt) CreateTokenAndSetCookie(claims jwtgo.MapClaims, ctx *gin.Context) (tokenStr string, err error)
- func (gj *GoldenJwt) GetClaimsFromToken(tokenStr string) (claims jwtgo.MapClaims, err error)
- func (gj *GoldenJwt) GinJwtMiddleware(ctx *gin.Context)
Constants ¶
View Source
const GoldenClaims = "golden_claims"
View Source
const GoldenJwtKey = "golden_jwt"
Variables ¶
View Source
var GoldenKey = "golden_key" + viper.GetString("cookie.suffix")
Functions ¶
func GetGoldenClaims ¶ added in v1.1.8
Types ¶
type GoldenJwt ¶ added in v1.1.1
type GoldenJwt struct { Exp int // contains filtered or unexported fields }
func NewGoldenJwt ¶ added in v1.1.1
func (*GoldenJwt) CreateToken ¶ added in v1.1.1
createToken 生成一个RS256验证的Token Token里面包括的值,可以自己根据情况添加,
func (*GoldenJwt) CreateTokenAndSetCookie ¶ added in v1.1.1
func (gj *GoldenJwt) CreateTokenAndSetCookie(claims jwtgo.MapClaims, ctx *gin.Context) (tokenStr string, err error)
createToken 生成一个RS256验证的Token Token里面包括的值,可以自己根据情况添加,
func (*GoldenJwt) GetClaimsFromToken ¶ added in v1.1.1
getSubFromToken 获取Token的主题(也可以更改获取其他值) 参数tokenStr指的是 从客户端传来的待验证Token 验证Token过程中,如果Token生成过程中,指定了iat与exp参数值,将会自动根据时间戳进行时间验证
func (*GoldenJwt) GinJwtMiddleware ¶ added in v1.1.1
Click to show internal directories.
Click to hide internal directories.