【问题标题】:Difference between WebExpressionVoter and AuthenticatedVoter in spring securitySpring Security 中 WebExpressionVoter 和 AuthenticatedVoter 的区别
【发布时间】:2016-08-26 19:44:42
【问题描述】:

Spring Security 中的 WebExpressionVoter 和 AuthenticatedVoter 有什么区别?我所知道的是 AuthenticatedVoter 将搜索字符串 IS_AUTHENTICATED_FULLY、IS_AUTHENTICATED_ANONYMOUSLY、IS_AUTHENTICATED_REMEMBERED (cookie) 并在相应情况下投票赞成。但我不确定 WebExpressionVoter 甚至在阅读可用的春季文档之后。请任何人向我解释一下 WebExpressionVoter。提前致谢。

【问题讨论】:

    标签: spring-security


    【解决方案1】:

    看看Web Security Expressions

    WebExpressionsVoterhttp 元素配置上的 use-expressions="true" 设置启用。例如:

    <http use-expressions="true"> <intercept-url pattern="/admin*" access="hasRole('admin')"/> ... </http>

    以上示例允许您在intercept-url 元素属性access 中使用SpEL 表达式。表达式 hasRole('admin') 表达式针对表达式根对象进行评估,例如,SecurityExpressionRoot 的基类 -> WebSecurityExpressionRoot

    【讨论】:

      猜你喜欢
      • 2013-10-31
      • 2019-04-18
      • 2018-01-18
      • 2011-09-11
      • 2014-09-16
      • 2015-09-11
      相关资源
      最近更新 更多