#
luxiaotao1123
2024-09-13 c5a74fdbf86f7da8ab42a976e6a96c9edb1fc63c
#
3个文件已修改
23 ■■■■■ 已修改文件
zy-acs-flow/src/api/auth/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/config/authProvider.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/common/security/JwtAuthenticationFilter.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/api/auth/index.js
@@ -9,7 +9,7 @@
}
export async function menus(_params) {
    const res = await request.get('/auth/menu', _params);
    return await request.get('/auth/menu', _params);
    if (res.data.code === 200) {
        return res.data.data;
    }
zy-acs-flow/src/config/authProvider.js
@@ -52,10 +52,25 @@
  getPermissions: async () => {
    const token = getToken();
    if (!token) {
      localStorage.removeItem("user");
      if (window.location.pathname !== "/login") {
        window.location.href = "/login";
      }
      return Promise.reject();
    }
    const res = await menus();
    return Promise.resolve(res);
    const { code, msg, data } = res.data;
    if (code === 200) {
      return Promise.resolve(data);
    } else if (code === 401) {
      localStorage.removeItem("user");
      if (window.location.pathname !== "/login") {
        window.location.href = "/login";
        return Promise.reject();
      }
    } else {
      return Promise.reject(msg);
    }
  },
  // getIdentity
  getIdentity: () => {
zy-acs-manager/src/main/java/com/zy/acs/manager/common/security/JwtAuthenticationFilter.java
@@ -12,6 +12,7 @@
import com.zy.acs.framework.common.Cools;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@@ -34,6 +35,7 @@
 * 处理携带token的请求过滤器
 *
 */
@Slf4j
@Component
public class JwtAuthenticationFilter extends OncePerRequestFilter {
@@ -96,10 +98,12 @@
                    }
                }
            } catch (ExpiredJwtException e) {
                log.error("JwtAuthenticationFilter ExpiredJwtException", e);
                CommonUtil.responseError(response, Constants.TOKEN_EXPIRED_CODE, Constants.TOKEN_EXPIRED_MSG,
                        e.getMessage());
                return;
            } catch (Exception e) {
                log.error("JwtAuthenticationFilter", e);
                CommonUtil.responseError(response, Constants.BAD_CREDENTIALS_CODE, Constants.BAD_CREDENTIALS_MSG,
                        e.toString());
                return;