Browse Source

生产打包配置值

csg6 1 day ago
parent
commit
b0a1187328

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -43,7 +43,7 @@ public class SysLoginController {
43
      * @return 结果
43
      * @return 结果
44
      */
44
      */
45
     //TODO 打包屏蔽-甲方部署时注释:甲方不需要本地登录功能采用单点登录
45
     //TODO 打包屏蔽-甲方部署时注释:甲方不需要本地登录功能采用单点登录
46
-    @PostMapping("/login")
46
+    /*@PostMapping("/login")
47
     public AjaxResult login(@RequestBody LoginBody loginBody) {
47
     public AjaxResult login(@RequestBody LoginBody loginBody) {
48
         AjaxResult ajax = AjaxResult.success();
48
         AjaxResult ajax = AjaxResult.success();
49
 
49
 
@@ -51,7 +51,7 @@ public class SysLoginController {
51
         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid(), true);
51
         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid(), true);
52
         ajax.put(Constants.TOKEN, token);
52
         ajax.put(Constants.TOKEN, token);
53
         return ajax;
53
         return ajax;
54
-    }
54
+    }*/
55
 
55
 
56
     /**
56
     /**
57
      * 获取用户信息
57
      * 获取用户信息

+ 11 - 11
ruoyi-common/src/main/java/com/ruoyi/common/filter/RestCorsFilter.java

@@ -22,8 +22,8 @@ import java.util.Set;
22
 public class RestCorsFilter implements Filter {
22
 public class RestCorsFilter implements Filter {
23
 
23
 
24
     //配置文件:application-cas-test.yml -> caseitc:
24
     //配置文件:application-cas-test.yml -> caseitc:
25
-//    @Autowired
26
-//    private CasConfig casConfig;
25
+    @Autowired
26
+    private CasConfig casConfig;
27
 
27
 
28
 
28
 
29
     public RestCorsFilter() {
29
     public RestCorsFilter() {
@@ -42,10 +42,10 @@ public class RestCorsFilter implements Filter {
42
         log.info("【跨域过滤器】request.getRequestURL() = " + request.getRequestURL());//http://192.168.3.200:8180/system/role/41749924753409
42
         log.info("【跨域过滤器】request.getRequestURL() = " + request.getRequestURL());//http://192.168.3.200:8180/system/role/41749924753409
43
 //        log.info("【跨域过滤器】request.getServletContext().getRealPath(\"/\") = " + request.getServletContext().getRealPath("/"));//获取“/”在机器中的实际地址 C:\Users\15753\AppData\Local\Temp\tomcat-docbase.8180.7251487789088039644\
43
 //        log.info("【跨域过滤器】request.getServletContext().getRealPath(\"/\") = " + request.getServletContext().getRealPath("/"));//获取“/”在机器中的实际地址 C:\Users\15753\AppData\Local\Temp\tomcat-docbase.8180.7251487789088039644\
44
 
44
 
45
-//        String serverLoginUrl = casConfig.getServerLoginUrl();
46
-//        String webStartPage = casConfig.getWebStartPage();
47
-//        log.info("【跨域过滤器】serverLoginUrl = " + serverLoginUrl);
48
-//        log.info("【跨域过滤器】webStartPage = " + webStartPage);
45
+        String serverLoginUrl = casConfig.getServerLoginUrl();//单点地址:http://10.152.70.21:8080/cas/login
46
+        String webStartPage = casConfig.getWebStartPage();//前端Ngxin地址:http://10.152.72.7:8181/postcheck
47
+        log.info("【跨域过滤器】设置动态从配置文件中取值-单点地址(注意:应该需要切割“/cas/login”,如果前端提示跨域需要处理一下端口的地址) = " + serverLoginUrl);
48
+        log.info("【跨域过滤器】设置动态从配置文件中取值-前端Ngxin地址(注意:应该需要切割“/postcheck”,如果前端提示跨域需要处理一下端口的地址) = " + webStartPage);
49
 
49
 
50
         // 允许的来源
50
         // 允许的来源
51
         String[] allowDomain = {
51
         String[] allowDomain = {
@@ -54,9 +54,9 @@ public class RestCorsFilter implements Filter {
54
                 "http://10.152.72.7:8180" // 岗检JAVA接口
54
                 "http://10.152.72.7:8180" // 岗检JAVA接口
55
                 // "*.cnooc.*"
55
                 // "*.cnooc.*"
56
                 // TODO 打包屏蔽-甲方部署时注释:甲方不需要本地登录功能采用单点登录
56
                 // TODO 打包屏蔽-甲方部署时注释:甲方不需要本地登录功能采用单点登录
57
-                , "http://192.168.3.187:8181"  // 前端开发-王宇
58
-                , "http://192.168.3.32:81"  // 前端开发-李帅
59
-                , "http://192.168.3.200:8181"  // 前端开发
57
+//                , "http://192.168.3.187:8181"  // 前端开发-王宇
58
+//                , "http://192.168.3.32:81"  // 前端开发-李帅
59
+//                , "http://192.168.3.200:8181"  // 前端开发
60
         };
60
         };
61
         Set<String> allowedOrigins = new HashSet<>(Arrays.asList(allowDomain));
61
         Set<String> allowedOrigins = new HashSet<>(Arrays.asList(allowDomain));
62
         String originHeader = request.getHeader("Origin");
62
         String originHeader = request.getHeader("Origin");
@@ -65,9 +65,9 @@ public class RestCorsFilter implements Filter {
65
         //前端的头Origin为空时设置为前端Nginx的地址
65
         //前端的头Origin为空时设置为前端Nginx的地址
66
         //前端跳转方式:src/views/postcheck.vue -> window.location.href = `${this.getBaseUrl()}/redirectpostcheck`;
66
         //前端跳转方式:src/views/postcheck.vue -> window.location.href = `${this.getBaseUrl()}/redirectpostcheck`;
67
         if (StringUtils.isBlank(originHeader)) {
67
         if (StringUtils.isBlank(originHeader)) {
68
-//            originHeader = "http://10.152.72.7:8181";//岗检前端Nginx
68
+            originHeader = "http://10.152.72.7:8181";//岗检前端Nginx
69
 //            originHeader = "http://10.152.72.7:8180";//岗检JAVA接口
69
 //            originHeader = "http://10.152.72.7:8180";//岗检JAVA接口
70
-            originHeader = "http://192.168.3.32:81";//李帅
70
+//            originHeader = "http://192.168.3.32:81";//李帅
71
 //            originHeader = "http://192.168.3.187:8181";//王宇
71
 //            originHeader = "http://192.168.3.187:8181";//王宇
72
             log.info("【跨域过滤器】拿到请求中的request.getHeader(\"Origin\") 等于空,服务器设置默认值后 = {}", originHeader);
72
             log.info("【跨域过滤器】拿到请求中的request.getHeader(\"Origin\") 等于空,服务器设置默认值后 = {}", originHeader);
73
         }
73
         }

+ 2 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/cas/CasConfigure.java

@@ -9,8 +9,8 @@ import net.unicon.cas.client.configuration.EnableCasClient;
9
 /**
9
 /**
10
  * TODO 甲方部署时打开:CAS统一认证拦截器
10
  * TODO 甲方部署时打开:CAS统一认证拦截器
11
  */
11
  */
12
-//@EnableCasClient
13
-//@Configuration
12
+@EnableCasClient
13
+@Configuration
14
 public class CasConfigure extends CasClientConfigurerAdapter {
14
 public class CasConfigure extends CasClientConfigurerAdapter {
15
     @Override
15
     @Override
16
     public void configureAuthenticationFilter(FilterRegistrationBean authenticationFilter) {
16
     public void configureAuthenticationFilter(FilterRegistrationBean authenticationFilter) {