} catch (ServletException ex) {
log.error("Error forwarding Shibboleth SSO request to AuthenticationManager", ex);
throw new ProfileException("Error forwarding Shibboleth SSO request to AuthenticationManager", ex);
+ } finally {
+ httpSession.removeAttribute(LoginContext.LOGIN_CONTEXT_KEY);
}
}
protected void performAuthentication(HTTPInTransport inTransport, HTTPOutTransport outTransport)
throws ProfileException {
HttpServletRequest servletRequest = ((HttpServletRequestAdapter) inTransport).getWrappedRequest();
+ HttpSession httpSession = servletRequest.getSession();
try {
SSORequestContext requestContext = decodeRequest(inTransport, outTransport);
if (loginContext.getRequestedAuthenticationMethods().size() == 0) {
loginContext.getRequestedAuthenticationMethods().add(rpConfig.getDefaultAuthenticationMethod());
}
-
- HttpSession httpSession = servletRequest.getSession();
+
httpSession.setAttribute(Saml2LoginContext.LOGIN_CONTEXT_KEY, loginContext);
RequestDispatcher dispatcher = servletRequest.getRequestDispatcher(authenticationManagerPath);
dispatcher.forward(servletRequest, ((HttpServletResponseAdapter) outTransport).getWrappedResponse());
} catch (ServletException ex) {
log.error("Error forwarding SAML 2 AuthnRequest to AuthenticationManager", ex);
throw new ProfileException("Error forwarding SAML 2 AuthnRequest to AuthenticationManager", ex);
+ } finally {
+ httpSession.removeAttribute(LoginContext.LOGIN_CONTEXT_KEY);
}
}