Solon v3.1.1

solon-security-web

</> markdown
<dependency>
    <groupId>org.noear</groupId>
    <artifactId>solon-security-web</artifactId>
</dependency>

1、描述

(v3.1.1 后支持)安全扩展插件,为 solon 提供 web 请求方面的安全过滤支持

请求头安全处理:

处理描述
CacheControlHeadersHandlerCache-Control 头处理器
HstsHeaderHandlerStrict-Transport-Security 头处理器
XContentTypeOptionsHeaderHandlerX-Content-Type-Options 头处理器
XFrameOptionsHeaderHandlerX-Frame-Options 头处理器
XXssProtectionHeaderHandlerX-XSS-Protection 头处理器

2、使用示例

SecurityFilter 是个 web 过滤器,可以组织多种 Handler 处理。

@Configuration
public class DemoFilter {
    @Bean(index = -99)
    public SecurityFilter securityFilter() {
        return new SecurityFilter(
                new XContentTypeOptionsHeaderHandler(), //可选头处理
                new XXssProtectionHeaderHandler()
        );
    }
}