@確保すAccessDeniedExceptionが役割を正しく
-
22-07-2019 - |
質問
後解決すべての 認証関連の問題 初めての春のweb出願受んでしまうのだと許可が必要になります。
設定を使用 @Secured
注釈には率直なものとは思わない失敗してしまいました。また私が使っているアクティブディレクトリを使用LDAP認証プロバイダおよび役割分担を行いながらによる広告グループような問題になります。
この概要は私の問題:
- 無担保動 作
- 行動を
@Secured("IS_AUTHENTICATED_FULLY")
作 - 行使のようなもの
@Secured("GROUP_*")
働いていない
呼び出し時にアクションを確保 org.springframework.security.AccessDeniedException
スローされます。こちらの抜粋からのログ:
DEBUG: org.springframework.security.intercept.AbstractSecurityInterceptor - Secure object: ReflectiveMethodInvocation: public org.springframework.web.servlet.ModelAndView de.dillinger.resources.controllers.HostsController.index(); target is of class [de.dillinger.resources.controllers.HostsController]; ConfigAttributes: [GROUP_IT]
DEBUG: org.springframework.security.intercept.AbstractSecurityInterceptor - Previously Authenticated: org.springframework.security.providers.UsernamePasswordAuthenticationToken@2a5333d9: Principal: org.springframework.security.userdetails.ldap.Person@1422384: Username: di32001; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: GROUP_ITS, GROUP_ITS-IT, GROUP_INTERNET, GROUP_SYSTEMGRUPPE, GROUP_IT; Password: [PROTECTED]; Authenticated: true; Details: org.springframework.security.ui.WebAuthenticationDetails@0: RemoteIpAddress: 127.0.0.1; SessionId: 773943FFB14E512872BB6CE25F46C00A; Granted Authorities: GROUP_ITS, GROUP_ITS-IT, GROUP_INTERNET, GROUP_SYSTEMGRUPPE, GROUP_IT
ご覧のとおり行動しを要求する GROUP_IT
役割と私のユーザオブジェクトは、この特性です。全然わかんないべきだと思います。
解決
を使用していま org.springframework.security.access.vote.UnanimousBased
有権者の役割?に変更してみてくださいま org.springframework.security.access.vote.AffirmativeBased
.
このような問題が関連する有権者の役割を設定します。
編集1例を追加):
<security:global-method-security
secured-annotations="enabled"
access-decision-manager-ref="accessDecisionManager"
/>
<bean
id="accessDecisionManager"
class="org.springframework.security.access.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions" value="false" />
<property name="decisionVoters">
<list>
<bean id="roleVoter" class="org.springframework.security.access.vote.RoleVoter" />
</list>
</property>
</bean>
所属していません StackOverflow