Skip to content

Commit 3230cd6

Browse files
dongmyojzheaux
authored andcommitted
Remove Servlet Spec 2.5 Support for HttpSessionSecurityContextRepository
Fixes: gh-6261
1 parent 733a380 commit 3230cd6

File tree

2 files changed

+4
-62
lines changed

2 files changed

+4
-62
lines changed

web/src/main/java/org/springframework/security/web/context/HttpSessionSecurityContextRepository.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.springframework.security.core.context.SecurityContextHolder;
3636
import org.springframework.security.core.context.SecurityContextHolderStrategy;
3737
import org.springframework.util.Assert;
38-
import org.springframework.util.ClassUtils;
3938
import org.springframework.web.util.WebUtils;
4039

4140
/**
@@ -95,7 +94,6 @@ public class HttpSessionSecurityContextRepository implements SecurityContextRepo
9594
private final Object contextObject = SecurityContextHolder.createEmptyContext();
9695
private boolean allowSessionCreation = true;
9796
private boolean disableUrlRewriting = false;
98-
private boolean isServlet3 = ClassUtils.hasMethod(ServletRequest.class, "startAsync");
9997
private String springSecurityContextKey = SPRING_SECURITY_CONTEXT_KEY;
10098

10199
private AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
@@ -127,10 +125,8 @@ public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHold
127125
response, request, httpSession != null, context);
128126
requestResponseHolder.setResponse(wrappedResponse);
129127

130-
if (isServlet3) {
131-
requestResponseHolder.setRequest(new Servlet3SaveToSessionRequestWrapper(
132-
request, wrappedResponse));
133-
}
128+
requestResponseHolder.setRequest(new SaveToSessionRequestWrapper(
129+
request, wrappedResponse));
134130

135131
return context;
136132
}
@@ -269,11 +265,11 @@ public void setSpringSecurityContextKey(String springSecurityContextKey) {
269265
// ~ Inner Classes
270266
// ==================================================================================================
271267

272-
private static class Servlet3SaveToSessionRequestWrapper extends
268+
private static class SaveToSessionRequestWrapper extends
273269
HttpServletRequestWrapper {
274270
private final SaveContextOnUpdateOrErrorResponseWrapper response;
275271

276-
public Servlet3SaveToSessionRequestWrapper(HttpServletRequest request,
272+
public SaveToSessionRequestWrapper(HttpServletRequest request,
277273
SaveContextOnUpdateOrErrorResponseWrapper response) {
278274
super(request);
279275
this.response = response;

web/src/test/java/org/springframework/security/web/context/HttpSessionSecurityContextRepositoryServlet25Tests.java

-54
This file was deleted.

0 commit comments

Comments
 (0)