Custom authentication page Spring security

Asked

Viewed 188 times

1

I added the spring security dependency to my POM.XML, after which I created a new custom page for user authentication and configured webSecurityConfig to search my custom page, but when running the program he opens me the default page created by spring S itself.

My html login page is called html., so on my getMapping I put it like this:

@GetMapping("/")
    public String entrar() {
        return "entrar";
    }

(At the end, when ordering something for the application’s '/' I would like to open my custom page instead of the spring pattern)

In my configuration class Websecurityconfig did so:

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http.
            authorizeRequests()
                .anyRequest()
                .authenticated()
            .and()
            .formLogin()
                .loginPage("/entrar")
                .permitAll();
    }
}

Should spring no longer open my custom authentication page? I mean, Login.html I created? It turns out that even after having done these steps the Framework continues to open the default Spring page.

inserir a descrição da imagem aqui

Can anyone tell me if what I did wrong or if I missed something?

att;

  • Have you set up any class related to WebMvcConfigurer?

  • You noted the Websecurityconfig class with: @Configuration @Enablewebsecurity? It would be better to put the whole class here so we can help. Hug!

  • Unfortunately I could not locate the error in the application, I refiz the whole process. Fortunately it worked, thanks for the tips.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.