|
@@ -2,6 +2,7 @@ package com.ruoyi.gateway.filter;
|
|
2
|
|
2
|
|
|
3
|
import java.nio.charset.StandardCharsets;
|
3
|
import java.nio.charset.StandardCharsets;
|
|
4
|
import org.springframework.beans.factory.annotation.Autowired;
|
4
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
5
|
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
5
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
6
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
|
6
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
7
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
|
7
|
import org.springframework.core.Ordered;
|
8
|
import org.springframework.core.Ordered;
|
|
@@ -27,6 +28,7 @@ import reactor.core.publisher.Mono;
|
|
27
|
* @author ruoyi
|
28
|
* @author ruoyi
|
|
28
|
*/
|
29
|
*/
|
|
29
|
@Component
|
30
|
@Component
|
|
|
|
31
|
+@ConditionalOnProperty(value = "security.xss.enabled", havingValue = "true")
|
|
30
|
public class XssFilter implements GlobalFilter, Ordered
|
32
|
public class XssFilter implements GlobalFilter, Ordered
|
|
31
|
{
|
33
|
{
|
|
32
|
// 跨站脚本的 xss 配置,nacos自行添加
|
34
|
// 跨站脚本的 xss 配置,nacos自行添加
|