Documentation ¶
Index ¶
- Variables
- func GetClaims(c *gin.Context) (*request.CustomClaims, error)
- func GetUserAuthorityId(c *gin.Context) string
- func GetUserID(c *gin.Context) uint
- func GetUserInfo(c *gin.Context) *request.CustomClaims
- func GetUserUuid(c *gin.Context) uuid.UUID
- type JWT
- func (j *JWT) CreateClaims(baseClaims request.BaseClaims) request.CustomClaims
- func (j *JWT) CreateToken(claims request.CustomClaims) (string, error)
- func (j *JWT) CreateTokenByOldToken(oldToken string, claims request.CustomClaims) (string, error)
- func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetUserAuthorityId ¶
从Gin的Context中获取从jwt解析出来的用户角色id
func GetUserInfo ¶
func GetUserInfo(c *gin.Context) *request.CustomClaims
从Gin的Context中获取从jwt解析出来的用户角色id
Types ¶
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) CreateClaims ¶
func (j *JWT) CreateClaims(baseClaims request.BaseClaims) request.CustomClaims
func (*JWT) CreateToken ¶
func (j *JWT) CreateToken(claims request.CustomClaims) (string, error)
func (*JWT) CreateTokenByOldToken ¶
CreateTokenByOldToken 旧token 换新token 使用归并回源避免并发问题
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error)
Click to show internal directories.
Click to hide internal directories.