diff --git a/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/cros/CrosFilter.java b/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/cros/CrosFilter.java index 930d55c..0575137 100644 --- a/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/cros/CrosFilter.java +++ b/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/cros/CrosFilter.java @@ -2,8 +2,8 @@ * @Author: Kane * @Date: 2023-01-29 10:39:41 * @LastEditors: Kane - * @LastEditTime: 2023-01-29 10:39:44 - * @FilePath: \requirement\src\main\java\com\cpic\xim\web\filters\cros\CrosFilter.java + * @LastEditTime: 2023-02-04 17:12:05 + * @FilePath: /后端-需求/src/main/java/com/cpic/xim/web/filters/cros/CrosFilter.java * @Description: 过滤器,用于对CROS访问进行响应。允许任何来源的访问。 * * Copyright (c) ${2022} by Kane, All Rights Reserved. @@ -33,7 +33,7 @@ public class CrosFilter implements Filter response.setHeader( "Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE" ); response.setHeader( "Access-Control-Max-Age", "0" ); response.setHeader( "Access-Control-Allow-Headers", - "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token" ); + "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token,username" ); response.setHeader( "Access-Control-Allow-Credentials", "true" ); response.setHeader( "XDomainRequestAllowed", "1" ); response.setHeader( "XDomainRequestAllowed", "1" ); diff --git a/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/token/TokenFilter.java b/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/token/TokenFilter.java index 376f6e9..b1d69df 100644 --- a/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/token/TokenFilter.java +++ b/code/java/后端-需求/src/main/java/com/cpic/xim/web/filters/token/TokenFilter.java @@ -2,8 +2,8 @@ * @Author: Kane * @Date: 2023-01-29 10:50:49 * @LastEditors: Kane - * @LastEditTime: 2023-01-29 10:55:27 - * @FilePath: \requirement\src\main\java\com\cpic\xim\web\filters\token\TokenFilter.java + * @LastEditTime: 2023-02-04 18:05:18 + * @FilePath: /后端-需求/src/main/java/com/cpic/xim/web/filters/token/TokenFilter.java * @Description: * * Copyright (c) ${2022} by Kane, All Rights Reserved. @@ -11,6 +11,7 @@ package com.cpic.xim.web.filters.token; import java.io.IOException; +import java.util.Enumeration; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.ServletException; @@ -19,9 +20,11 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -@SuppressWarnings( "unused") +@SuppressWarnings( "unused" ) public class TokenFilter implements Filter { + private static final String FILTE_METHODS = "POST,GET"; + @Override public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException @@ -29,8 +32,14 @@ public class TokenFilter implements Filter HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; - // 获取请求中的token字符串 - String token = request.getHeader( "Token" ); + String method = request.getMethod().toUpperCase(); + + // 只处理POST和GET + if ( FILTE_METHODS.indexOf( method ) != -1 ) + { + // 检查token + String token = request.getHeader( "token" ); + } chain.doFilter( request, response ); } diff --git a/code/web/IT工具综合平台/.env.development b/code/web/IT工具综合平台/.env.development index dbd8ffb..9b794bf 100644 --- a/code/web/IT工具综合平台/.env.development +++ b/code/web/IT工具综合平台/.env.development @@ -1,3 +1,3 @@ VUE_APP_API_URL_LOGIN = "http://222.76.244.118:11001/admin-system/account/p13_account_check" VUE_APP_API_URL_UPLOAD_FILE= "http://222.76.244.118:11001/admin-system/file/file-upload.do" -VUE_APP_API_URL_REQUIREMENT_STATUS= "http://222.76.244.118:11001/requirement/query_requirement_status.do" \ No newline at end of file +VUE_APP_API_URL_REQUIREMENT_STATUS= "http://localhost:8080/requirement/query_requirement_status.do" \ No newline at end of file diff --git a/code/web/IT工具综合平台/src/layout/Index.vue b/code/web/IT工具综合平台/src/layout/Index.vue index 03120d0..ced89eb 100644 --- a/code/web/IT工具综合平台/src/layout/Index.vue +++ b/code/web/IT工具综合平台/src/layout/Index.vue @@ -2,14 +2,14 @@ * @Author: Kane * @Date: 2023-01-04 11:05:44 * @LastEditors: Kane - * @LastEditTime: 2023-02-04 01:02:13 - * @FilePath: \IT工具综合平台\src\layout\Index.vue + * @LastEditTime: 2023-02-04 16:35:20 + * @FilePath: /IT工具综合平台/src/layout/Index.vue * @Description: * * Copyright (c) ${2022} by Kane, All Rights Reserved. --> diff --git a/code/web/IT工具综合平台/src/views/requirement/RequirementEditing.vue b/code/web/IT工具综合平台/src/views/requirement/RequirementEditing.vue index 934d13d..4caf897 100644 --- a/code/web/IT工具综合平台/src/views/requirement/RequirementEditing.vue +++ b/code/web/IT工具综合平台/src/views/requirement/RequirementEditing.vue @@ -2,18 +2,8 @@ * @Author: Kane * @Date: 2023-01-25 23:16:29 * @LastEditors: Kane - * @LastEditTime: 2023-02-03 11:07:02 - * @FilePath: \IT工具综合平台\src\views\requirement\RequirementEditing.vue - * @Description: - * - * Copyright (c) ${2022} by Kane, All Rights Reserved. ---> -