Format authorizeRequests Blocks

This commit changes all auhorizeRequests
declarations to use the same variable name
and declare the lambda parameter and reference
on the same line.

Issue gh-13067
This commit is contained in:
Josh Cummings 2025-06-19 16:55:21 -06:00
parent 5dd40a7f10
commit cf6b52d6f7
No known key found for this signature in database
GPG Key ID: 869B37A20E876129
15 changed files with 40 additions and 78 deletions

View File

@ -147,8 +147,7 @@ public class AnonymousConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().permitAll()
)
.anonymous(AbstractHttpConfigurer::disable);
@ -171,8 +170,7 @@ public class AnonymousConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().permitAll()
)
.anonymous(withDefaults());

View File

@ -219,8 +219,7 @@ public class AuthorizeRequestsTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.requestMatchers(new AntPathRequestMatcher("/**", HttpMethod.POST.name())).denyAll()
);
// @formatter:on
@ -349,8 +348,7 @@ public class AuthorizeRequestsTests {
// @formatter:off
http
.httpBasic(withDefaults())
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.requestMatchers("/path").denyAll()
);
// @formatter:on
@ -421,8 +419,7 @@ public class AuthorizeRequestsTests {
// @formatter:off
http
.httpBasic(withDefaults())
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.requestMatchers(mvcMatcherBuilder.pattern("/path")).denyAll()
);
// @formatter:on
@ -489,8 +486,7 @@ public class AuthorizeRequestsTests {
// @formatter:off
http
.httpBasic(withDefaults())
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.requestMatchers("/user/{userName}").access("#userName == 'user'")
);
// @formatter:on

View File

@ -251,8 +251,7 @@ public class CorsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.cors(withDefaults());
@ -308,8 +307,7 @@ public class CorsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.cors(withDefaults());
@ -364,8 +362,7 @@ public class CorsConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.cors(withDefaults());

View File

@ -113,8 +113,7 @@ public class ExceptionHandlingConfigurerAccessDeniedHandlerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
)
.exceptionHandling((exceptionHandling) ->

View File

@ -453,8 +453,7 @@ public class FormLoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.formLogin(withDefaults());
@ -516,8 +515,7 @@ public class FormLoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.formLogin((formLogin) ->
@ -572,8 +570,7 @@ public class FormLoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.formLogin((formLogin) ->

View File

@ -250,8 +250,7 @@ public class HttpBasicConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.httpBasic(withDefaults());

View File

@ -341,8 +341,7 @@ public class HttpSecurityRequestMatchersTests {
.requestMatchers(new MvcRequestMatcher(introspector, "/path"))
)
.httpBasic(withDefaults())
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
);
return http.build();
@ -416,8 +415,7 @@ public class HttpSecurityRequestMatchersTests {
.requestMatchers("/never-match")
)
.httpBasic(withDefaults())
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
);
return http.build();

View File

@ -209,8 +209,7 @@ public class JeeConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.jee((jee) ->
@ -231,8 +230,7 @@ public class JeeConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.jee((jee) ->
@ -256,8 +254,7 @@ public class JeeConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.jee((jee) ->

View File

@ -200,8 +200,7 @@ public class NamespaceHttpBasicTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.httpBasic(withDefaults());
@ -236,8 +235,7 @@ public class NamespaceHttpBasicTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.httpBasic((httpBasicConfig) -> httpBasicConfig.realmName("Custom Realm"));
@ -325,8 +323,7 @@ public class NamespaceHttpBasicTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.httpBasic((httpBasicConfig) ->

View File

@ -130,8 +130,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
)
.exceptionHandling((exceptionHandling) ->
@ -176,8 +175,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
)
.exceptionHandling((exceptionHandling) ->

View File

@ -508,8 +508,7 @@ public class RememberMeConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.formLogin(withDefaults())
@ -557,8 +556,7 @@ public class RememberMeConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.formLogin(withDefaults())
@ -636,8 +634,7 @@ public class RememberMeConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.sessionManagement((sessionManagement) ->

View File

@ -412,8 +412,7 @@ public class RequestCacheConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.formLogin(withDefaults())
@ -432,8 +431,7 @@ public class RequestCacheConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.formLogin(withDefaults())
@ -452,8 +450,7 @@ public class RequestCacheConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.formLogin(withDefaults())

View File

@ -106,8 +106,7 @@ public class RequestMatcherConfigurerTests {
matchers
.requestMatchers(new AntPathRequestMatcher("/oauth/**"))
)
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
);
return http.build();

View File

@ -399,8 +399,7 @@ public class OAuth2ClientConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.oauth2Client(withDefaults());

View File

@ -1395,10 +1395,9 @@ public class OAuth2ResourceServerConfigurerTests {
context.registerBean("converterOne", JwtAuthenticationConverter.class, () -> converterBean);
context.registerBean("converterTwo", JwtAuthenticationConverter.class, () -> converterBean);
this.spring.context(context).autowire();
new OAuth2ResourceServerConfigurer<HttpSecurity>(context).jwt((jwt) -> {
assertThatExceptionOfType(NoUniqueBeanDefinitionException.class)
.isThrownBy(jwt::getJwtAuthenticationConverter);
});
new OAuth2ResourceServerConfigurer<HttpSecurity>(context)
.jwt((jwt) -> assertThatExceptionOfType(NoUniqueBeanDefinitionException.class)
.isThrownBy(jwt::getJwtAuthenticationConverter));
}
@Test
@ -1577,8 +1576,7 @@ public class OAuth2ResourceServerConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.requestMatchers("/requires-read-scope").access("hasAuthority('SCOPE_message:read')")
.anyRequest().authenticated()
)
@ -1630,8 +1628,7 @@ public class OAuth2ResourceServerConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.requestMatchers("/requires-read-scope").access("hasAuthority('SCOPE_message:read')")
.anyRequest().authenticated()
)
@ -2122,8 +2119,7 @@ public class OAuth2ResourceServerConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->
@ -2386,8 +2382,7 @@ public class OAuth2ResourceServerConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.requestMatchers("/requires-read-scope").hasAuthority("SCOPE_message:read")
.anyRequest().authenticated()
)
@ -2433,8 +2428,7 @@ public class OAuth2ResourceServerConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests((authorizeRequests) ->
authorizeRequests
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->