【问题标题】:Criteria based authorization check with spring security?使用弹簧安全性进行基于标准的授权检查?
【发布时间】:2011-07-12 03:30:33
【问题描述】:

spring security 如何支持动态角色和权限?例如,最终用户可以在运行时生成角色。每个角色可以包含多个可以在运行时创建/更新的权限。如果 3 个月没有活动,则每个权限都基于删除主题等标准。 spring security 的 ACL 不能支持它,因为 acl_entry 的记录是静态的而不是动态的。如何自定义spring security来支持这样的需求?

【问题讨论】:

    标签: spring spring-security


    【解决方案1】:

    Spring Security 3 支持expression based authorization:它允许您将安全约束表达为Spring Expression Language 中的任意表达式。默认情况下,您可以在这些表达式中使用SecurityExpressionRoot 的方法。

    但是,您可以通过自定义MethodSecurityExpressionHandler.createEvaluationContext() 添加自己的方法,这样您就可以定义任意条件并在这些表达式中使用它们。另见What's the difference between @Secured and @PreAuthorize in spring secu 3?.

    【讨论】:

      猜你喜欢
      • 2013-07-16
      • 2017-07-21
      • 2015-04-19
      • 2012-07-24
      • 2015-01-09
      • 2016-01-02
      • 2011-05-16
      • 2020-11-29
      • 1970-01-01
      相关资源
      最近更新 更多