🎨双token校验

This commit is contained in:
coward
2024-07-12 10:11:37 +08:00
parent fb97082c0c
commit d74d7c579f
4 changed files with 58 additions and 5 deletions

View File

@@ -22,7 +22,14 @@ func Authorization() gin.HandlerFunc {
return
}
userClaims, err := component.JWT().ParseToken(token)
hashPassword := c.Request.Header.Get("X-TOKEN")
if hashPassword == "" {
response.R(c).AuthorizationFailed("未登陆")
c.Abort()
return
}
userClaims, err := component.JWT().ParseToken(token, hashPassword)
if err != nil {
response.R(c).AuthorizationFailed("未登陆")
c.Abort()