Home > Back-end >  Spring security custom loginPage problem
Spring security custom loginPage problem

Time:09-25

After using spring security custom loginPage. HTML, login is submitted, just to refresh the login page, what is the problem?
Using the spring boot 2.0.3 corresponding spring security 5.0.6
Here is my code:
@ Configuration
Public class SecurityConfig extends WebSecurityConfigurerAdapter {
@ Bean
Public BCryptPasswordEncoder passwordEncoder () {
Return new BCryptPasswordEncoder ();
}
@ Override
Protected void the configure (HTTP) HttpSecurity throws the Exception {
HTTP. AuthorizeRequests ()
. AntMatchers ("/loginPage. HTML "). The permitAll ()
AnyRequest (). Authenticated ()
And ()
FormLogin ()/login/on behalf of the form
LoginPage ("/loginPage. HTML "). The loginProcessingUrl ("/authentication ");
}
}

Without join. LoginPage ("/loginPage. HTML "). LoginProcessingUrl ("/authentication ") can be normal use default login, and log in successfully will jump to request path, added after the code has been login page, enter the right and wrong will jump to the login page,

CodePudding user response:

Off the CSRF didn't

CodePudding user response:

Can take a look at this:

https://blog.csdn.net/pony_maggie/article/category/9058964

CodePudding user response:

Eldest brother to solve the
  • Related