使用spring security自定義loginPage.html之后,登錄就提交后,就重新重繪登錄頁面,這個是什么問題呢?
使用的是spring boot 2.0.3 對應的 spring security 5.0.6
下面是我的代碼:
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/loginPage.html").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()//代表表單登錄
.loginPage("/loginPage.html").loginProcessingUrl("/authentication");
}
}
在沒有加入.loginPage("/loginPage.html").loginProcessingUrl("/authentication")的時候是可以正常使用默認登錄,且登錄成功會跳轉到請求路徑,加了這句代碼之后就一直登錄頁面,輸入對與錯都還是會跳到登錄頁面。
uj5u.com熱心網友回復:
csrf關了沒uj5u.com熱心網友回復:
可以看看這個:https://blog.csdn.net/pony_maggie/article/category/9058964
uj5u.com熱心網友回復:
大哥解決了嗎轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/74622.html
標籤:Web 開發
