|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+package com.unissoft;
|
|
|
2
|
+
|
|
|
3
|
+import org.springframework.context.annotation.Configuration;
|
|
|
4
|
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
5
|
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
|
6
|
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
|
7
|
+
|
|
|
8
|
+/**
|
|
|
9
|
+ * 文件描述
|
|
|
10
|
+ *
|
|
|
11
|
+ * @author tongxi.xia
|
|
|
12
|
+ * @date 2020年12月30日 16:07
|
|
|
13
|
+ */
|
|
|
14
|
+@Configuration
|
|
|
15
|
+@EnableWebSecurity
|
|
|
16
|
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
17
|
+
|
|
|
18
|
+ /**
|
|
|
19
|
+ * eureka开启验证后无法连接注册中心?
|
|
|
20
|
+ * spring Cloud 2.0 以上)的security默认启用了csrf检验,要在eurekaServer端配置security的csrf检验为false
|
|
|
21
|
+ */
|
|
|
22
|
+ @Override
|
|
|
23
|
+ protected void configure(HttpSecurity http) throws Exception {
|
|
|
24
|
+ http.csrf().disable();
|
|
|
25
|
+ super.configure(http);
|
|
|
26
|
+ }
|
|
|
27
|
+}
|