In my vaadin application, I'm trying to create a login form. If I use default login form provided by vaadin framework. I can set the posting of the user entered data via .setAction() method to spring security.
private LoginForm login = new LoginForm();
public Login(){
addClassName("login-view");
setSizeFull();
setAlignItems(Alignment.CENTER);
setJustifyContentMode(JustifyContentMode.CENTER);
**login.setAction("login");**
add(new H1("Vaadin CRM"), login);
}
However, I don't want to use this login form, rather use the custom designed form created by horizontal layout or whatever. Problem is, any of these components or layouts don't have this .setAction() method where I can submit the data post to "login" location. I also couldn't find solution or source about this on their website. Because of this, spring security doesn't retrieve these username password data. How can I overcome this problem? Thanks in advance.
You'll need a client-side
<form>
element in order to have a formaction
. If you look at how thevaadin-login-form
is implemented, you can see the<form>
element here: https://github.com/vaadin/vaadin-login/blob/master/src/vaadin-login-form.html#L23-L36Probably the easiest way to have a custom login form that submits a form action would be to create a similar custom web component as
vaadin-login-form
and bind it to the server using aPolymerTemplate
. If you want to stick to server-side Java, you could also try if a server sideElement
with the tagform
does the trick.