Explorar el Código

delete expired checking

Paul hace 5 años
padre
commit
41c11015b7
Se han modificado 1 ficheros con 3 adiciones y 18 borrados
  1. 3
    18
      middleware/auth/auth.go

+ 3
- 18
middleware/auth/auth.go Ver fichero

52
 		}
52
 		}
53
 
53
 
54
 		if mapClaims, ok := token.Claims.(jwt.MapClaims); ok {
54
 		if mapClaims, ok := token.Claims.(jwt.MapClaims); ok {
55
-			if expired, ok := mapClaims[ctxRequestTokenExpired].(float64); ok {
56
-				if expired == 0 && tokenFromCookie == "" {
57
-					if session.DeleteJwtToken(token.Raw) {
58
-						ctx.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"msg": "auth failed, token expired"})
59
-					} else {
60
-						ctx.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"msg": "auth failed, delete server token failed"})
61
-					}
62
-
63
-					return
64
-				}
65
-
66
-				if uid, ok := mapClaims[CtxRequestHeaderUserId].(float64); ok {
67
-					ctx.Set(CtxRequestHeaderUserId, int64(uid))
68
-				} else {
69
-					ctx.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"msg": "auth failed, mapClaims[CtxRequestHeaderUserId].(float64) error"})
70
-					return
71
-				}
55
+			if uid, ok := mapClaims[CtxRequestHeaderUserId].(float64); ok {
56
+				ctx.Set(CtxRequestHeaderUserId, int64(uid))
72
 			} else {
57
 			} else {
73
-				ctx.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"msg": "auth failed, mapClaims[ctxRequestTokenExpired].(float64) error"})
58
+				ctx.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"msg": "auth failed, mapClaims[CtxRequestHeaderUserId].(float64) error"})
74
 				return
59
 				return
75
 			}
60
 			}
76
 		} else {
61
 		} else {