From 15f525c614ec792ad730a1d883507ff3c995a4d5 Mon Sep 17 00:00:00 2001 From: Steve Riesenberg Date: Fri, 29 Jul 2022 14:18:19 -0500 Subject: [PATCH] Polish HttpSecurity --- .../annotation/web/builders/HttpSecurity.java | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java b/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java index 03a6182155d..68adef55fe6 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java @@ -186,23 +186,23 @@ private ApplicationContext getContext() { * @EnableWebSecurity * public class CsrfSecurityConfig { * - * @Bean - * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - * http - * .headers() - * .contentTypeOptions() - * .and() - * .xssProtection() - * .and() - * .cacheControl() - * .and() - * .httpStrictTransportSecurity() - * .and() - * .frameOptions() - * .and() - * ...; - * return http.build(); - * } + * @Bean + * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + * http + * .headers() + * .contentTypeOptions() + * .and() + * .xssProtection() + * .and() + * .cacheControl() + * .and() + * .httpStrictTransportSecurity() + * .and() + * .frameOptions() + * .and() + * ...; + * return http.build(); + * } * } * * @@ -213,13 +213,13 @@ private ApplicationContext getContext() { * @EnableWebSecurity * public class CsrfSecurityConfig { * - * @Bean - * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - * http - * .headers().disable() - * ...; - * return http.build(); - * } + * @Bean + * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + * http + * .headers().disable() + * ...; + * return http.build(); + * } * } * * @@ -234,18 +234,18 @@ private ApplicationContext getContext() { * @EnableWebSecurity * public class CsrfSecurityConfig { * - * @Bean - * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - * http - * .headers() - * .defaultsDisabled() - * .cacheControl() - * .and() - * .frameOptions() - * .and() - * ...; - * return http.build(); - * } + * @Bean + * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + * http + * .headers() + * .defaultsDisabled() + * .cacheControl() + * .and() + * .frameOptions() + * .and() + * ...; + * return http.build(); + * } * } * * @@ -258,16 +258,16 @@ private ApplicationContext getContext() { * @EnableWebSecurity * public class CsrfSecurityConfig { * - * @Bean - * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - * http - * .headers() - * .frameOptions() - * .disable() - * .and() - * ...; - * return http.build(); - * } + * @Bean + * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + * http + * .headers() + * .frameOptions() + * .disable() + * .and() + * ...; + * return http.build(); + * } * } * * @return the {@link HeadersConfigurer} for further customizations @@ -403,12 +403,12 @@ public CorsConfigurer cors() throws Exception { * @EnableWebSecurity * public class CorsSecurityConfig { * - * @Bean - * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - * http - * .cors(withDefaults()); - * return http.build(); - * } + * @Bean + * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + * http + * .cors(withDefaults()); + * return http.build(); + * } * } * * @param corsCustomizer the {@link Customizer} to provide more options for the @@ -1614,13 +1614,13 @@ public HttpSecurity servletApi(Customizer> se * @EnableWebSecurity * public class CsrfSecurityConfig { * - * @Bean - * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - * http - * .csrf().disable() - * ...; - * return http.build(); - * } + * @Bean + * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + * http + * .csrf().disable() + * ...; + * return http.build(); + * } * } * * @return the {@link CsrfConfigurer} for further customizations @@ -1640,12 +1640,12 @@ public CsrfConfigurer csrf() throws Exception { * @EnableWebSecurity * public class CsrfSecurityConfig { * - * @Bean - * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - * http - * .csrf((csrf) -> csrf.disable()); - * return http.build(); - * } + * @Bean + * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + * http + * .csrf((csrf) -> csrf.disable()); + * return http.build(); + * } * } * * @param csrfCustomizer the {@link Customizer} to provide more options for the