2016-11-10 9 views
0
http.authorizeRequests().antMatchers("/dms**").access("hasAnyRole('admin','dms')"); 

ユーザーは、そのページに移動するにはadminまたはdmsロールのいずれかが必要です。 そして、私はadminとしてログインしました。私は役割が正しく一致する(データベースの役割をして、ユーザロールでログインして)見ることができるログロールが正しく提供されているにもかかわらず、スプリングセキュリティの認可が機能しない

Granted Authorities: admin 

から

が、それでも私はアクセス拒否を見ることができます。どんな手掛かり? ここに完全なログ

2016-11-10 16:41:46 DEBUG AntPathRequestMatcher:157 - Checking match of 
request : '/dms.jsp'; against '/dms**' 
2016-11-10 16:41:46 DEBUG FilterSecurityInterceptor:219 - Secure object: FilterInvocation: URL: /dms.jsp; Attributes: [hasAnyRole('admin','dms')] 
2016-11-10 16:41:46 DEBUG FilterSecurityInterceptor:348 - Previously Authenticated: org.springframew[email protected]9546: Principal: [email protected]: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: admin; Credentials: [PROTECTED]; Authenticated: true; Details: org.sprin[email protected]ffff6a82: RemoteIpAddress: 127.0.0.1; SessionId: LVXYO0lvcLRvJFcH9pJO_kO2R5B7ha4LLm3DwZ7m; Granted Authorities: admin 
2016-11-10 16:41:46 DEBUG AffirmativeBased:66 - Voter: org.sp[email protected]7ade02ad, returned: -1 
2016-11-10 16:41:46 DEBUG ExceptionTranslationFilter:186 - Access is denied (user is not anonymous); delegating to AccessDeniedHandler 
org.springframework.security.access.AccessDeniedException: Access is denied 
    at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:84) 

答えて

1

だけで使用可能なロールに「ROLE_」を接頭辞の問題を解決しました。 なぜ春が自分の役割を許さないのかわからない

関連する問題