【问题标题】:"Unsupported configuration attributes: [IS_AUTHENTICATED_FULLY]" when trying to configure Spring 4 / OAuth 2尝试配置 Spring 4 / OAuth 2 时出现“不支持的配置属性:[IS_AUTHENTICATED_FULLY]”
【发布时间】:2017-11-08 00:57:03
【问题描述】:

我最近升级到 Spring SEcurity 4.2.2.RELEASE,现在我的 OAuth2 配置出现问题(使用 v 2.0.7.RELEASE)。我想强制看起来像“/context-path/api/**”的 URL 需要 OAuth 访问令牌。所以我有

<http pattern="/api/**"  
              create-session="never"
              entry-point-ref="oauthAuthenticationEntryPoint"
              access-decision-manager-ref="accessDecisionManager"
              xmlns="http://www.springframework.org/schema/security">
 <anonymous enabled="false" />
 <intercept-url pattern="/**"
                         access="IS_AUTHENTICATED_FULLY"/>
 <custom-filter ref="resourceServerFilter"
                         before="PRE_AUTH_FILTER" />
 <access-denied-handler ref="oauthAccessDeniedHandler" />

但是,升级到 Spring SEcurity 4 后,我收到了这个错误...

Caused by: java.lang.IllegalArgumentException: Unsupported configuration attributes: [IS_AUTHENTICATED_FULLY]

表明用户必须完全通过身份验证才能访问我的资源的正确方法是什么?

【问题讨论】:

标签: spring spring-security oauth-2.0 spring-oauth2


【解决方案1】:

问题在于 Spring Security 4.x XML 配置默认使用表达式,而 IS_AUTHENTICATED_FULLY 不是表达式语法。使用禁用表达式 use-expressions="false" 在您的 &lt;http&gt; 标记中或将 IS_AUTHENTICATED_FULLY 替换为 fullyAuthenticated

【讨论】:

  • 这是@Rob Winch 的答案,这是正确的答案!
猜你喜欢
  • 1970-01-01
  • 2018-07-24
  • 2011-03-24
  • 2021-11-17
  • 2018-01-21
  • 2020-12-15
  • 1970-01-01
  • 2017-12-10
  • 2017-02-14
相关资源
最近更新 更多