最近在使用springsecurity时,发生了以下问题
1、 anyRequest ().authenticated; http.forml ogin (.logi npage (/log in.html ).loginprocessingurl/API/private/log in ).defaultsucccessuure我们这是
. anyRequest ().authenticated )意味着任何请求都需要登录认证,如果跳转到/login.html,则login.html也是请求,因此login.html
所以就造成了无限循环进行重定向。
http.forml ogin (.logi npage (/log in.html ).loginprocessingurl/API/private/log in ).defaultsucccessure.ant . and ().csrf ) ).disable ); 的. and ().csrf ) ).disable ); CRF (伪造跨网站请求)也可以理解为防火墙; 否则,健康耳机登录时,重定向次数不会太多,但会返回login.html页面
当然,也有其他情况下重定向次数过多,但本质上是访问login.html,让login.html进行认证,结果陷入访问死循环