Hi again!
Quick (and dirty?) overriding newWebRequest seems to do the job.
If I've created a big problem for myself please let me know. ;-)
The solution doesn't have to be secure, just work. It's for a demo
where login is handled by another application anyway.
Regards
Christian
@Override
public WebRequest newWebRequest(HttpServletRequest servletRequest, String
filterPath) {
try {
String uname = servletRequest.getParameter("user");
if (uname != null) {
servletRequest.getSession().invalidate();
}
} catch (Exception e) {
}
WebRequest request = super.newWebRequest(servletRequest, filterPath);
return request;
}
________________________________________
From: Christian Steinebach [[email protected]]
Sent: Friday, May 31, 2013 2:02 PM
To: [email protected]
Subject: automatic login using url?
Hi all!
I wanted to login using url parameters, something like:
http://localhost://MyIsisApplication?user=erik&pass=pass
should log in as user erik with password pass.
I seem to have managed to find a solution, just override the newSession method
in the application class:
public class MyIsisApplication extends IsisWicketApplication {
@Override
public Session newSession(final Request request, final Response response) {
AuthenticatedWebSessionForIsis s = (AuthenticatedWebSessionForIsis)
super.newSession(request, response);
StringValue user =
request.getRequestParameters().getParameterValue("user");
StringValue password =
request.getRequestParameters().getParameterValue("pass");
s.signIn(user.toString(), "pass");
return s;
So far, it seems to work, the only problem i have is when trying to log in with
a different user
before the session has timed out.
Has anybody a hint, where (and how) I should switch the user when called with a
different user name?
Any help very much appreciated
Christian