Closed GoogleCodeExporter closed 9 years ago
Hi!
Do you use the LogoutManager from the Extras module? Or how exactly do you
handle
logging your users out?
With the LogoutManager, you could just overwrite getNextPath() to return some
URL, or
pass the URL as _to parameter, like: j_security_exit?_to=/path/to/front.html
If you are using your own authenticator, you could call
manager.forward(request,
"/path/to/front.html") right before returning ManageAction.Clear.
Does this fix your problem?
:-)
Original comment by aike.som...@gmail.com
on 5 Mar 2010 at 3:46
Thanks for the suggestion, but I think this would only solve my problem
partially
because it will work on logout only. What if the user goes straight to the
login page
without trying to access a restricted resource? Then there is no
REQUEST_PATH_NOTE
set and I get IllegalStateException for redirecting to null.
Original comment by sash...@gmail.com
on 6 Mar 2010 at 1:49
Here's an example of what that method might look like:
public void setPathForRequest(AuthenticationRequest request, String path){
String reqPath = path;
String reqQuery = null;
if(path != null && path.contains("?")){
String[] qs = path.split("?");
reqPath = qs[0];
reqQuery = qs[1];
}
session(request).put(REQUEST_PATH_NOTE, reqPath);
session(request).put(REQUEST_CONTEXT_NOTE,
request.getHttpServletRequest().getContextPath());
session(request).put(REQUEST_QUERY_NOTE, reqQuery);
}
Original comment by sash...@gmail.com
on 6 Mar 2010 at 5:19
I just committed a change to the FormAuthenticator which allows to specify a
default
page in case there is no original request. I believe it's the better place for
such a
change as the desired behavior is likely to change for other types of
authentication.
You can simply overwrite getNextPath() to specify this. I do have some more
changes in
this regard planned, but that will have to wait since it involes some
api-changes.
I hope this helps!
:-)
Original comment by aike.som...@gmail.com
on 7 Mar 2010 at 12:52
Thank you!
This works great! No need for me to set REQUEST_PATH_NOTE anymore.
Regards,
Alex
Original comment by sash...@gmail.com
on 8 Mar 2010 at 2:34
Original issue reported on code.google.com by
sash...@gmail.com
on 4 Mar 2010 at 7:08