Try to use request object instead of session object to bring original requested URI to the post-login action
This commit is contained in:
parent
3fdebddb7e
commit
1f3e67a975
|
@ -63,6 +63,18 @@ public class OpenIdConnectLoginFilter extends BaseFilter {
|
|||
}
|
||||
JWTTokenUtil.putOIDCInRequest(token, request);
|
||||
// The auto login class will perform the portal auto login using the token
|
||||
|
||||
// Handling original requested URI
|
||||
String redirect = (String) session.getAttribute(REDIRECT_ATTRIBUTE);
|
||||
if (redirect != null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Moving existing redirect attribute from session to the request object");
|
||||
}
|
||||
request.setAttribute(REDIRECT_ATTRIBUTE, redirect);
|
||||
session.removeAttribute(OpenIdConnectLoginFilter.REDIRECT_ATTRIBUTE);
|
||||
} else if (log.isTraceEnabled()) {
|
||||
log.trace("No redirect attribute is set in session object");
|
||||
}
|
||||
} else {
|
||||
String redirect = getRedirect(request);
|
||||
if (redirect != null) {
|
||||
|
|
|
@ -40,17 +40,18 @@ public class PostLoginAction extends Action {
|
|||
log.info("Setting OIDC token in session");
|
||||
JWTTokenUtil.putOIDCInSession(token, session);
|
||||
}
|
||||
String redirect = (String) session.getAttribute(OpenIdConnectLoginFilter.REDIRECT_ATTRIBUTE);
|
||||
String redirect = (String) request.getAttribute(OpenIdConnectLoginFilter.REDIRECT_ATTRIBUTE);
|
||||
if (redirect != null) {
|
||||
session.removeAttribute(OpenIdConnectLoginFilter.REDIRECT_ATTRIBUTE);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Redirecting to the original requested URI: " + redirect);
|
||||
}
|
||||
try {
|
||||
response.sendRedirect(URLDecoder.decode(redirect, "UTF-8"));
|
||||
} catch (IOException e) {
|
||||
new ActionException("Redirecting to original requested URI", e);
|
||||
new ActionException("Redirecting to original requested URI: " + redirect, e);
|
||||
}
|
||||
} else if (log.isTraceEnabled()) {
|
||||
log.trace("No original requested URI has been found in session");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue