Correct way to login a user programmatically to a Vaadin App on Spring Boot Security?

first all Spring security is wrapped under com.vaadin.flow.spring.security.* so have a look there

this is a small ‘simple’ login form , but you can use any way you want to implement

in this example any username and password are automatilcy being created as user

hope it will give you the direction you need

The user details or user class are not with Vaadin Context but with spring context , either create a bridge to pass it , or use spring boot authenticated user.
@rolesAllowed are working any way.

@charming-frog , thank you for the suggestion!

@observant-quetzal just came with this addon :

https://vaadin.com/directory/component/spring-boot-security-for-vaadin

does what you need

Do you know if this supports custom authentication filters too?

The trick is here: VaadinSession.getCurrent().getSession().setAttribute(“SPRING_SECURITY_CONTEXT”, securityContext);

After this, the user is fully logged in, and the protetected routes are also accessible. The next requests maintain the authentication.

To logout, just call VaadinSession.getCurrent().getSession().invalidate();

As I wrote in other posts… probably some trick, well done @kind-goat