Format Lambda Usage

This commit updates Lambda DSL usage to favor
having the variable and reference on the same line

Issue gh-13067
This commit is contained in:
Josh Cummings 2025-06-19 18:16:20 -06:00
parent 777447e1d9
commit da6c7b8759
No known key found for this signature in database
GPG Key ID: 869B37A20E876129
35 changed files with 97 additions and 194 deletions

View File

@ -74,8 +74,7 @@ public class HelloRSocketITests {
// @formatter:off
this.server = RSocketServer.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.interceptors((registry) ->
registry.forSocketAcceptor(this.interceptor)
.interceptors((registry) -> registry.forSocketAcceptor(this.interceptor)
)
.acceptor(this.handler.responder())
.bind(TcpServerTransport.create("localhost", 0))

View File

@ -87,8 +87,7 @@ public class HelloRSocketObservationITests {
// @formatter:off
this.server = RSocketServer.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.interceptors((registry) ->
registry.forSocketAcceptor(this.interceptor)
.interceptors((registry) -> registry.forSocketAcceptor(this.interceptor)
)
.acceptor(this.handler.responder())
.bind(TcpServerTransport.create("localhost", 0))

View File

@ -74,8 +74,7 @@ public class HelloRSocketWithWebFluxITests {
// @formatter:off
this.server = RSocketServer.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.interceptors((registry) ->
registry.forSocketAcceptor(this.interceptor)
.interceptors((registry) -> registry.forSocketAcceptor(this.interceptor)
)
.acceptor(this.handler.responder())
.bind(TcpServerTransport.create("localhost", 0))

View File

@ -86,8 +86,7 @@ public class JwtITests {
// @formatter:off
this.server = RSocketServer.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.interceptors((registry) ->
registry.forSocketAcceptor(this.interceptor)
.interceptors((registry) -> registry.forSocketAcceptor(this.interceptor)
)
.acceptor(this.handler.responder())
.bind(TcpServerTransport.create("localhost", 0))

View File

@ -81,8 +81,7 @@ public class RSocketMessageHandlerConnectionITests {
// @formatter:off
this.server = RSocketServer.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.interceptors((registry) ->
registry.forSocketAcceptor(this.interceptor)
.interceptors((registry) -> registry.forSocketAcceptor(this.interceptor)
)
.acceptor(this.handler.responder())
.bind(TcpServerTransport.create("localhost", 0))

View File

@ -79,8 +79,7 @@ public class RSocketMessageHandlerITests {
// @formatter:off
this.server = RSocketServer.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.interceptors((registry) ->
registry.forSocketAcceptor(this.interceptor)
.interceptors((registry) -> registry.forSocketAcceptor(this.interceptor)
)
.acceptor(this.handler.responder())
.bind(TcpServerTransport.create("localhost", 0))

View File

@ -79,8 +79,7 @@ public class SimpleAuthenticationITests {
// @formatter:off
this.server = RSocketServer.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.interceptors((registry) ->
registry.forSocketAcceptor(this.interceptor)
.interceptors((registry) -> registry.forSocketAcceptor(this.interceptor)
)
.acceptor(this.handler.responder())
.bind(TcpServerTransport.create("localhost", 0))

View File

@ -129,8 +129,7 @@ public class AnonymousConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.anonymous((anonymous) ->
anonymous
.anonymous((anonymous) -> anonymous
.principal("principal")
);
return http.build();

View File

@ -186,8 +186,7 @@ public class ChannelSecurityConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.requiresChannel((requiresChannel) ->
requiresChannel
.requiresChannel((requiresChannel) -> requiresChannel
.anyRequest().requiresSecure()
);
return http.build();

View File

@ -128,8 +128,7 @@ public class CsrfConfigurerIgnoringRequestMatchersTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.csrf((csrf) ->
csrf
.csrf((csrf) -> csrf
.requireCsrfProtectionMatcher(new AntPathRequestMatcher("/path"))
.ignoringRequestMatchers(this.requestMatcher)
);
@ -169,8 +168,7 @@ public class CsrfConfigurerIgnoringRequestMatchersTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.csrf((csrf) ->
csrf
.csrf((csrf) -> csrf
.ignoringRequestMatchers(new AntPathRequestMatcher("/no-csrf"))
.ignoringRequestMatchers(this.requestMatcher)
);

View File

@ -116,8 +116,7 @@ public class ExceptionHandlingConfigurerAccessDeniedHandlerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
)
.exceptionHandling((exceptionHandling) ->
exceptionHandling
.exceptionHandling((exceptionHandling) -> exceptionHandling
.defaultAccessDeniedHandlerFor(
this.teapotDeniedHandler,
new AntPathRequestMatcher("/hello/**")

View File

@ -518,8 +518,7 @@ public class FormLoginConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.formLogin((formLogin) ->
formLogin
.formLogin((formLogin) -> formLogin
.loginPage("/authenticate")
.permitAll()
)
@ -573,15 +572,13 @@ public class FormLoginConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.formLogin((formLogin) ->
formLogin
.formLogin((formLogin) -> formLogin
.loginProcessingUrl("/loginCheck")
.loginPage("/login")
.defaultSuccessUrl("/", true)
.permitAll()
)
.logout((logout) ->
logout
.logout((logout) -> logout
.logoutSuccessUrl("/login")
.logoutUrl("/logout")
.deleteCookies("JSESSIONID")

View File

@ -630,8 +630,7 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.contentTypeOptions(withDefaults())
);
@ -700,8 +699,7 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.cacheControl(withDefaults())
);
@ -753,8 +751,7 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.xssProtection(withDefaults())
);
@ -772,11 +769,9 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.xssProtection((xXssConfig) ->
xXssConfig.headerValue(XXssProtectionHeaderWriter.HeaderValue.ENABLED_MODE_BLOCK)
.xssProtection((xXssConfig) -> xXssConfig.headerValue(XXssProtectionHeaderWriter.HeaderValue.ENABLED_MODE_BLOCK)
)
);
// @formatter:on
@ -808,8 +803,7 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.frameOptions((frameOptionsConfig) -> frameOptionsConfig.sameOrigin())
);
return http.build();
@ -976,11 +970,9 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.httpPublicKeyPinning((hpkp) ->
hpkp
.httpPublicKeyPinning((hpkp) -> hpkp
.addSha256Pins("d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=")
.reportUri("https://example.net/pkp-report")
)
@ -1035,11 +1027,9 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.contentSecurityPolicy((csp) ->
csp
.contentSecurityPolicy((csp) -> csp
.policyDirectives("default-src 'self'; script-src trustedscripts.example.com")
.reportOnly()
)
@ -1075,11 +1065,9 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.contentSecurityPolicy((csp) ->
csp.policyDirectives("")
.contentSecurityPolicy((csp) -> csp.policyDirectives("")
)
);
return http.build();
@ -1096,8 +1084,7 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.contentSecurityPolicy(withDefaults())
);
@ -1132,8 +1119,7 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.referrerPolicy(Customizer.withDefaults())
);
@ -1168,11 +1154,9 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.referrerPolicy((referrerPolicy) ->
referrerPolicy.policy(ReferrerPolicy.SAME_ORIGIN)
.referrerPolicy((referrerPolicy) -> referrerPolicy.policy(ReferrerPolicy.SAME_ORIGIN)
)
);
return http.build();
@ -1308,8 +1292,7 @@ public class HeadersConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.headers((headers) ->
headers
.headers((headers) -> headers
.defaultsDisabled()
.httpStrictTransportSecurity((hstsConfig) -> hstsConfig.preload(true))
);

View File

@ -336,8 +336,7 @@ public class HttpSecurityRequestMatchersTests {
SecurityFilterChain filterChain(HttpSecurity http, HandlerMappingIntrospector introspector) throws Exception {
// @formatter:off
http
.securityMatchers((matchers) ->
matchers
.securityMatchers((secure) -> secure
.requestMatchers(new MvcRequestMatcher(introspector, "/path"))
)
.httpBasic(withDefaults())
@ -409,8 +408,7 @@ public class HttpSecurityRequestMatchersTests {
mvcMatcherBuilder.servletPath("/spring");
// @formatter:off
http
.securityMatchers((matchers) ->
matchers
.securityMatchers((secure) -> secure
.requestMatchers(mvcMatcherBuilder.pattern("/path"))
.requestMatchers("/never-match")
)

View File

@ -212,8 +212,7 @@ public class JeeConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.jee((jee) ->
jee
.jee((jee) -> jee
.mappableRoles("USER")
);
return http.build();
@ -233,8 +232,7 @@ public class JeeConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.jee((jee) ->
jee
.jee((jee) -> jee
.mappableAuthorities("ROLE_USER")
);
return http.build();
@ -257,8 +255,7 @@ public class JeeConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.jee((jee) ->
jee
.jee((jee) -> jee
.authenticatedUserDetailsService(authenticationUserDetailsService)
);
return http.build();

View File

@ -431,8 +431,7 @@ public class LogoutConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.logout((logout) ->
logout.defaultLogoutSuccessHandlerFor(null, mock(RequestMatcher.class))
.logout((logout) -> logout.defaultLogoutSuccessHandlerFor(null, mock(RequestMatcher.class))
);
return http.build();
// @formatter:on
@ -464,8 +463,7 @@ public class LogoutConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.logout((logout) ->
logout.defaultLogoutSuccessHandlerFor(mock(LogoutSuccessHandler.class), null)
.logout((logout) -> logout.defaultLogoutSuccessHandlerFor(mock(LogoutSuccessHandler.class), null)
);
return http.build();
// @formatter:on

View File

@ -280,8 +280,7 @@ public class NamespaceHttpBasicTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.httpBasic((httpBasicConfig) ->
httpBasicConfig.authenticationDetailsSource(this.authenticationDetailsSource));
.httpBasic((httpBasicConfig) -> httpBasicConfig.authenticationDetailsSource(this.authenticationDetailsSource));
return http.build();
// @formatter:on
}
@ -326,8 +325,7 @@ public class NamespaceHttpBasicTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.httpBasic((httpBasicConfig) ->
httpBasicConfig.authenticationEntryPoint(this.authenticationEntryPoint));
.httpBasic((httpBasicConfig) -> httpBasicConfig.authenticationEntryPoint(this.authenticationEntryPoint));
return http.build();
// @formatter:on
}

View File

@ -215,8 +215,7 @@ public class NamespaceHttpLogoutTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.logout((logout) ->
logout.deleteCookies("remove")
.logout((logout) -> logout.deleteCookies("remove")
.invalidateHttpSession(false)
.logoutUrl("/custom-logout")
.logoutSuccessUrl("/logout-success")

View File

@ -133,8 +133,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
)
.exceptionHandling((exceptionHandling) ->
exceptionHandling.accessDeniedPage("/AccessDeniedPageConfig")
.exceptionHandling((exceptionHandling) -> exceptionHandling.accessDeniedPage("/AccessDeniedPageConfig")
);
return http.build();
// @formatter:on
@ -178,8 +177,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().denyAll()
)
.exceptionHandling((exceptionHandling) ->
exceptionHandling.accessDeniedHandler(accessDeniedHandler())
.exceptionHandling((exceptionHandling) -> exceptionHandling.accessDeniedHandler(accessDeniedHandler())
);
return http.build();
// @formatter:on

View File

@ -93,12 +93,10 @@ public class PortMapperConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.requiresChannel((requiresChannel) ->
requiresChannel
.requiresChannel((requiresChannel) -> requiresChannel
.anyRequest().requiresSecure()
)
.portMapper((portMapper) ->
portMapper
.portMapper((portMapper) -> portMapper
.http(543).mapsTo(123)
);
return http.build();
@ -117,12 +115,10 @@ public class PortMapperConfigurerTests {
customPortMapper.setPortMappings(Collections.singletonMap("543", "123"));
// @formatter:off
http
.requiresChannel((requiresChannel) ->
requiresChannel
.requiresChannel((requiresChannel) -> requiresChannel
.anyRequest().requiresSecure()
)
.portMapper((portMapper) ->
portMapper
.portMapper((portMapper) -> portMapper
.portMapper(customPortMapper)
);
return http.build();

View File

@ -560,8 +560,7 @@ public class RememberMeConfigurerTests {
.anyRequest().hasRole("USER")
)
.formLogin(withDefaults())
.rememberMe((rememberMe) ->
rememberMe
.rememberMe((rememberMe) -> rememberMe
.rememberMeCookieDomain("spring.io")
);
return http.build();
@ -637,8 +636,7 @@ public class RememberMeConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().hasRole("USER")
)
.sessionManagement((sessionManagement) ->
sessionManagement
.sessionManagement((sessionManagement) -> sessionManagement
.maximumSessions(1)
)
.formLogin(withDefaults())

View File

@ -454,8 +454,7 @@ public class RequestCacheConfigurerTests {
.anyRequest().authenticated()
)
.formLogin(withDefaults())
.requestCache((requestCache) ->
requestCache
.requestCache((requestCache) -> requestCache
.requestCache(new NullRequestCache())
);
return http.build();

View File

@ -98,12 +98,10 @@ public class RequestMatcherConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.securityMatchers((matchers) ->
matchers
.securityMatchers((secure) -> secure
.requestMatchers(new AntPathRequestMatcher("/api/**"))
)
.securityMatchers((matchers) ->
matchers
.securityMatchers((securityMatchers) -> securityMatchers
.requestMatchers(new AntPathRequestMatcher("/oauth/**"))
)
.authorizeRequests((authorize) -> authorize

View File

@ -269,8 +269,7 @@ public class SecurityContextConfigurerTests {
// @formatter:off
http
.formLogin(withDefaults())
.securityContext((securityContext) ->
securityContext
.securityContext((securityContext) -> securityContext
.securityContextRepository(new NullSecurityContextRepository())
);
// @formatter:on

View File

@ -359,8 +359,7 @@ public class ServletApiConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.servletApi((servletApi) ->
servletApi
.servletApi((servletApi) -> servletApi
.rolePrefix("PERMISSION_")
);
return http.build();

View File

@ -629,8 +629,7 @@ public class SessionManagementConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.sessionManagement((sessionManagement) ->
sessionManagement
.sessionManagement((sessionManagement) -> sessionManagement
.requireExplicitAuthenticationStrategy(false)
.sessionFixation(SessionManagementConfigurer.SessionFixationConfigurer::newSession)
)
@ -678,10 +677,8 @@ public class SessionManagementConfigurerTests {
// @formatter:off
http
.formLogin(withDefaults())
.sessionManagement((sessionManagement) ->
sessionManagement
.sessionConcurrency((sessionConcurrency) ->
sessionConcurrency
.sessionManagement((sessionManagement) -> sessionManagement
.sessionConcurrency((sessionConcurrency) -> sessionConcurrency
.maximumSessions(1)
.maxSessionsPreventsLogin(true)
)
@ -741,8 +738,7 @@ public class SessionManagementConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.sessionManagement((sessionManagement) ->
sessionManagement
.sessionManagement((sessionManagement) -> sessionManagement
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
);
return http.build();
@ -897,8 +893,7 @@ public class SessionManagementConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.sessionManagement((sessionManagement) ->
sessionManagement
.sessionManagement((sessionManagement) -> sessionManagement
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
.httpBasic(withDefaults());

View File

@ -280,8 +280,7 @@ public class X509ConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.x509((x509) ->
x509
.x509((x509) -> x509
.subjectPrincipalRegex("CN=(.*?)@example.com(?:,|$)")
);
// @formatter:on

View File

@ -827,8 +827,7 @@ public class OAuth2LoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.oauth2Login((oauth2Login) ->
oauth2Login
.oauth2Login((oauth2) -> oauth2
.clientRegistrationRepository(
new InMemoryClientRegistrationRepository(GOOGLE_CLIENT_REGISTRATION))
);
@ -1029,11 +1028,9 @@ public class OAuth2LoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.oauth2Login((oauth2Login) ->
oauth2Login
.oauth2Login((oauth2) -> oauth2
.clientRegistrationRepository(this.clientRegistrationRepository)
.authorizationEndpoint((authorizationEndpoint) ->
authorizationEndpoint
.authorizationEndpoint((authorizationEndpoint) -> authorizationEndpoint
.authorizationRequestResolver(this.resolver)
)
);
@ -1056,11 +1053,9 @@ public class OAuth2LoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.oauth2Login((oauth2Login) ->
oauth2Login
.oauth2Login((oauth2) -> oauth2
.clientRegistrationRepository(this.clientRegistrationRepository)
.authorizationEndpoint((authorizationEndpoint) ->
authorizationEndpoint
.authorizationEndpoint((authorizationEndpoint) -> authorizationEndpoint
.authorizationRedirectStrategy(this.redirectStrategy)
)
);
@ -1083,11 +1078,9 @@ public class OAuth2LoginConfigurerTests {
SecurityFilterChain configureFilterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.oauth2Login((oauth2Login) ->
oauth2Login
.oauth2Login((oauth2) -> oauth2
.clientRegistrationRepository(this.clientRegistrationRepository)
.authorizationEndpoint((authorizationEndpoint) ->
authorizationEndpoint
.authorizationEndpoint((authorizationEndpoint) -> authorizationEndpoint
.authorizationRedirectStrategy(this.redirectStrategy)
)
);
@ -1159,8 +1152,7 @@ public class OAuth2LoginConfigurerTests {
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
http
.oauth2Login((oauth2Login) ->
oauth2Login
.oauth2Login((oauth2) -> oauth2
.clientRegistrationRepository(
new InMemoryClientRegistrationRepository(GOOGLE_CLIENT_REGISTRATION))
.loginPage("/custom-login")
@ -1343,18 +1335,14 @@ public class OAuth2LoginConfigurerTests {
.authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.securityContext((securityContext) ->
securityContext
.securityContext((securityContext) -> securityContext
.securityContextRepository(securityContextRepository())
)
.oauth2Login((oauth2Login) ->
oauth2Login
.tokenEndpoint((tokenEndpoint) ->
tokenEndpoint
.oauth2Login((oauth2) -> oauth2
.tokenEndpoint((tokenEndpoint) -> tokenEndpoint
.accessTokenResponseClient(createOauth2AccessTokenResponseClient())
)
.userInfoEndpoint((userInfoEndpoint) ->
userInfoEndpoint
.userInfoEndpoint((userInfoEndpoint) -> userInfoEndpoint
.userService(createOauth2UserService())
.oidcUserService(createOidcUserService())
)

View File

@ -245,8 +245,7 @@ public class DPoPAuthenticationConfigurerTests {
.requestMatchers("/resource2").hasAnyAuthority("SCOPE_resource2.read", "SCOPE_resource2.write")
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.oauth2ResourceServer((oauth2) -> oauth2
.jwt(Customizer.withDefaults()));
// @formatter:on
return http.build();

View File

@ -1580,8 +1580,7 @@ public class OAuth2ResourceServerConfigurerTests {
.requestMatchers("/requires-read-scope").access("hasAuthority('SCOPE_message:read')")
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.oauth2ResourceServer((oauth2) -> oauth2
.jwt(withDefaults())
);
return http.build();
@ -1632,10 +1631,8 @@ public class OAuth2ResourceServerConfigurerTests {
.requestMatchers("/requires-read-scope").access("hasAuthority('SCOPE_message:read')")
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.jwt((jwt) ->
jwt
.oauth2ResourceServer((oauth2) -> oauth2
.jwt((jwt) -> jwt
.jwkSetUri(this.jwkSetUri)
)
);
@ -2122,10 +2119,8 @@ public class OAuth2ResourceServerConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.jwt((jwt) ->
jwt
.oauth2ResourceServer((oauth2) -> oauth2
.jwt((jwt) -> jwt
.decoder(decoder())
)
);
@ -2386,8 +2381,7 @@ public class OAuth2ResourceServerConfigurerTests {
.requestMatchers("/requires-read-scope").hasAuthority("SCOPE_message:read")
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.oauth2ResourceServer((oauth2) -> oauth2
.opaqueToken(withDefaults())
);
return http.build();
@ -2431,10 +2425,8 @@ public class OAuth2ResourceServerConfigurerTests {
.authorizeRequests((authorize) -> authorize
.anyRequest().authenticated()
)
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.opaqueToken((opaqueToken) ->
opaqueToken
.oauth2ResourceServer((oauth2) -> oauth2
.opaqueToken((opaqueToken) -> opaqueToken
.authenticationManager(authenticationProvider()::authenticate)
)
);

View File

@ -333,8 +333,7 @@ public class HeaderSpecTests {
this.expectedHeaders.set(XXssProtectionServerHttpHeadersWriter.X_XSS_PROTECTION, "0");
// @formatter:off
this.http.headers((headers) -> headers
.xssProtection((xssProtection) ->
xssProtection.headerValue(XXssProtectionServerHttpHeadersWriter.HeaderValue.DISABLED)
.xssProtection((xssProtection) -> xssProtection.headerValue(XXssProtectionServerHttpHeadersWriter.HeaderValue.DISABLED)
));
// @formatter:on
assertHeaders();

View File

@ -211,8 +211,7 @@ public class HttpsRedirectSpecTests {
SecurityWebFilterChain springSecurity(ServerHttpSecurity http) {
// @formatter:off
http
.redirectToHttps((redirectToHttps) ->
redirectToHttps
.redirectToHttps((redirectToHttps) -> redirectToHttps
.httpsRedirectWhen(new PathPatternParserServerWebExchangeMatcher("/secure"))
);
// @formatter:on
@ -252,8 +251,7 @@ public class HttpsRedirectSpecTests {
SecurityWebFilterChain springSecurity(ServerHttpSecurity http) {
// @formatter:off
http
.redirectToHttps((redirectToHttps) ->
redirectToHttps
.redirectToHttps((redirectToHttps) -> redirectToHttps
.portMapper(portMapper())
);
// @formatter:on

View File

@ -377,8 +377,7 @@ public class OAuth2ClientSpecTests {
SecurityWebFilterChain springSecurityFilter(ServerHttpSecurity http) {
// @formatter:off
http
.oauth2Client((oauth2Client) ->
oauth2Client
.oauth2Client((oauth2Client) -> oauth2Client
.authenticationConverter(this.authenticationConverter)
.authenticationManager(this.manager)
.authorizationRequestRepository(this.authorizationRequestRepository))

View File

@ -986,12 +986,10 @@ public class OAuth2LoginTests {
SecurityWebFilterChain springSecurityFilter(ServerHttpSecurity http) {
// @formatter:off
http
.authorizeExchange((exchanges) ->
exchanges
.authorizeExchange((authorizeExchange) -> authorizeExchange
.anyExchange().authenticated()
)
.oauth2Login((oauth2Login) ->
oauth2Login
.oauth2Login((oauth2) -> oauth2
.authenticationConverter(this.authenticationConverter)
.authenticationManager(this.manager)
.authenticationMatcher(this.matcher)

View File

@ -701,14 +701,11 @@ public class OAuth2ResourceServerSpecTests {
SecurityWebFilterChain springSecurity(ServerHttpSecurity http) {
// @formatter:off
http
.authorizeExchange((exchanges) ->
exchanges
.authorizeExchange((authorizeExchange) -> authorizeExchange
.anyExchange().hasAuthority("SCOPE_message:read")
)
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.jwt((jwt) ->
jwt
.oauth2ResourceServer((oauth2) -> oauth2
.jwt((jwt) -> jwt
.publicKey(publicKey())
)
);
@ -782,10 +779,8 @@ public class OAuth2ResourceServerSpecTests {
String jwkSetUri = mockWebServer().url("/.well-known/jwks.json").toString();
// @formatter:off
http
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.jwt((jwt) ->
jwt
.oauth2ResourceServer((oauth2) -> oauth2
.jwt((jwt) -> jwt
.jwkSetUri(jwkSetUri)
)
);
@ -879,10 +874,8 @@ public class OAuth2ResourceServerSpecTests {
SecurityWebFilterChain springSecurity(ServerHttpSecurity http) {
// @formatter:off
http
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.jwt((jwt) ->
jwt
.oauth2ResourceServer((oauth2) -> oauth2
.jwt((jwt) -> jwt
.authenticationManager(authenticationManager())
)
);
@ -1078,10 +1071,8 @@ public class OAuth2ResourceServerSpecTests {
String introspectionUri = mockWebServer().url("/introspect").toString();
// @formatter:off
http
.oauth2ResourceServer((oauth2ResourceServer) ->
oauth2ResourceServer
.opaqueToken((opaqueToken) ->
opaqueToken
.oauth2ResourceServer((oauth2) -> oauth2
.opaqueToken((opaqueToken) -> opaqueToken
.introspectionUri(introspectionUri)
.introspectionClientCredentials("client", "secret")
)