-
Notifications
You must be signed in to change notification settings - Fork 571
Description
- Framework version: 0.9
- Implementations: Spring Boot
Using aws-serverless-java-container-spring 0.9 and Spring Boot 1.5.9.RELEASE, which pulls in Spring Security 4.2.3.RELEASE.
The current implementation of com.amazonaws.serverless.proxy.internal.servlet.AwsHttpServletRequest throws an UnsupportedOperationException when the getRequestedSessionId() method is called.
The default Spring Boot configuration includes the Spring Security SessionManagementFilter in the filter chain. The problem is that the SessionManagementFilter checks the requested session ID under some scenarios:
From org.springframework.security.web.session.SessionManagementFilter, starting at line 118 in doFilter:
else {
// No security context or authentication present. Check for a session
// timeout
if (request.getRequestedSessionId() != null
&& !request.isRequestedSessionIdValid()) {
if (logger.isDebugEnabled()) {
logger.debug("Requested session ID "
+ request.getRequestedSessionId() + " is invalid.");
}
if (invalidSessionStrategy != null) {
invalidSessionStrategy
.onInvalidSessionDetected(request, response);
return;
}
}
Thus, the call to request.getRequestedSessionId() throws and the exception then propagates through the system, destroying the request.
If getRequestedSessionId() returned null, instead of throwing an exception, this problem wouldn't occur.
A null return value from getRequestedSessionId() indicates that the user did not specify a session ID. This would be consistent with the fact that isRequestedSessionIdValid() returns false, and in conformance with the HttpServletRequest specification.