Skip to content

Commit a1070a6

Browse files
authored
Merge pull request #2132 from andrewbytecoder/main
fix(jwt):修正令牌过期时间计算错误
2 parents c95ece3 + b9009bb commit a1070a6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/middleware/jwt.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package middleware
22

33
import (
44
"errors"
5+
"strconv"
6+
"time"
7+
58
"github.com/flipped-aurora/gin-vue-admin/server/global"
69
"github.com/flipped-aurora/gin-vue-admin/server/utils"
710
"github.com/golang-jwt/jwt/v5"
8-
"strconv"
9-
"time"
1011

1112
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
1213
"github.com/gin-gonic/gin"
@@ -59,7 +60,7 @@ func JWTAuth() gin.HandlerFunc {
5960
newClaims, _ := j.ParseToken(newToken)
6061
c.Header("new-token", newToken)
6162
c.Header("new-expires-at", strconv.FormatInt(newClaims.ExpiresAt.Unix(), 10))
62-
utils.SetToken(c, newToken, int(dr.Seconds()))
63+
utils.SetToken(c, newToken, int(dr.Seconds()/60))
6364
if global.GVA_CONFIG.System.UseMultipoint {
6465
// 记录新的活跃jwt
6566
_ = utils.SetRedisJWT(newToken, newClaims.Username)

0 commit comments

Comments
 (0)