Skip to content

Commit 68b198f

Browse files
committed
Merge branch '6.0.x'
2 parents 33b266e + 64542b4 commit 68b198f

File tree

1 file changed

+2
-9
lines changed
  • config/src/main/java/org/springframework/security/config/annotation/web/configurers

1 file changed

+2
-9
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/X509Configurer.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.springframework.security.config.annotation.web.configurers;
1818

1919
import jakarta.servlet.http.HttpServletRequest;
20-
2120
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
2221
import org.springframework.context.ApplicationContext;
2322
import org.springframework.security.authentication.AuthenticationDetailsSource;
@@ -36,7 +35,7 @@
3635
import org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor;
3736
import org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter;
3837
import org.springframework.security.web.authentication.preauth.x509.X509PrincipalExtractor;
39-
import org.springframework.security.web.context.SecurityContextRepository;
38+
import org.springframework.security.web.context.RequestAttributeSecurityContextRepository;
4039

4140
/**
4241
* Adds X509 based pre authentication to an application. Since validating the certificate
@@ -193,13 +192,7 @@ private X509AuthenticationFilter getFilter(AuthenticationManager authenticationM
193192
if (this.authenticationDetailsSource != null) {
194193
this.x509AuthenticationFilter.setAuthenticationDetailsSource(this.authenticationDetailsSource);
195194
}
196-
SecurityContextConfigurer<?> securityContextConfigurer = http
197-
.getConfigurer(SecurityContextConfigurer.class);
198-
if (securityContextConfigurer != null && securityContextConfigurer.isRequireExplicitSave()) {
199-
SecurityContextRepository securityContextRepository = securityContextConfigurer
200-
.getSecurityContextRepository();
201-
this.x509AuthenticationFilter.setSecurityContextRepository(securityContextRepository);
202-
}
195+
this.x509AuthenticationFilter.setSecurityContextRepository(new RequestAttributeSecurityContextRepository());
203196
this.x509AuthenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy());
204197
this.x509AuthenticationFilter = postProcess(this.x509AuthenticationFilter);
205198
}

0 commit comments

Comments
 (0)