From ff7b9bb5b4db897ac0ea7566540ccaa491325a28 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期六, 13 九月 2025 09:07:32 +0800
Subject: [PATCH] 修改

---
 common/src/main/java/com/jilongda/common/security/JwtTokenUtils.java |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/src/main/java/com/jilongda/common/security/JwtTokenUtils.java b/common/src/main/java/com/jilongda/common/security/JwtTokenUtils.java
index 5021e54..7d7398c 100644
--- a/common/src/main/java/com/jilongda/common/security/JwtTokenUtils.java
+++ b/common/src/main/java/com/jilongda/common/security/JwtTokenUtils.java
@@ -214,7 +214,7 @@
     public static Boolean validateToken(String token, String username) {
         String userName = getUsername(token);
         if (!StringUtils.hasLength(userName)) {
-            throw new IllegalArgumentException("请求令牌无效");
+            throw new ServiceException(401,"请求令牌无效");
         }
         return (userName.equals(username) && !isTokenExpired(token));
     }
@@ -285,7 +285,7 @@
         String asToken = request.getHeader(Constant.ALIAS_TOKEN_HEADER);
         // 如果这两个头部信息均不存在
         if (!StringUtils.hasLength(token) && !StringUtils.hasLength(asToken)) {
-            throw new ServiceException("资源未认证,访问受限");
+            throw new ServiceException(401,"资源未认证,访问受限");
         }
         // token转换
         if (!StringUtils.hasLength(token)) {
@@ -302,7 +302,7 @@
         try {
             token = new String(Base64Utils.decode(token.getBytes()));
         } catch (IllegalArgumentException e) {
-            throw new IllegalArgumentException("无效的令牌");
+            throw new ServiceException(401,"无效的令牌");
         }
         return token;
     }

--
Gitblit v1.7.1