Browse Source

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
pull/17219/head
Josh Cummings 6 months ago
parent
commit
777447e1d9
No known key found for this signature in database
GPG Key ID: 869B37A20E876129
  1. 12
      config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java
  2. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/DeferHttpSessionJavaConfigTests.java
  3. 6
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java
  4. 6
      config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java
  5. 48
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java
  6. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java
  7. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityObservationTests.java
  8. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersNoMvcTests.java
  9. 10
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersTests.java
  10. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java
  11. 4
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java
  12. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java
  13. 2
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java
  14. 3
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java
  15. 3
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/DPoPAuthenticationConfigurerTests.java
  16. 10
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/ott/OneTimeTokenLoginConfigurerTests.java
  17. 4
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java
  18. 8
      docs/modules/ROOT/pages/servlet/saml2/login/authentication.adoc
  19. 2
      test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java

12
config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java

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

2
config/src/test/java/org/springframework/security/config/annotation/web/configuration/DeferHttpSessionJavaConfigTests.java

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

6
config/src/test/java/org/springframework/security/config/annotation/web/configuration/HttpSecurityConfigurationTests.java

@ -524,7 +524,7 @@ public class HttpSecurityConfigurationTests { @@ -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 { @@ -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 { @@ -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

6
config/src/test/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurationTests.java

@ -912,7 +912,7 @@ public class WebSecurityConfigurationTests { @@ -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 { @@ -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 { @@ -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();
}

48
config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java

@ -793,7 +793,7 @@ public class AuthorizeHttpRequestsConfigurerTests { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -1262,7 +1262,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
// @formatter:off
http
.httpBasic(withDefaults())
.authorizeHttpRequests((requests) -> requests
.authorizeHttpRequests((authorize) -> authorize
.anyRequest().not().authenticated()
);
// @formatter:on

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.java

@ -724,7 +724,7 @@ public class FormLoginConfigurerTests { @@ -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())

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityObservationTests.java

@ -87,7 +87,7 @@ public class HttpSecurityObservationTests { @@ -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();
}

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersNoMvcTests.java

@ -123,7 +123,7 @@ public class HttpSecuritySecurityMatchersNoMvcTests { @@ -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();

10
config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecuritySecurityMatchersTests.java

@ -226,7 +226,7 @@ public class HttpSecuritySecurityMatchersTests { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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();

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.java

@ -350,7 +350,7 @@ public class NamespaceRememberMeTests { @@ -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());

4
config/src/test/java/org/springframework/security/config/annotation/web/configurers/PermitAllSupportTests.java

@ -119,7 +119,7 @@ public class PermitAllSupportTests { @@ -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 { @@ -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()

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/RequestCacheConfigurerTests.java

@ -393,7 +393,7 @@ public class RequestCacheConfigurerTests { @@ -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())

2
config/src/test/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurerTests.java

@ -253,7 +253,7 @@ public class ServletApiConfigurerTests { @@ -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())

3
config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurerTests.java

@ -1340,8 +1340,7 @@ public class OAuth2LoginConfigurerTests { @@ -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) ->

3
config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/DPoPAuthenticationConfigurerTests.java

@ -240,8 +240,7 @@ public class DPoPAuthenticationConfigurerTests { @@ -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()

10
config/src/test/java/org/springframework/security/config/annotation/web/configurers/ott/OneTimeTokenLoginConfigurerTests.java

@ -242,7 +242,7 @@ public class OneTimeTokenLoginConfigurerTests { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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());

4
config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java

@ -630,7 +630,7 @@ public class Saml2LoginConfigurerTests { @@ -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 { @@ -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();

8
docs/modules/ROOT/pages/servlet/saml2/login/authentication.adoc

@ -148,7 +148,7 @@ public class SecurityConfig { @@ -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 { @@ -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 { @@ -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 { @@ -409,7 +409,7 @@ public class SecurityConfig {
});
http
.authorizeHttpRequests((authz) -> authz
.authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.saml2Login((saml2) -> saml2

2
test/src/test/java/org/springframework/security/test/web/servlet/showcase/login/AuthenticationTests.java

@ -104,7 +104,7 @@ public class AuthenticationTests { @@ -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

Loading…
Cancel
Save