Skip to content

Commit 12a0ccf

Browse files
committed
Remove Explicit CSRF Config from DeferHttpSessionTests
Issue gh-11764
1 parent 617353e commit 12a0ccf

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
import org.springframework.security.config.test.SpringTestContextExtension;
3333
import org.springframework.security.web.DefaultSecurityFilterChain;
3434
import org.springframework.security.web.FilterChainProxy;
35-
import org.springframework.security.web.csrf.CsrfTokenRepository;
36-
import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository;
3735

3836
import static org.mockito.ArgumentMatchers.anyBoolean;
3937
import static org.mockito.Mockito.never;
@@ -78,17 +76,13 @@ Service service() {
7876

7977
@Bean
8078
DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception {
81-
CsrfTokenRepository csrfRepository = new HttpSessionCsrfTokenRepository();
8279
// @formatter:off
8380
http
8481
.authorizeHttpRequests((requests) -> requests
8582
.anyRequest().permitAll()
8683
)
8784
.sessionManagement((sessions) -> sessions
8885
.requireExplicitAuthenticationStrategy(true)
89-
)
90-
.csrf((csrf) -> csrf
91-
.csrfTokenRepository(csrfRepository)
9286
);
9387
// @formatter:on
9488
return http.build();

config/src/test/resources/org/springframework/security/config/http/DeferHttpSessionTests-Explicit.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,11 @@
2929
<http auto-config="true"
3030
use-authorization-manager="true">
3131
<intercept-url pattern="/**" access="permitAll"/>
32-
<csrf token-repository-ref="csrfRepository"/>
3332
<request-cache ref="requestCache"/>
3433
<session-management authentication-strategy-explicit-invocation="true"/>
3534
</http>
3635

3736
<b:bean id="requestCache" class="org.springframework.security.web.savedrequest.HttpSessionRequestCache"
3837
p:matchingRequestParameterName="continue"/>
39-
<b:bean id="httpSessionCsrfRepository" class="org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository"/>
40-
<b:bean id="csrfRepository" class="org.springframework.security.web.csrf.LazyCsrfTokenRepository"
41-
c:delegate-ref="httpSessionCsrfRepository"
42-
p:deferLoadToken="true"/>
43-
<b:bean id="requestHandler" class="org.springframework.security.web.csrf.CsrfTokenRepositoryRequestHandler"
44-
p:csrfRequestAttributeName="_csrf"/>
4538
<b:import resource="CsrfConfigTests-shared-userservice.xml"/>
4639
</b:beans>

0 commit comments

Comments
 (0)