Login form redirects to background image instead of correct page.

I am working with two main roles, USER and ADMIN, and this method checks for an authenticated user, and redirects to the respective pages. If it has no authentication, it should redirect to the login page

i have also made a MainRoute class which points to / and also redirects the user

public class RotaPrincipal extends VerticalLayout implements BeforeEnterObserver {

    private SecurityService securityService;

    public RotaPrincipal(SecurityService securityService) {
        this.securityService = securityService;


    public void beforeEnter(final BeforeEnterEvent event) {

        aplicarTema(); //Applies a theme i made
        MiscWebUtils.redirecionarUsuario(securityService, event); //Redirects user


None of the things you said applies to static content like the image you mentioned shown above. without an exclusion or specific handling for images/** the file is secured by default and results in the random behavior you see once the login ui is shown. You have to configure your security configuration appropriated.

so i have to make the image i use for the background public, correct?

Correct :slightly_smiling_face: that should solve that the image isn’t shown sometimes and you get redirected to it later on

I see. Thank you. I will check how to do that and come back if its not solved

Im a newbie in both vaadin, and spring security

It seems to be working now. Thanks!