我正在使用Spring Boot和AngularJS。我正在使用HttpBasic
进行安全。我希望将用户重定向到特定的身份验证故障或会话过期时。
我遇到的问题是浏览器在会话过期或授权用户访问受保护的资源时不断弹出身份验证对话框。
这是我的SecurityConfiguration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.httpBasic().and().authorizeRequests()
.antMatchers("/index.html", "/login.html", "/templates/forgotpassword", "/user/forgot-password", "/user/reset-password", "/reset-password/**", "/custom/**", "/app/**", "/", "/user", "/logout", "/css/**", "/api/**").permitAll()
.anyRequest().authenticated()
.and()
.csrf()
.disable();
}
http.formLogin().loginPage("/login").permitAll();
登录页Java-doc:
指定要将用户发送到需要登录的URL。如果与 WebSecurityConfigurerAdapter将生成默认登录页面 当未指定此属性时。