【发布时间】:2018-09-08 15:27:39
【问题描述】:
我正在使用 Spring Boot 和 Angularjs。我使用HttpBasic 来保证安全。我希望在身份验证失败或会话过期时将用户重定向到特定的 url。
我遇到的问题是,当会话过期或授权用户访问受保护的资源时,浏览器会不断弹出身份验证对话框。
这是我的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();
}
【问题讨论】:
标签: java angularjs spring-boot spring-security basic-authentication