프로젝트 코드입니다. 우리에게 잘 작동합니다. 한 번 해봐.
보안 구성 :
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().and().authorizeRequests().antMatchers("/public/**")
.permitAll().antMatchers("/admin/**").hasAuthority("admin")
.antMatchers("/user/**").hasAuthority("user")
.and()
.logout()
// Logout requires form submit. Bypassing the same.
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/index.html").and()
.addFilterAfter(new CsrfHeaderFilter(), CsrfFilter.class)
.csrf().disable();/*
* requireCsrfProtectionMatcher(new
* CsrfRequestMatcher())
* .csrfTokenRepository(csrfTokenRepository());
*/
}
AngularJS와 :
라우팅
$scope.logout = function() {
$http.get('/logout').then(function() {
$location.url('/');
})
}
:
app.config([ '$routeProvider', function($routeProvider) {
$routeProvider.when('/admin', {
templateUrl : 'admin.html',
}).when('/dashboard', {
templateUrl : 'dashboard.html'
}).when('/preferences', {
templateUrl : 'preferences.html',
}).otherwise('/', {
templateUrl : 'index.html',
})
} ]);
안녕 레쉬 vadlakonda이 이 답변 주셔서 감사합니다, 내가 해결 밤은하지만를 사용하려고 내 문제. 제발 내 문제 설명에 넣어 github 코드 링크를 사용해 보셨습니까? 감사합니다. – user2657234