form based login, possible with Vaadin?

Hi,

I have a Vaadin application with has FORM-based login. The login form is currently an plain HTML file, which I want to replace with a Vaadin UI.
I wrote the Class, see below. In the web.xml, I have:


FORM
User Authentication

/vauth/login
/vauth/login?success=false


When calling the new login-form directly the Loginform is displayed correctly. However, when being called in the containers login process, Vaadin is not booted, no Loginform is displayed. I made the “/VAADIN” directory available without login.
Whats worng? Has anyone made successful FORM-based login with a Vaadin form?

regards,
Arno



FORM
User Authentication

/vauth/login
/vauth/login?success=false


[font=Courier New]
public class VAuthUI extends UI {

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField("email:");
    final PasswordField pwd = new PasswordField("pwd:");

    Button button = new Button("login");
    button.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            String loginurl = String.format("j_security_check?j_username=%s&j_password=%s", name.getValue(),
                    pwd.getValue());
            getPage().setLocation(loginurl);
        }
    });

    layout.addComponents(name, pwd, button);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

@WebServlet(urlPatterns = "/vauth/*", name = "VAuthUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = VAuthUI.class, productionMode = false)
public static class VAuthUIServlet extends VaadinServlet {
}

}
[/font]

Hello, there’s a good article about JAAS and Vaadin
in the docs
. There’s also a couple of example projects in git, like
this one
, that you can take a look. At the
README.md
of the referred git project there are other useful references too. Hope it helps!