我正在尝试使用Spring安全性和AngularJS设置defaultSuccessUrl,但是在成功登录后,html页面将加载到网络中但不会显示。 这是我的安全配置
http
.authorizeRequests()
.anyRequest().authenticated().and()
.formLogin()
.loginPage("/")
.loginProcessingUrl("/")
.successHandler(this.authSuccess)
.failureHandler(this.authFailure).permitAll()
.defaultSuccessUrl("/app/components/hello.jsp", true);
http
.authorizeRequests()
.anyRequest().authenticated().and()
.logout()
.logoutSuccessHandler(this.logoutSuccess)
.deleteCookies("JSESSIONID")
.invalidateHttpSession(false).permitAll();
但是当我检查网络时,我可以看到登录的发布请求被重定向为302状态代码,Hello.jsp加载了200状态
但是我仍然显示登录页面而不是hello.jsp页面。 用于登录的角度服务:
this_.login = function(data) {
return $http.post(_contextPath + '/',
"username=" + data.username + "&password=" + data.password, {
headers : {
'Content-Type' : 'application/x-www-form-urlencoded'
}
}).success(function(response) {
return response.status;
}).error(function(response) {
return response.status;
})
};
任何人都知道为什么?