Pu Zhibing
2025-01-17 c80c0184b6e560d41d5aa5691874e07b681fa18f
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java
@@ -1,5 +1,6 @@
package com.ruoyi.gateway.filter;
import com.ruoyi.common.core.exception.auth.NotLoginException;
import com.ruoyi.gateway.config.properties.AntiShakeProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -179,15 +180,15 @@
   public void verifyToken(ServerHttpRequest request) throws Exception{
      String token = getToken(request);
      if (StringUtils.isEmpty(token)) {
         throw new RuntimeException("令牌不能为空");
         throw new NotLoginException("令牌不能为空");
      }
      Claims claims = JwtUtils.parseToken(token);
      if (claims == null) {
         throw new RuntimeException("令牌已过期或验证不正确!");
         throw new NotLoginException("令牌已过期或验证不正确!");
      }
      String userid = JwtUtils.getUserId(claims);
      if (StringUtils.isEmpty(userid)) {
         throw new RuntimeException("令牌验证失败");
         throw new NotLoginException("令牌验证失败");
      }
   }