Format authorizeHttpRequests Blocks

This commit formats authorizeHttpRequests blocks
to use the same parameter name and places the
reference on the same line as the parameter.

Issue gh-13067
This commit is contained in:
Josh Cummings 2025-06-19 18:06:52 -06:00
parent cf6b52d6f7
commit 777447e1d9
No known key found for this signature in database
GPG Key ID: 869B37A20E876129
19 changed files with 62 additions and 68 deletions

View File

@ -125,8 +125,7 @@ import org.springframework.web.servlet.handler.HandlerMappingIntrospector;
* @Bean * @Bean
* public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
* http * http
* .authorizeHttpRequests((authorizeHttpRequests) -> * .authorizeHttpRequests((authorize) -> authorize
* authorizeHttpRequests
* .requestMatchers("/**").hasRole("USER") * .requestMatchers("/**").hasRole("USER")
* ) * )
* .formLogin(withDefaults()); * .formLogin(withDefaults());
@ -785,8 +784,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* &#064;Bean * &#064;Bean
* public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
* http * http
* .authorizeHttpRequests((authorizeHttpRequests) -&gt; * .authorizeHttpRequests((authorize) -&gt; authorize
* authorizeHttpRequests
* .requestMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;) * .requestMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;)
* ) * )
* .formLogin(withDefaults()); * .formLogin(withDefaults());
@ -822,8 +820,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* &#064;Bean * &#064;Bean
* public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
* http * http
* .authorizeHttpRequests((authorizeHttpRequests) -&gt; * .authorizeHttpRequests((authorize) -&gt; authorize
* authorizeHttpRequests
* .requestMatchers(&quot;/admin/**&quot;).hasRole(&quot;ADMIN&quot;) * .requestMatchers(&quot;/admin/**&quot;).hasRole(&quot;ADMIN&quot;)
* .requestMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;) * .requestMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;)
* ) * )
@ -860,8 +857,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
* &#064;Bean * &#064;Bean
* public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
* http * http
* .authorizeHttpRequests((authorizeHttpRequests) -&gt; * .authorizeHttpRequests((authorize) -&gt; authorize
* authorizeHttpRequests
* .requestMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;) * .requestMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;)
* .requestMatchers(&quot;/admin/**&quot;).hasRole(&quot;ADMIN&quot;) * .requestMatchers(&quot;/admin/**&quot;).hasRole(&quot;ADMIN&quot;)
* ); * );

View File

@ -78,7 +78,7 @@ public class DeferHttpSessionJavaConfigTests {
DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception { DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().permitAll() .anyRequest().permitAll()
) )
.sessionManagement((sessions) -> sessions .sessionManagement((sessions) -> sessions

View File

@ -524,7 +524,7 @@ public class HttpSecurityConfigurationTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.authorizeRequests((requests) -> requests .authorizeRequests((requests) -> requests
@ -547,7 +547,7 @@ public class HttpSecurityConfigurationTests {
.authorizeRequests((requests) -> requests .authorizeRequests((requests) -> requests
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.build(); .build();
@ -634,7 +634,7 @@ public class HttpSecurityConfigurationTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
); );
// @formatter:on // @formatter:on

View File

@ -912,7 +912,7 @@ public class WebSecurityConfigurationTests {
// @formatter:off // @formatter:off
http http
.securityMatchers((requests) -> requests.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher("/user"))) .securityMatchers((requests) -> requests.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher("/user")))
.authorizeHttpRequests((requests) -> requests.anyRequest().hasRole("USER")); .authorizeHttpRequests((authorize) -> authorize.anyRequest().hasRole("USER"));
// @formatter:on // @formatter:on
return http.build(); return http.build();
} }
@ -923,7 +923,7 @@ public class WebSecurityConfigurationTests {
// @formatter:off // @formatter:off
http http
.securityMatchers((requests) -> requests.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher("/admin"))) .securityMatchers((requests) -> requests.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher("/admin")))
.authorizeHttpRequests((requests) -> requests.anyRequest().hasRole("ADMIN")); .authorizeHttpRequests((authorize) -> authorize.anyRequest().hasRole("ADMIN"));
// @formatter:on // @formatter:on
return http.build(); return http.build();
} }
@ -931,7 +931,7 @@ public class WebSecurityConfigurationTests {
@Bean @Bean
@Order(Ordered.LOWEST_PRECEDENCE) @Order(Ordered.LOWEST_PRECEDENCE)
public SecurityFilterChain permitAll(HttpSecurity http) throws Exception { public SecurityFilterChain permitAll(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((requests) -> requests.anyRequest().permitAll()); http.authorizeHttpRequests((authorize) -> authorize.anyRequest().permitAll());
return http.build(); return http.build();
} }

View File

@ -793,7 +793,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest()); .anyRequest());
// @formatter:on // @formatter:on
@ -810,7 +810,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
.requestMatchers("/path").hasRole("USER") .requestMatchers("/path").hasRole("USER")
) )
@ -830,7 +830,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().access(authorizationManager) .anyRequest().access(authorizationManager)
) )
.build(); .build();
@ -849,7 +849,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().access(authorizationManager)); .anyRequest().access(authorizationManager));
// @formatter:on // @formatter:on
@ -868,7 +868,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.build(); .build();
@ -900,7 +900,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
return http return http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().hasAnyAuthority("ROLE_USER") .anyRequest().hasAnyAuthority("ROLE_USER")
) )
.build(); .build();
@ -918,7 +918,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
return http return http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().hasAuthority("ROLE_USER") .anyRequest().hasAuthority("ROLE_USER")
) )
.build(); .build();
@ -936,7 +936,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
return http return http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().hasAnyAuthority("ROLE_USER", "ROLE_ADMIN") .anyRequest().hasAnyAuthority("ROLE_USER", "ROLE_ADMIN")
) )
.build(); .build();
@ -953,7 +953,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().hasRole("USER") .anyRequest().hasRole("USER")
) )
.build(); .build();
@ -970,7 +970,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().hasRole("USER") .anyRequest().hasRole("USER")
) )
.build(); .build();
@ -994,7 +994,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().hasAnyRole("USER", "ADMIN") .anyRequest().hasAnyRole("USER", "ADMIN")
) )
.build(); .build();
@ -1012,7 +1012,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
return http return http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().denyAll() .anyRequest().denyAll()
) )
.build(); .build();
@ -1029,7 +1029,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().permitAll() .anyRequest().permitAll()
) )
.build(); .build();
@ -1047,7 +1047,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
return http return http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.authorizeHttpRequests(withDefaults()) .authorizeHttpRequests(withDefaults())
@ -1068,7 +1068,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
.servletPath("/spring"); .servletPath("/spring");
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.requestMatchers(mvcMatcherBuilder.pattern("/")).hasRole("ADMIN") .requestMatchers(mvcMatcherBuilder.pattern("/")).hasRole("ADMIN")
) )
.build(); .build();
@ -1086,7 +1086,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
return http return http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.build(); .build();
@ -1109,7 +1109,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().access(new WebExpressionAuthorizationManager("hasRole('USER')")) .anyRequest().access(new WebExpressionAuthorizationManager("hasRole('USER')"))
) )
.build(); .build();
@ -1126,7 +1126,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().access(new WebExpressionAuthorizationManager("hasRole('USER') or hasRole('ADMIN')")) .anyRequest().access(new WebExpressionAuthorizationManager("hasRole('USER') or hasRole('ADMIN')"))
) )
.build(); .build();
@ -1143,7 +1143,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
return http return http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().access(new WebExpressionAuthorizationManager("hasIpAddress('127.0.0.1')")) .anyRequest().access(new WebExpressionAuthorizationManager("hasIpAddress('127.0.0.1')"))
) )
.build(); .build();
@ -1162,7 +1162,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
http http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.requestMatchers("/user/{username}").access(new WebExpressionAuthorizationManager("#username == 'user'")) .requestMatchers("/user/{username}").access(new WebExpressionAuthorizationManager("#username == 'user'"))
.requestMatchers("/v2/user/{username}").hasVariable("username").equalTo(Authentication::getName) .requestMatchers("/v2/user/{username}").hasVariable("username").equalTo(Authentication::getName)
); );
@ -1197,7 +1197,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
http http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.rememberMe(withDefaults()) .rememberMe(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().fullyAuthenticated() .anyRequest().fullyAuthenticated()
); );
// @formatter:on // @formatter:on
@ -1221,7 +1221,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
http http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.rememberMe(withDefaults()) .rememberMe(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().rememberMe() .anyRequest().rememberMe()
); );
// @formatter:on // @formatter:on
@ -1244,7 +1244,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
http http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().anonymous() .anyRequest().anonymous()
); );
// @formatter:on // @formatter:on
@ -1262,7 +1262,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off // @formatter:off
http http
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().not().authenticated() .anyRequest().not().authenticated()
); );
// @formatter:on // @formatter:on

View File

@ -724,7 +724,7 @@ public class FormLoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.formLogin(withDefaults()) .formLogin(withDefaults())

View File

@ -87,7 +87,7 @@ public class HttpSecurityObservationTests {
@Bean @Bean
SecurityFilterChain app(HttpSecurity http) throws Exception { SecurityFilterChain app(HttpSecurity http) throws Exception {
http.httpBasic(withDefaults()).authorizeHttpRequests((requests) -> requests.anyRequest().authenticated()); http.httpBasic(withDefaults()).authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated());
return http.build(); return http.build();
} }

View File

@ -123,7 +123,7 @@ public class HttpSecuritySecurityMatchersNoMvcTests {
http http
.securityMatcher("/path") .securityMatcher("/path")
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().denyAll()); .anyRequest().denyAll());
// @formatter:on // @formatter:on
return http.build(); return http.build();

View File

@ -226,7 +226,7 @@ public class HttpSecuritySecurityMatchersTests {
.requestMatchers("/test-1") .requestMatchers("/test-1")
.requestMatchers("/test-2") .requestMatchers("/test-2")
.requestMatchers("/test-3")) .requestMatchers("/test-3"))
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().denyAll()) .anyRequest().denyAll())
.httpBasic(withDefaults()); .httpBasic(withDefaults());
// @formatter:on // @formatter:on
@ -239,7 +239,7 @@ public class HttpSecuritySecurityMatchersTests {
http http
.securityMatchers((security) -> security .securityMatchers((security) -> security
.requestMatchers("/test-1")) .requestMatchers("/test-1"))
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().permitAll()); .anyRequest().permitAll());
// @formatter:on // @formatter:on
return http.build(); return http.build();
@ -269,7 +269,7 @@ public class HttpSecuritySecurityMatchersTests {
http http
.securityMatcher("/path") .securityMatcher("/path")
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().denyAll()); .anyRequest().denyAll());
// @formatter:on // @formatter:on
return http.build(); return http.build();
@ -299,7 +299,7 @@ public class HttpSecuritySecurityMatchersTests {
http http
.securityMatcher("/path") .securityMatcher("/path")
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().denyAll()); .anyRequest().denyAll());
// @formatter:on // @formatter:on
return http.build(); return http.build();
@ -366,7 +366,7 @@ public class HttpSecuritySecurityMatchersTests {
.requestMatchers(mvcMatcherBuilder.pattern("/never-match")) .requestMatchers(mvcMatcherBuilder.pattern("/never-match"))
) )
.httpBasic(withDefaults()) .httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().denyAll()); .anyRequest().denyAll());
// @formatter:on // @formatter:on
return http.build(); return http.build();

View File

@ -350,7 +350,7 @@ public class NamespaceRememberMeTests {
// @formatter:off // @formatter:off
http http
.securityMatcher(new AntPathRequestMatcher("/without-key/**")) .securityMatcher(new AntPathRequestMatcher("/without-key/**"))
.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated()) .authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
.formLogin((login) -> login .formLogin((login) -> login
.loginProcessingUrl("/without-key/login")) .loginProcessingUrl("/without-key/login"))
.rememberMe(withDefaults()); .rememberMe(withDefaults());

View File

@ -119,7 +119,7 @@ public class PermitAllSupportTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated()) .anyRequest().authenticated())
.formLogin((login) -> login .formLogin((login) -> login
.loginPage("/xyz").permitAll() .loginPage("/xyz").permitAll()
@ -140,7 +140,7 @@ public class PermitAllSupportTests {
http http
.authorizeRequests((requests) -> requests .authorizeRequests((requests) -> requests
.anyRequest().authenticated()) .anyRequest().authenticated())
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated()) .anyRequest().authenticated())
.formLogin((login) -> login .formLogin((login) -> login
.loginPage("/xyz").permitAll() .loginPage("/xyz").permitAll()

View File

@ -393,7 +393,7 @@ public class RequestCacheConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.formLogin(Customizer.withDefaults()) .formLogin(Customizer.withDefaults())

View File

@ -253,7 +253,7 @@ public class ServletApiConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception { SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.httpBasic(Customizer.withDefaults()) .httpBasic(Customizer.withDefaults())

View File

@ -1340,8 +1340,7 @@ public class OAuth2LoginConfigurerTests {
SecurityFilterChain configureFilterChain(HttpSecurity http) throws Exception { SecurityFilterChain configureFilterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authorizeRequests) -> .authorizeHttpRequests((authorize) -> authorize
authorizeRequests
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.securityContext((securityContext) -> .securityContext((securityContext) ->

View File

@ -240,8 +240,7 @@ public class DPoPAuthenticationConfigurerTests {
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authorize) -> .authorizeHttpRequests((authorize) -> authorize
authorize
.requestMatchers("/resource1").hasAnyAuthority("SCOPE_resource1.read", "SCOPE_resource1.write") .requestMatchers("/resource1").hasAnyAuthority("SCOPE_resource1.read", "SCOPE_resource1.write")
.requestMatchers("/resource2").hasAnyAuthority("SCOPE_resource2.read", "SCOPE_resource2.write") .requestMatchers("/resource2").hasAnyAuthority("SCOPE_resource2.read", "SCOPE_resource2.write")
.anyRequest().authenticated() .anyRequest().authenticated()

View File

@ -242,7 +242,7 @@ public class OneTimeTokenLoginConfigurerTests {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.oneTimeTokenLogin((ott) -> ott .oneTimeTokenLogin((ott) -> ott
@ -281,7 +281,7 @@ public class OneTimeTokenLoginConfigurerTests {
OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception { OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.oneTimeTokenLogin((ott) -> ott .oneTimeTokenLogin((ott) -> ott
@ -308,7 +308,7 @@ public class OneTimeTokenLoginConfigurerTests {
OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception { OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.oneTimeTokenLogin((ott) -> ott .oneTimeTokenLogin((ott) -> ott
@ -336,7 +336,7 @@ public class OneTimeTokenLoginConfigurerTests {
OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception { OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.oneTimeTokenLogin((ott) -> ott .oneTimeTokenLogin((ott) -> ott
@ -365,7 +365,7 @@ public class OneTimeTokenLoginConfigurerTests {
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.oneTimeTokenLogin(Customizer.withDefaults()); .oneTimeTokenLogin(Customizer.withDefaults());

View File

@ -630,7 +630,7 @@ public class Saml2LoginConfigurerTests {
@Bean @Bean
SecurityFilterChain app(HttpSecurity http) throws Exception { SecurityFilterChain app(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((authz) -> authz.anyRequest().authenticated()) http.authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
.saml2Login(Customizer.withDefaults()); .saml2Login(Customizer.withDefaults());
return http.build(); return http.build();
} }
@ -715,7 +715,7 @@ public class Saml2LoginConfigurerTests {
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((authz) -> authz.anyRequest().authenticated()) .authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
.saml2Login((saml2) -> saml2.authenticationRequestUriQuery("/custom/auth/sso?entityId={registrationId}")); .saml2Login((saml2) -> saml2.authenticationRequestUriQuery("/custom/auth/sso?entityId={registrationId}"));
// @formatter:on // @formatter:on
return http.build(); return http.build();

View File

@ -148,7 +148,7 @@ public class SecurityConfig {
); );
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.saml2Login((saml2) -> saml2 .saml2Login((saml2) -> saml2
@ -211,7 +211,7 @@ public class SecurityConfig {
.clockSkew(Duration.ofMinutes(10)).build(); .clockSkew(Duration.ofMinutes(10)).build();
authenticationProvider.setAssertionValidator(assertionValidator); authenticationProvider.setAssertionValidator(assertionValidator);
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.saml2Login((saml2) -> saml2 .saml2Login((saml2) -> saml2
@ -274,7 +274,7 @@ public class SecurityConfig {
authenticationProvider.setResponseAuthenticationConverter(this.authenticationConverter); authenticationProvider.setResponseAuthenticationConverter(this.authenticationConverter);
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated()) .anyRequest().authenticated())
.saml2Login((saml2) -> saml2 .saml2Login((saml2) -> saml2
.authenticationManager(new ProviderManager(authenticationProvider)) .authenticationManager(new ProviderManager(authenticationProvider))
@ -409,7 +409,7 @@ public class SecurityConfig {
}); });
http http
.authorizeHttpRequests((authz) -> authz .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.saml2Login((saml2) -> saml2 .saml2Login((saml2) -> saml2

View File

@ -104,7 +104,7 @@ public class AuthenticationTests {
DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception { DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception {
// @formatter:off // @formatter:off
http http
.authorizeHttpRequests((requests) -> requests .authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated() .anyRequest().authenticated()
) )
.sessionManagement((sessions) -> sessions .sessionManagement((sessions) -> sessions