Spring Security(二十三):6.5 The Default AccessDecisionManager(默认接入策略管理)

This section assumes you have some knowledge of the underlying architecture for access-control within Spring Security. If you don’t you can skip it and come back to it later, as this section is only really relevant for people who need to do some customization in order to use more than simple role-based security.

本节假定您已了解Spring Security中访问控制的基础体系结构。如果不这样做,您可以跳过它并稍后再回过头来看,因为本节仅对需要进行一些自定义以便使用简单基于角色的安全性的人员非常重要。
 
When you use a namespace configuration, a default instance of AccessDecisionManager is automatically registered for you and will be used for making access decisions for method invocations and web URL access, based on the access attributes you specify in your intercept-url and protect-pointcut declarations (and in annotations if you are using annotation secured methods).
当您使用命名空间配置时,将自动为您注册AccessDecisionManager的默认实例,并将根据您在intercept-url和protect-pointcut声明中指定的访问属性,为方法调用和Web URL访问做出访问决策。 (如果使用注释安全方法,则在注释中)。
 
The default strategy is to use an AffirmativeBased AccessDecisionManager with a RoleVoter and an AuthenticatedVoter. You can find out more about these in the chapter on authorization.
默认策略是使用具有RoleVoter和AuthenticatedVoter的AffirmativeBased AccessDecisionManager。您可以在授权章节中找到有关这些内容的更多信息。

6.5.1 Customizing the AccessDecisionManager(定制)

If you need to use a more complicated access control strategy then it is easy to set an alternative for both method and web security.

如果您需要使用更复杂的访问控制策略,那么很容易为方法和Web安全设置替代方案。
 
For method security, you do this by setting the access-decision-manager-ref attribute on global-method-security to the id of the appropriate AccessDecisionManager bean in the application context:
对于方法安全性,可以通过将global-method-security上的access-decision-manager-ref属性设置为应用程序上下文中相应AccessDecisionManager bean的id来执行此操作:
 
<global-method-security access-decision-manager-ref="myAccessDecisionManagerBean">
...
</global-method-security>

The syntax for web security is the same, but on the http element:

Web安全性的语法是相同的,但在http元素上:
 
<http access-decision-manager-ref="myAccessDecisionManagerBean">
...
</http>

  

原文地址:https://www.cnblogs.com/shuaiandjun/p/10140304.html