Skip to content

Commit 62d5ee5

Browse files
committed
Migrate to AuthorizationFilter in Spring Security auto-config
This commit updates Servlet based Spring Security auto-configuration to use AuthorizationFilter, which is intended to superseed FilterSecurityInterceptor.
1 parent c996e43 commit 62d5ee5

File tree

33 files changed

+48
-48
lines changed

33 files changed

+48
-48
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class ManagementWebSecurityAutoConfiguration {
5858
@Bean
5959
@Order(SecurityProperties.BASIC_AUTH_ORDER)
6060
SecurityFilterChain managementSecurityFilterChain(HttpSecurity http) throws Exception {
61-
http.authorizeRequests((requests) -> {
61+
http.authorizeHttpRequests((requests) -> {
6262
requests.requestMatchers(EndpointRequest.to(HealthEndpoint.class)).permitAll();
6363
requests.anyRequest().authenticated();
6464
});

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ org.springframework.security.config.annotation.web.configuration.WebSecurityConf
177177

178178
@Override
179179
protected void configure(HttpSecurity http) throws Exception {
180-
http.authorizeRequests((requests) -> {
180+
http.authorizeHttpRequests((requests) -> {
181181
requests.requestMatchers(EndpointRequest.toLinks()).permitAll();
182182
requests.requestMatchers(EndpointRequest.to(TestEndpoint1.class)).permitAll();
183183
requests.requestMatchers(EndpointRequest.toAnyEndpoint()).authenticated();

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static class CustomSecurityConfiguration
179179

180180
@Override
181181
protected void configure(HttpSecurity http) throws Exception {
182-
http.authorizeRequests((requests) -> {
182+
http.authorizeHttpRequests((requests) -> {
183183
requests.antMatchers("/foo").permitAll();
184184
requests.anyRequest().authenticated();
185185
});
@@ -194,7 +194,7 @@ static class TestSecurityFilterChainConfig {
194194

195195
@Bean
196196
SecurityFilterChain testSecurityFilterChain(HttpSecurity http) throws Exception {
197-
return http.antMatcher("/**").authorizeRequests((authorize) -> authorize.anyRequest().authenticated())
197+
return http.antMatcher("/**").authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
198198
.build();
199199
}
200200

@@ -206,8 +206,8 @@ static class TestRemoteDevToolsSecurityFilterChainConfig extends TestSecurityFil
206206
@Bean
207207
@Order(SecurityProperties.BASIC_AUTH_ORDER - 1)
208208
SecurityFilterChain testRemoteDevToolsSecurityFilterChain(HttpSecurity http) throws Exception {
209-
return http.requestMatcher(new AntPathRequestMatcher("/**")).authorizeRequests().anyRequest().anonymous()
210-
.and().csrf().disable().build();
209+
return http.requestMatcher(new AntPathRequestMatcher("/**")).authorizeHttpRequests().anyRequest()
210+
.hasRole("ROLE_ANONYMOUS").and().csrf().disable().build();
211211
}
212212

213213
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static class OAuth2SecurityFilterChainConfiguration {
5858

5959
@Bean
6060
SecurityFilterChain oauth2SecurityFilterChain(HttpSecurity http) throws Exception {
61-
http.authorizeRequests((requests) -> requests.anyRequest().authenticated());
61+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
6262
http.oauth2Login(Customizer.withDefaults());
6363
http.oauth2Client();
6464
return http.build();

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerJwtConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static class OAuth2SecurityFilterChainConfiguration {
135135
@Bean
136136
@ConditionalOnBean(JwtDecoder.class)
137137
SecurityFilterChain jwtSecurityFilterChain(HttpSecurity http) throws Exception {
138-
http.authorizeRequests((requests) -> requests.anyRequest().authenticated());
138+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
139139
http.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt);
140140
return http.build();
141141
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerOpaqueTokenConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static class OAuth2SecurityFilterChainConfiguration {
6060
@Bean
6161
@ConditionalOnBean(OpaqueTokenIntrospector.class)
6262
SecurityFilterChain opaqueTokenSecurityFilterChain(HttpSecurity http) throws Exception {
63-
http.authorizeRequests((requests) -> requests.anyRequest().authenticated());
63+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
6464
http.oauth2ResourceServer(OAuth2ResourceServerConfigurer::opaqueToken);
6565
return http.build();
6666
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2LoginConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Saml2LoginConfiguration {
3737

3838
@Bean
3939
SecurityFilterChain samlSecurityFilterChain(HttpSecurity http) throws Exception {
40-
http.authorizeRequests((requests) -> requests.anyRequest().authenticated()).saml2Login();
40+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated()).saml2Login();
4141
http.saml2Logout();
4242
return http.build();
4343
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static class SecurityFilterChainConfiguration {
6161
@Bean
6262
@Order(SecurityProperties.BASIC_AUTH_ORDER)
6363
SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {
64-
http.authorizeRequests().anyRequest().authenticated();
64+
http.authorizeHttpRequests().anyRequest().authenticated();
6565
http.formLogin();
6666
http.httpBasic();
6767
return http.build();

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static class TestSecurityFilterChainConfig {
241241

242242
@Bean
243243
SecurityFilterChain testSecurityFilterChain(HttpSecurity http) throws Exception {
244-
return http.antMatcher("/**").authorizeRequests((authorize) -> authorize.anyRequest().authenticated())
244+
return http.antMatcher("/**").authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
245245
.build();
246246

247247
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ static class TestSecurityFilterChainConfig {
659659

660660
@Bean
661661
SecurityFilterChain testSecurityFilterChain(HttpSecurity http) throws Exception {
662-
return http.antMatcher("/**").authorizeRequests((authorize) -> authorize.anyRequest().authenticated())
662+
return http.antMatcher("/**").authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
663663
.build();
664664
}
665665

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static class TestSecurityFilterChainConfig {
321321

322322
@Bean
323323
SecurityFilterChain testSecurityFilterChain(HttpSecurity http) throws Exception {
324-
return http.antMatcher("/**").authorizeRequests((authorize) -> authorize.anyRequest().authenticated())
324+
return http.antMatcher("/**").authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
325325
.build();
326326
}
327327

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static class TestSecurityFilterChainConfig {
298298

299299
@Bean
300300
SecurityFilterChain testSecurityFilterChain(HttpSecurity http) throws Exception {
301-
return http.antMatcher("/**").authorizeRequests((authorize) -> authorize.anyRequest().authenticated())
301+
return http.antMatcher("/**").authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
302302
.build();
303303

304304
}

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevtoolsSecurityConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class RemoteDevtoolsSecurityConfiguration {
5050
@ConditionalOnMissingBean(org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.class)
5151
@SuppressWarnings("deprecation")
5252
SecurityFilterChain devtoolsSecurityFilterChain(HttpSecurity http) throws Exception {
53-
http.requestMatcher(new AntPathRequestMatcher(this.url)).authorizeRequests().anyRequest().anonymous().and()
54-
.csrf().disable();
53+
http.requestMatcher(new AntPathRequestMatcher(this.url)).authorizeHttpRequests().anyRequest()
54+
.hasRole("ANONYMOUS").and().csrf().disable();
5555
return http.build();
5656
}
5757

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static class TestWebSecurityConfigurerAdapter
277277

278278
@Override
279279
protected void configure(HttpSecurity http) throws Exception {
280-
http.antMatcher("/foo/**").authorizeRequests().anyRequest().authenticated().and().httpBasic();
280+
http.antMatcher("/foo/**").authorizeHttpRequests().anyRequest().authenticated().and().httpBasic();
281281
}
282282

283283
}

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/endpoints/security/exposeall/MySecurityConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ public class MySecurityConfiguration {
2828
@Bean
2929
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
3030
http.requestMatcher(EndpointRequest.toAnyEndpoint())
31-
.authorizeRequests((requests) -> requests.anyRequest().permitAll());
31+
.authorizeHttpRequests((requests) -> requests.anyRequest().permitAll());
3232
return http.build();
3333
}
3434

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/endpoints/security/typical/MySecurityConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ public class MySecurityConfiguration {
2828
@Bean
2929
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
3030
http.requestMatcher(EndpointRequest.toAnyEndpoint())
31-
.authorizeRequests((requests) -> requests.anyRequest().hasRole("ENDPOINT_ADMIN"));
31+
.authorizeHttpRequests((requests) -> requests.anyRequest().hasRole("ENDPOINT_ADMIN"));
3232
http.httpBasic();
3333
return http.build();
3434
}

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/testing/slicetests/MyConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class MyConfiguration {
3030

3131
@Bean
3232
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
33-
http.authorizeRequests().anyRequest().authenticated();
33+
http.authorizeHttpRequests().anyRequest().authenticated();
3434
return http.build();
3535
}
3636

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/testing/slicetests/MySecurityConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class MySecurityConfiguration {
2626

2727
@Bean
2828
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
29-
http.authorizeRequests().anyRequest().authenticated();
29+
http.authorizeHttpRequests().anyRequest().authenticated();
3030
return http.build();
3131
}
3232

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/oauth2/client/MyOAuthClientConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class MyOAuthClientConfiguration {
2626

2727
@Bean
2828
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
29-
http.authorizeRequests().anyRequest().authenticated();
29+
http.authorizeHttpRequests().anyRequest().authenticated();
3030
http.oauth2Login().redirectionEndpoint().baseUri("custom-callback");
3131
return http.build();
3232
}

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/saml2/relyingparty/MySamlRelyingPartyConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class MySamlRelyingPartyConfiguration {
2626

2727
@Bean
2828
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
29-
http.authorizeRequests().anyRequest().authenticated();
29+
http.authorizeHttpRequests().anyRequest().authenticated();
3030
http.saml2Login();
3131
http.saml2Logout((saml2) -> saml2.logoutRequest((request) -> request.logoutUrl("/SLOService.saml2"))
3232
.logoutResponse((response) -> response.logoutUrl("/SLOService.saml2")));

spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/endpoints/security/exposeall/MySecurityConfiguration.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class MySecurityConfiguration {
2727

2828
@Bean
2929
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
30-
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests {
30+
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeHttpRequests {
3131
requests -> requests.anyRequest().permitAll() }
3232
return http.build()
3333
}
3434

35-
}
35+
}

spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/endpoints/security/typical/MySecurityConfiguration.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class MySecurityConfiguration {
2727

2828
@Bean
2929
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
30-
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests { requests ->
30+
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeHttpRequests { requests ->
3131
requests.anyRequest().hasRole("ENDPOINT_ADMIN")
3232
}
3333
http.httpBasic()
3434
return http.build()
3535
}
3636

37-
}
37+
}

spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/web/security/oauth2/client/MyOAuthClientConfiguration.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MyOAuthClientConfiguration {
2626

2727
@Bean
2828
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
29-
http.authorizeRequests().anyRequest().authenticated()
29+
http.authorizeHttpRequests().anyRequest().authenticated()
3030
http.oauth2Login().redirectionEndpoint().baseUri("custom-callback")
3131
return http.build()
3232
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-actuator-custom-security/src/main/java/smoketest/actuator/customsecurity/SecurityConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ private UserDetails createUserDetails(String username, String password, String..
5555

5656
@Bean
5757
SecurityFilterChain configure(HttpSecurity http) throws Exception {
58-
http.authorizeRequests((requests) -> {
58+
http.authorizeHttpRequests((requests) -> {
5959
requests.mvcMatchers("/actuator/beans").hasRole("BEANS");
6060
requests.requestMatchers(EndpointRequest.to("health")).permitAll();
6161
requests.requestMatchers(EndpointRequest.toAnyEndpoint().excluding(MappingsEndpoint.class))

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-method-security/src/main/java/smoketest/security/method/SampleMethodSecurityApplication.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected static class ApplicationSecurity {
6969
@Bean
7070
SecurityFilterChain configure(HttpSecurity http) throws Exception {
7171
http.csrf().disable();
72-
http.authorizeRequests((requests) -> requests.anyRequest().fullyAuthenticated());
72+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
7373
http.formLogin((form) -> form.loginPage("/login").permitAll());
7474
http.exceptionHandling((exceptions) -> exceptions.accessDeniedPage("/access"));
7575
return http.build();
@@ -85,7 +85,7 @@ protected static class ActuatorSecurity {
8585
SecurityFilterChain actuatorSecurity(HttpSecurity http) throws Exception {
8686
http.csrf().disable();
8787
http.requestMatcher(EndpointRequest.toAnyEndpoint());
88-
http.authorizeRequests((requests) -> requests.anyRequest().authenticated());
88+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
8989
http.httpBasic();
9090
return http.build();
9191
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure-custom/src/main/java/smoketest/web/secure/custom/SampleWebSecureCustomApplication.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ protected static class ApplicationSecurity {
4444
@Bean
4545
SecurityFilterChain configure(HttpSecurity http) throws Exception {
4646
http.csrf().disable();
47-
http.authorizeRequests((requests) -> requests.anyRequest().fullyAuthenticated());
47+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
4848
http.formLogin((form) -> form.loginPage("/login").permitAll());
4949
return http.build();
5050
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure-jdbc/src/main/java/smoketest/web/secure/jdbc/SampleWebSecureJdbcApplication.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ protected static class ApplicationSecurity {
4747
@Bean
4848
SecurityFilterChain configure(HttpSecurity http) throws Exception {
4949
http.csrf().disable();
50-
http.authorizeRequests((requests) -> requests.anyRequest().fullyAuthenticated());
50+
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
5151
http.formLogin((form) -> form.loginPage("/login").permitAll());
5252
return http.build();
5353
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomServletPathErrorPageTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ static class SecurityConfiguration {
4444

4545
@Bean
4646
SecurityFilterChain configure(HttpSecurity http) throws Exception {
47-
http.authorizeRequests((requests) -> {
47+
http.authorizeHttpRequests((requests) -> {
4848
requests.antMatchers("/custom/servlet/path/public/**").permitAll();
49-
requests.anyRequest().fullyAuthenticated();
49+
requests.anyRequest().authenticated();
5050
});
5151
http.httpBasic();
5252
http.formLogin((form) -> form.loginPage("/custom/servlet/path/login").permitAll());

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/CustomServletPathUnauthenticatedErrorPageTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static class SecurityConfiguration {
4343

4444
@Bean
4545
SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {
46-
http.authorizeRequests((requests) -> {
46+
http.authorizeHttpRequests((requests) -> {
4747
requests.antMatchers("/custom/servlet/path/error").permitAll();
4848
requests.antMatchers("/custom/servlet/path/public/**").permitAll();
4949
requests.anyRequest().authenticated();

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/ErrorPageTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ static class SecurityConfiguration {
4343

4444
@Bean
4545
SecurityFilterChain configure(HttpSecurity http) throws Exception {
46-
http.authorizeRequests((requests) -> {
46+
http.authorizeHttpRequests((requests) -> {
4747
requests.antMatchers("/public/**").permitAll();
48-
requests.anyRequest().fullyAuthenticated();
48+
requests.anyRequest().authenticated();
4949
});
5050
http.httpBasic();
5151
http.formLogin((form) -> form.loginPage("/login").permitAll());

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/NoSessionErrorPageTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static class SecurityConfiguration {
4545
@Bean
4646
SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {
4747
http.sessionManagement((session) -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
48-
.authorizeRequests((requests) -> {
48+
.authorizeHttpRequests((requests) -> {
4949
requests.antMatchers("/public/**").permitAll();
5050
requests.anyRequest().authenticated();
5151
});

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/SampleWebSecureApplicationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ static class SecurityConfiguration {
9595
@Bean
9696
SecurityFilterChain configure(HttpSecurity http) throws Exception {
9797
http.csrf().disable();
98-
http.authorizeRequests((requests) -> {
98+
http.authorizeHttpRequests((requests) -> {
9999
requests.antMatchers("/public/**").permitAll();
100-
requests.anyRequest().fullyAuthenticated();
100+
requests.anyRequest().authenticated();
101101
});
102102
http.httpBasic();
103103
http.formLogin((form) -> form.loginPage("/login").permitAll());

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-secure/src/test/java/smoketest/web/secure/UnauthenticatedErrorPageTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static class SecurityConfiguration {
4343

4444
@Bean
4545
SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {
46-
http.authorizeRequests((requests) -> {
46+
http.authorizeHttpRequests((requests) -> {
4747
requests.antMatchers("/error").permitAll();
4848
requests.antMatchers("/public/**").permitAll();
4949
requests.anyRequest().authenticated();

0 commit comments

Comments
 (0)