I’m trying to implement a Login into my VaadinApp. I Use your standard Login-Form. Here’s a Codesnippet from within my Vaadin Application Class.
init(){
...
final LoginForm login = new LoginForm();
login.setWidth("-1px");
login.addListener(new LoginForm.LoginListener() {
public void onLogin(LoginForm.LoginEvent event) {
String pw = event.getLoginParameter("password");
String username = event.getLoginParameter("username");
try {
authenticate(username, pw);
login.setComponentError(null);
} catch (Exception e) {
login.setComponentError(new UserError("Bad username or password"));
}
}
});
...
}
public void authenticate( String login, String password) throws Exception
{
UserAccount user = userManager.findUser(login);
if (user != null && password.equals(user.getPassword())){
loadProtectedResources();
return;
}
throw new Exception("bad username or password!");
}
Now the weird thing:
Whenever i try to login, i get a Session Expiration. I’ve read that another guy had a similar problem and solved it by installing Sessionguard, that hasn’t done the trick for me. I’ve been able to do a dirty workaround so that login works anyway, but this big red box is highly annoying, so I was hoping somebody might be able to help a little bit here.
Greetings, Sascha.