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