spring security login button

Hi!
I’m trying to use spring security in my application. But as I suppose, I have to do http POST “/login” request to create user session. How to create click listener for vaadin Button?
Should I find how to create http post request or use some spring mechanism to process login?

Hi,

if you look at the [Full Stack Spring Starter]
(https://vaadin.com/start/v10-full-stack-spring), you’ll find an example of this.

-Olli

Hi,
full stack spring starter uses iron-form component with submit and so on…
is there any way to do it in vaadin8 style? or this way is wrong?

By Vaadin 8 style, do you mean the way it’s done in the [V8 Spring full-stack starter]
(https://vaadin.com/start/v8-full-stack-spring)? Because it’s more or less the same (although without web components).

-Olli

No, I mean not use any html code )))
V8 full-stack starter uses html page with form

for examlpe:

Button loginBtn = new Button("Login", this::performLogin);

The form-based way is the recommended approach, as it’ll cover the application on a higher level (you won’t accidentally leave unauthenticated routes available, for example). I assume you could adapt [this form-less style]
(https://examples.javacodegeeks.com/enterprise-java/vaadin/vaadin-spring-security-example/ ) to Vaadin 10 as well, though, but it’ll take some tweaking.

Thanks Olli!

Hey,

there is a new tutorial about it: https://vaadin.com/tutorials/securing-your-app-with-spring-security

Might help you even if you’ve solved your issue already. And, I would love to get some feedback.

Cheers,
Paul