Angularjs 会话超时后在索引页内呈现登录页
我正在尝试使用spring安全性构建一个angularjs应用程序进行授权。到目前为止,应用程序具有预期的行为。我遇到的问题是,当会话超时且用户尝试单击某个链接时,登录页面将加载到index.html中,在那里我使用ng视图呈现所有内容 当用户会话超时时,如何正确呈现登录页面 这是我的spring安全配置Angularjs 会话超时后在索引页内呈现登录页,angularjs,spring,spring-security,Angularjs,Spring,Spring Security,我正在尝试使用spring安全性构建一个angularjs应用程序进行授权。到目前为止,应用程序具有预期的行为。我遇到的问题是,当会话超时且用户尝试单击某个链接时,登录页面将加载到index.html中,在那里我使用ng视图呈现所有内容 当用户会话超时时,如何正确呈现登录页面 这是我的spring安全配置 @Override protected void configure(HttpSecurity http) throws Exception { http
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.logout()
.logoutUrl("/signout")
.logoutRequestMatcher(new AntPathRequestMatcher("/signout"))
.logoutSuccessUrl("/login")
.and()
.authorizeRequests()
.antMatchers("/resources/**", "/app.css", "/resetpassword/**","/api/user/resetpassword/**").permitAll()
.antMatchers("/testApp/**").hasRole("ADMIN")
.anyRequest().authenticated()
//Enforce HTTPS
.and().requiresChannel().anyRequest().requiresSecure()
.and()
.formLogin().loginPage("/login").defaultSuccessUrl("/").permitAll()
.and()
.rememberMe().key("testApp");
}
提前谢谢 想象你的代码似乎很难。请包含一些代码,以便这里的人可以帮助您。我不确定要添加什么代码。但我会用spring安全配置更新我的问题。我也有同样的问题。我可以解释在角度方面发生了什么。。。Angular向服务器请求部分,服务器说您未登录(302)。。。这是登录页面。。。Angular显示,当认为它是请求的部分时。。我能想到的唯一一件事是试图找出如何读取部分请求上的头响应302,并在加载登录页面之前拦截,而不是部分。我发现了这个链接,它提供了一种方法。但是我没有时间去尝试。如果有帮助,请告诉我。