From 439fc7bb98129cd1d6f9dab10589d4a24401a5f1 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期一, 13 一月 2025 16:20:31 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java index bf60f1c..12d0cdc 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java +++ b/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.NotPermissionException; import com.ruoyi.gateway.config.properties.AntiShakeProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -131,7 +132,7 @@ /** * 防抖处理 */ - public void antiShake(ServerHttpRequest request) throws Exception{ + public void antiShake(ServerHttpRequest request) { HttpMethod method = request.getMethod(); if(HttpMethod.OPTIONS == method || !antiShakeProperties.getEnable()){ return; @@ -174,20 +175,19 @@ /** * 验证token * @param request - * @throws Exception */ - public void verifyToken(ServerHttpRequest request) throws Exception{ + public void verifyToken(ServerHttpRequest request) { String token = getToken(request); if (StringUtils.isEmpty(token)) { - throw new RuntimeException("令牌不能为空"); + throw new NotPermissionException("令牌不能为空"); } Claims claims = JwtUtils.parseToken(token); if (claims == null) { - throw new RuntimeException("令牌已过期或验证不正确!"); + throw new NotPermissionException("令牌已过期或验证不正确!"); } String userid = JwtUtils.getUserId(claims); if (StringUtils.isEmpty(userid)) { - throw new RuntimeException("令牌验证失败"); + throw new NotPermissionException("令牌验证失败"); } } -- Gitblit v1.7.1