Make sessionDataKey optional in the common auth logout request
@@ -140,30 +140,41 @@ public class DefaultRequestCoordinator extends AbstractRequestCoordinator implem
// the request type (e.g. samlsso) set by the calling servlet.
// TODO: use a different mechanism to determine the flow start.
if (request.getParameter("type") != null) {
- // If the request is not a common auth logout request retrieve AuthenticationRequestCache entry,
- // which is stored stored from servlet against the session data key.
- if (!isCommonAuthLogoutRequest(request)) {
-
+ // Retrieves AuthenticationRequestCache entry, if the request contains a valid session data key and
+ // handles common auth logout request.
if (sessionDataKey != null) {
-
if (log.isDebugEnabled()) {
- log.debug("retrieving authentication request from cache..");
+ log.debug("Retrieving authentication request from cache for the sessionDataKey: " +
+ sessionDataKey);
}
authRequest = getAuthenticationRequest(request, sessionDataKey);
-
if (authRequest == null) {
- // authRequest cannot be retrieved from cache. Cache
- throw new FrameworkException(
- "Invalid authentication request. Session data key : " + sessionDataKey);
+ // authRequest is not retrieved from the cache.
+ if (log.isDebugEnabled()) {
+ log.debug("No authentication request found in the cache for sessionDataKey: "
+ + sessionDataKey);
+ }
+
+ if (isCommonAuthLogoutRequest(request)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Ignoring the invalid sessionDataKey: " + sessionDataKey + " in the " +
+ "CommonAuthLogout request.");
}
+
} else {
- // sessionDataKey is null and not a logout request
+ throw new FrameworkException("Invalid authentication request with sessionDataKey: "
+ + sessionDataKey);
+ }
+ }
+
+ } else if (!isCommonAuthLogoutRequest(request)) {
+ // sessionDataKey is null and not a common auth logout request
if (log.isDebugEnabled()) {
log.debug("Session data key is null in the request and not a logout request.");
}
- FrameworkUtils.sendToRetryPage(request, responseWrapper);
- }
+
+ FrameworkUtils.sendToRetryPage(request, response);
}
// if there is a cache entry, wrap the original request with params in cache entry
