From 777447e1d96aa717a91dd17023adf889ef1c8042 Mon Sep 17 00:00:00 2001 From: Josh Cummings <3627351+jzheaux@users.noreply.github.com> Date: Thu, 19 Jun 2025 18:06:52 -0600 Subject: [PATCH] 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 --- .../annotation/web/builders/HttpSecurity.java | 12 ++--- .../DeferHttpSessionJavaConfigTests.java | 2 +- .../HttpSecurityConfigurationTests.java | 6 +-- .../WebSecurityConfigurationTests.java | 6 +-- .../AuthorizeHttpRequestsConfigurerTests.java | 48 +++++++++---------- .../configurers/FormLoginConfigurerTests.java | 2 +- .../HttpSecurityObservationTests.java | 2 +- ...ttpSecuritySecurityMatchersNoMvcTests.java | 2 +- .../HttpSecuritySecurityMatchersTests.java | 10 ++-- .../configurers/NamespaceRememberMeTests.java | 2 +- .../configurers/PermitAllSupportTests.java | 4 +- .../RequestCacheConfigurerTests.java | 2 +- .../ServletApiConfigurerTests.java | 2 +- .../client/OAuth2LoginConfigurerTests.java | 3 +- .../DPoPAuthenticationConfigurerTests.java | 3 +- .../ott/OneTimeTokenLoginConfigurerTests.java | 10 ++-- .../saml2/Saml2LoginConfigurerTests.java | 4 +- .../servlet/saml2/login/authentication.adoc | 8 ++-- .../showcase/login/AuthenticationTests.java | 2 +- 19 files changed, 62 insertions(+), 68 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 4a4c3cc42e..1c89141824 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 @@ -125,8 +125,7 @@ import org.springframework.web.servlet.handler.HandlerMappingIntrospector; * @Bean * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { * http - * .authorizeHttpRequests((authorizeHttpRequests) -> - * authorizeHttpRequests + * .authorizeHttpRequests((authorize) -> authorize * .requestMatchers("/**").hasRole("USER") * ) * .formLogin(withDefaults()); @@ -785,8 +784,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().permitAll() ) .sessionManagement((sessions) -> sessions diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java index 4809552722..5f45eeefe5 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java @@ -524,7 +524,7 @@ public class HttpSecurityConfigurationTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .authorizeRequests((requests) -> requests @@ -547,7 +547,7 @@ public class HttpSecurityConfigurationTests { .authorizeRequests((requests) -> requests .anyRequest().authenticated() ) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .build(); @@ -634,7 +634,7 @@ public class HttpSecurityConfigurationTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ); // @formatter:on diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java index afabd761ba..311bae361d 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java @@ -912,7 +912,7 @@ public class WebSecurityConfigurationTests { // @formatter:off http .securityMatchers((requests) -> requests.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher("/user"))) - .authorizeHttpRequests((requests) -> requests.anyRequest().hasRole("USER")); + .authorizeHttpRequests((authorize) -> authorize.anyRequest().hasRole("USER")); // @formatter:on return http.build(); } @@ -923,7 +923,7 @@ public class WebSecurityConfigurationTests { // @formatter:off http .securityMatchers((requests) -> requests.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher("/admin"))) - .authorizeHttpRequests((requests) -> requests.anyRequest().hasRole("ADMIN")); + .authorizeHttpRequests((authorize) -> authorize.anyRequest().hasRole("ADMIN")); // @formatter:on return http.build(); } @@ -931,7 +931,7 @@ public class WebSecurityConfigurationTests { @Bean @Order(Ordered.LOWEST_PRECEDENCE) public SecurityFilterChain permitAll(HttpSecurity http) throws Exception { - http.authorizeHttpRequests((requests) -> requests.anyRequest().permitAll()); + http.authorizeHttpRequests((authorize) -> authorize.anyRequest().permitAll()); return http.build(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java index ea79dda610..b2bd973bee 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java @@ -793,7 +793,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest()); // @formatter:on @@ -810,7 +810,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() .requestMatchers("/path").hasRole("USER") ) @@ -830,7 +830,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().access(authorizationManager) ) .build(); @@ -849,7 +849,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().access(authorizationManager)); // @formatter:on @@ -868,7 +868,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .build(); @@ -900,7 +900,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off return http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().hasAnyAuthority("ROLE_USER") ) .build(); @@ -918,7 +918,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off return http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().hasAuthority("ROLE_USER") ) .build(); @@ -936,7 +936,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off return http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().hasAnyAuthority("ROLE_USER", "ROLE_ADMIN") ) .build(); @@ -953,7 +953,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().hasRole("USER") ) .build(); @@ -970,7 +970,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().hasRole("USER") ) .build(); @@ -994,7 +994,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().hasAnyRole("USER", "ADMIN") ) .build(); @@ -1012,7 +1012,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off return http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().denyAll() ) .build(); @@ -1029,7 +1029,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().permitAll() ) .build(); @@ -1047,7 +1047,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off return http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .authorizeHttpRequests(withDefaults()) @@ -1068,7 +1068,7 @@ public class AuthorizeHttpRequestsConfigurerTests { .servletPath("/spring"); // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .requestMatchers(mvcMatcherBuilder.pattern("/")).hasRole("ADMIN") ) .build(); @@ -1086,7 +1086,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off return http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .build(); @@ -1109,7 +1109,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().access(new WebExpressionAuthorizationManager("hasRole('USER')")) ) .build(); @@ -1126,7 +1126,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().access(new WebExpressionAuthorizationManager("hasRole('USER') or hasRole('ADMIN')")) ) .build(); @@ -1143,7 +1143,7 @@ public class AuthorizeHttpRequestsConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off return http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().access(new WebExpressionAuthorizationManager("hasIpAddress('127.0.0.1')")) ) .build(); @@ -1162,7 +1162,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .requestMatchers("/user/{username}").access(new WebExpressionAuthorizationManager("#username == 'user'")) .requestMatchers("/v2/user/{username}").hasVariable("username").equalTo(Authentication::getName) ); @@ -1197,7 +1197,7 @@ public class AuthorizeHttpRequestsConfigurerTests { http .httpBasic(withDefaults()) .rememberMe(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().fullyAuthenticated() ); // @formatter:on @@ -1221,7 +1221,7 @@ public class AuthorizeHttpRequestsConfigurerTests { http .httpBasic(withDefaults()) .rememberMe(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().rememberMe() ); // @formatter:on @@ -1244,7 +1244,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().anonymous() ); // @formatter:on @@ -1262,7 +1262,7 @@ public class AuthorizeHttpRequestsConfigurerTests { // @formatter:off http .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().not().authenticated() ); // @formatter:on diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java index 2adfb030b0..1c13a37377 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java @@ -724,7 +724,7 @@ public class FormLoginConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .formLogin(withDefaults()) diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityObservationTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityObservationTests.java index 2bb4e9684d..562b206718 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityObservationTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityObservationTests.java @@ -87,7 +87,7 @@ public class HttpSecurityObservationTests { @Bean 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(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersNoMvcTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersNoMvcTests.java index 7dca1b7b5e..c6afdf3572 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersNoMvcTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersNoMvcTests.java @@ -123,7 +123,7 @@ public class HttpSecuritySecurityMatchersNoMvcTests { http .securityMatcher("/path") .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().denyAll()); // @formatter:on return http.build(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersTests.java index b476c45c38..9de85b6957 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersTests.java @@ -226,7 +226,7 @@ public class HttpSecuritySecurityMatchersTests { .requestMatchers("/test-1") .requestMatchers("/test-2") .requestMatchers("/test-3")) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().denyAll()) .httpBasic(withDefaults()); // @formatter:on @@ -239,7 +239,7 @@ public class HttpSecuritySecurityMatchersTests { http .securityMatchers((security) -> security .requestMatchers("/test-1")) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().permitAll()); // @formatter:on return http.build(); @@ -269,7 +269,7 @@ public class HttpSecuritySecurityMatchersTests { http .securityMatcher("/path") .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().denyAll()); // @formatter:on return http.build(); @@ -299,7 +299,7 @@ public class HttpSecuritySecurityMatchersTests { http .securityMatcher("/path") .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().denyAll()); // @formatter:on return http.build(); @@ -366,7 +366,7 @@ public class HttpSecuritySecurityMatchersTests { .requestMatchers(mvcMatcherBuilder.pattern("/never-match")) ) .httpBasic(withDefaults()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().denyAll()); // @formatter:on return http.build(); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java index a9434bef89..0d02e44132 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java @@ -350,7 +350,7 @@ public class NamespaceRememberMeTests { // @formatter:off http .securityMatcher(new AntPathRequestMatcher("/without-key/**")) - .authorizeHttpRequests((requests) -> requests.anyRequest().authenticated()) + .authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated()) .formLogin((login) -> login .loginProcessingUrl("/without-key/login")) .rememberMe(withDefaults()); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java index 1ff5905ca1..beffdbf486 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java @@ -119,7 +119,7 @@ public class PermitAllSupportTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated()) .formLogin((login) -> login .loginPage("/xyz").permitAll() @@ -140,7 +140,7 @@ public class PermitAllSupportTests { http .authorizeRequests((requests) -> requests .anyRequest().authenticated()) - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated()) .formLogin((login) -> login .loginPage("/xyz").permitAll() diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java index 3c30f762a4..bd1fcdfd20 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java @@ -393,7 +393,7 @@ public class RequestCacheConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .formLogin(Customizer.withDefaults()) diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java index f1df48be8c..e8465e2a5c 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java @@ -253,7 +253,7 @@ public class ServletApiConfigurerTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .httpBasic(Customizer.withDefaults()) diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java index 980c7c5995..6cfbccb1ea 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java @@ -1340,8 +1340,7 @@ public class OAuth2LoginConfigurerTests { SecurityFilterChain configureFilterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((authorizeRequests) -> - authorizeRequests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .securityContext((securityContext) -> diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/DPoPAuthenticationConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/DPoPAuthenticationConfigurerTests.java index 6ffab052e9..5dbdfa89de 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/DPoPAuthenticationConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/DPoPAuthenticationConfigurerTests.java @@ -240,8 +240,7 @@ public class DPoPAuthenticationConfigurerTests { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((authorize) -> - authorize + .authorizeHttpRequests((authorize) -> authorize .requestMatchers("/resource1").hasAnyAuthority("SCOPE_resource1.read", "SCOPE_resource1.write") .requestMatchers("/resource2").hasAnyAuthority("SCOPE_resource2.read", "SCOPE_resource2.write") .anyRequest().authenticated() diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ott/OneTimeTokenLoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ott/OneTimeTokenLoginConfigurerTests.java index 0b965cfc2f..a93409ebdb 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ott/OneTimeTokenLoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/ott/OneTimeTokenLoginConfigurerTests.java @@ -242,7 +242,7 @@ public class OneTimeTokenLoginConfigurerTests { // @formatter:off http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .oneTimeTokenLogin((ott) -> ott @@ -281,7 +281,7 @@ public class OneTimeTokenLoginConfigurerTests { OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception { // @formatter:off http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .oneTimeTokenLogin((ott) -> ott @@ -308,7 +308,7 @@ public class OneTimeTokenLoginConfigurerTests { OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception { // @formatter:off http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .oneTimeTokenLogin((ott) -> ott @@ -336,7 +336,7 @@ public class OneTimeTokenLoginConfigurerTests { OneTimeTokenGenerationSuccessHandler ottSuccessHandler) throws Exception { // @formatter:off http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .oneTimeTokenLogin((ott) -> ott @@ -365,7 +365,7 @@ public class OneTimeTokenLoginConfigurerTests { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .oneTimeTokenLogin(Customizer.withDefaults()); diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java index 8db919dd72..f43ae69d86 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java @@ -630,7 +630,7 @@ public class Saml2LoginConfigurerTests { @Bean SecurityFilterChain app(HttpSecurity http) throws Exception { - http.authorizeHttpRequests((authz) -> authz.anyRequest().authenticated()) + http.authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated()) .saml2Login(Customizer.withDefaults()); return http.build(); } @@ -715,7 +715,7 @@ public class Saml2LoginConfigurerTests { SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((authz) -> authz.anyRequest().authenticated()) + .authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated()) .saml2Login((saml2) -> saml2.authenticationRequestUriQuery("/custom/auth/sso?entityId={registrationId}")); // @formatter:on return http.build(); diff --git a/docs/modules/ROOT/pages/servlet/saml2/login/authentication.adoc b/docs/modules/ROOT/pages/servlet/saml2/login/authentication.adoc index cf794fe100..bd9e738ad1 100644 --- a/docs/modules/ROOT/pages/servlet/saml2/login/authentication.adoc +++ b/docs/modules/ROOT/pages/servlet/saml2/login/authentication.adoc @@ -148,7 +148,7 @@ public class SecurityConfig { ); http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .saml2Login((saml2) -> saml2 @@ -211,7 +211,7 @@ public class SecurityConfig { .clockSkew(Duration.ofMinutes(10)).build(); authenticationProvider.setAssertionValidator(assertionValidator); http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .saml2Login((saml2) -> saml2 @@ -274,7 +274,7 @@ public class SecurityConfig { authenticationProvider.setResponseAuthenticationConverter(this.authenticationConverter); http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated()) .saml2Login((saml2) -> saml2 .authenticationManager(new ProviderManager(authenticationProvider)) @@ -409,7 +409,7 @@ public class SecurityConfig { }); http - .authorizeHttpRequests((authz) -> authz + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .saml2Login((saml2) -> saml2 diff --git a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java index dfbff109e5..58e297b469 100644 --- a/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java +++ b/test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java @@ -104,7 +104,7 @@ public class AuthenticationTests { DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeHttpRequests((requests) -> requests + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated() ) .sessionManagement((sessions) -> sessions