|
@@ -30,8 +30,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .frameOptions(frameOptions -> frameOptions
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .frameOptions((frameOptions) -> frameOptions
|
|
|
.sameOrigin()
|
|
|
)
|
|
|
);
|
|
@@ -96,7 +96,7 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
+ .headers((headers) -> headers
|
|
|
// do not use any default headers unless explicitly listed
|
|
|
.defaultsDisabled()
|
|
|
.cacheControl(withDefaults())
|
|
@@ -160,7 +160,7 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers.disable());
|
|
|
+ .headers((headers) -> headers.disable());
|
|
|
return http.build();
|
|
|
}
|
|
|
}
|
|
@@ -226,8 +226,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .cacheControl(cache -> cache.disable())
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .cacheControl((cache) -> cache.disable())
|
|
|
);
|
|
|
return http.build();
|
|
|
}
|
|
@@ -291,8 +291,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .contentTypeOptions(contentTypeOptions -> contentTypeOptions.disable())
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .contentTypeOptions((contentTypeOptions) -> contentTypeOptions.disable())
|
|
|
);
|
|
|
return http.build();
|
|
|
}
|
|
@@ -357,8 +357,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .httpStrictTransportSecurity(hsts -> hsts
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .httpStrictTransportSecurity((hsts) -> hsts
|
|
|
.includeSubDomains(true)
|
|
|
.preload(true)
|
|
|
.maxAgeInSeconds(31536000)
|
|
@@ -431,8 +431,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .httpPublicKeyPinning(hpkp -> hpkp
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .httpPublicKeyPinning((hpkp) -> hpkp
|
|
|
.includeSubDomains(true)
|
|
|
.reportUri("https://example.net/pkp-report")
|
|
|
.addSha256Pins("d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=", "E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=")
|
|
@@ -511,8 +511,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .frameOptions(frameOptions -> frameOptions
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .frameOptions((frameOptions) -> frameOptions
|
|
|
.sameOrigin()
|
|
|
)
|
|
|
);
|
|
@@ -582,8 +582,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .xssProtection(xss -> xss
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .xssProtection((xss) -> xss
|
|
|
.headerValue(XXssProtectionHeaderWriter.HeaderValue.ENABLED_MODE_BLOCK)
|
|
|
)
|
|
|
);
|
|
@@ -660,8 +660,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .contentSecurityPolicy(csp -> csp
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .contentSecurityPolicy((csp) -> csp
|
|
|
.policyDirectives("script-src 'self' https://trustedscripts.example.com; object-src https://trustedplugins.example.com; report-uri /csp-report-endpoint/")
|
|
|
)
|
|
|
);
|
|
@@ -725,8 +725,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .contentSecurityPolicy(csp -> csp
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .contentSecurityPolicy((csp) -> csp
|
|
|
.policyDirectives("script-src 'self' https://trustedscripts.example.com; object-src https://trustedplugins.example.com; report-uri /csp-report-endpoint/")
|
|
|
.reportOnly()
|
|
|
)
|
|
@@ -797,8 +797,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .referrerPolicy(referrer -> referrer
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .referrerPolicy((referrer) -> referrer
|
|
|
.policy(ReferrerPolicy.SAME_ORIGIN)
|
|
|
)
|
|
|
);
|
|
@@ -873,7 +873,7 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
+ .headers((headers) -> headers
|
|
|
.featurePolicy("geolocation 'self'")
|
|
|
);
|
|
|
return http.build();
|
|
@@ -945,8 +945,8 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .permissionsPolicy(permissions -> permissions
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .permissionsPolicy((permissions) -> permissions
|
|
|
.policy("geolocation=(self)")
|
|
|
)
|
|
|
);
|
|
@@ -1082,7 +1082,7 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
+ .headers((headers) -> headers
|
|
|
.addHeaderWriter(new StaticHeadersWriter("X-Custom-Security-Header","header-value"))
|
|
|
);
|
|
|
return http.build();
|
|
@@ -1147,7 +1147,7 @@ public class WebSecurityConfig {
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
+ .headers((headers) -> headers
|
|
|
.addHeaderWriter(new XFrameOptionsHeaderWriter(XFrameOptionsMode.SAMEORIGIN))
|
|
|
);
|
|
|
return http.build();
|
|
@@ -1223,8 +1223,8 @@ public class WebSecurityConfig {
|
|
|
new DelegatingRequestMatcherHeaderWriter(matcher,new XFrameOptionsHeaderWriter());
|
|
|
http
|
|
|
// ...
|
|
|
- .headers(headers -> headers
|
|
|
- .frameOptions(frameOptions -> frameOptions.disable())
|
|
|
+ .headers((headers) -> headers
|
|
|
+ .frameOptions((frameOptions) -> frameOptions.disable())
|
|
|
.addHeaderWriter(headerWriter)
|
|
|
);
|
|
|
return http.build();
|