fanxw il y a 10 mois
Parent
commit
9bf80d5123

+ 1 - 30
src/main/java/com/unis/module/eureka/WebSecurityConfig.java

@@ -7,45 +7,16 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
7 7
 
8 8
 @Configuration
9 9
 @EnableWebSecurity
10
-public class WebSecurityConfig 
11
-extends WebSecurityConfigurerAdapter
10
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter
12 11
 {
13 12
 
14 13
 	@Override
15 14
     protected void configure(HttpSecurity http) throws Exception {
16
-		String[] urls = {
17
-                "*",
18
-                "/*",
19
-                "/*/*",
20
-                "/*/*/*",
21
-                "/*/*/*/*",
22
-                "/*/*/*/*/*/*",
23
-                "/depot-system/userInfo/login",
24
-                "/login",
25
-                "depot-system/userInfo/login",
26
-                "login"
27
-        };
28 15
 
29 16
 		http.authorizeRequests().anyRequest().permitAll() //允许所有用户访问所有资源
30 17
         .and()
31 18
         .csrf().disable(); // 禁用CSRF(防止伪造的跨域攻击)
32 19
 
33 20
         super.configure(http);
34
-//        
35
-//        http.authorizeRequests() // 对请求执行认证与授权
36
-//                .antMatchers(urls) // 匹配某些请求路径
37
-//                .permitAll() // (对此前匹配的请求路径)不需要通过认证即允许访问
38
-//                .anyRequest() // 除以上配置过的请求路径以外的所有请求路径
39
-//                .authenticated(); // 要求是已经通过认证的
40
-//        super.configure(http);
41
-		
42
-//		http.httpBasic().and().authorizeRequests().antMatchers("/actuator/**").authenticated().anyRequest().permitAll();
43
-//		http
44
-//		// 关闭csrf token认证不需要csrf防护
45
-//		.csrf().disable()
46
-//		// 关闭session会话管理器 JWT 不需要
47
-//		.sessionManagement().disable()
48
-//		// 关闭记住我功能 JWT 不需要
49
-//		.rememberMe().disable();
50 21
     }
51 22
 }

+ 6 - 1
src/main/resources/application.yml

@@ -1,6 +1,10 @@
1 1
 server:
2 2
   port: 9001
3 3
 
4
+#是否开启swaggeer? true开启,false关闭,生产环境要求关闭
5
+swagger:
6
+  enable: false
7
+
4 8
 eureka:
5 9
   instance:
6 10
     hostname: localhost
@@ -11,7 +15,6 @@ eureka:
11 15
     register-with-eureka: false
12 16
     fetch-registry: false
13 17
     service-url:
14
-      #defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
15 18
       defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:${server.port}/eureka
16 19
   server:
17 20
     # 关闭自我保护机制(不关闭会在所有服务连接异常85%后不在注销服务)
@@ -20,6 +23,8 @@ eureka:
20 23
     eviction-interval-timer-in-ms: 30000
21 24
     
22 25
 spring:
26
+  swagger:
27
+    enabled: false
23 28
   security:
24 29
     basic:
25 30
       enabled: true