Browse Source

测试的请求拦截

weiximei 6 years ago
parent
commit
c6a93546b9

+ 4
- 0
SmartCommunity/SmartCommunityV1/zuul/src/main/java/com/example/demo/controller/SecurityController.java View File

@@ -0,0 +1,4 @@
1
+package com.example.demo.controller;
2
+
3
+public class SecurityController {
4
+}

+ 42
- 0
SmartCommunity/SmartCommunityV1/zuul/src/main/java/com/example/demo/response/SecurityResponse.java View File

@@ -0,0 +1,42 @@
1
+package com.example.demo.response;
2
+
3
+/**
4
+ * spring security 专用的响应
5
+ * @author weiximei
6
+ */
7
+public class SecurityResponse {
8
+    /** 状态码 **/
9
+    private int code = 200;
10
+
11
+    /** 消息体 **/
12
+    private String data;
13
+
14
+    public String getData() {
15
+        return data;
16
+    }
17
+
18
+    public void setData(String data) {
19
+        this.data = data;
20
+    }
21
+
22
+    public int getCode() {
23
+        return code;
24
+    }
25
+
26
+    public void setCode(int code) {
27
+        this.code = code;
28
+    }
29
+
30
+
31
+    public SecurityResponse(int code, String data) {
32
+        this.code = code;
33
+        this.data = data;
34
+    }
35
+
36
+    public SecurityResponse(String data) {
37
+        this.data = data;
38
+    }
39
+
40
+    public SecurityResponse() {
41
+    }
42
+}

+ 4
- 0
SmartCommunity/SmartCommunityV1/zuul/src/main/java/com/example/demo/response/SupperResponse.java View File

@@ -0,0 +1,4 @@
1
+package com.example.demo.response;
2
+
3
+public class SupperResponse {
4
+}

+ 27
- 0
SmartCommunity/SmartCommunityV1/zuul/src/main/java/com/example/demo/security/WisdomSecurityConfig.java View File

@@ -0,0 +1,27 @@
1
+package com.example.demo.security;
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.WebSecurityConfigurerAdapter;
6
+
7
+/**
8
+ * 配置类
9
+ * @author weiximei
10
+ */
11
+@Configuration
12
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
13
+
14
+    /**
15
+     * 安全策略
16
+     * @param http
17
+     * @throws Exception
18
+     */
19
+    @Override
20
+    protected void configure(HttpSecurity http) throws Exception {
21
+
22
+        http.csrf().disable();
23
+
24
+        http.
25
+
26
+    }
27
+}

+ 0
- 0
SmartCommunity/SmartCommunityV1/zuul/src/main/resources/generatorConfig.xml View File