spring-security 3.1是否支持spring-security-oauth(oauth2)?有参考吗?

时间:2012-03-27 20:32:09

标签: spring-security oauth-2.0

我正在使用spring-security-oauth-1.0.0.M3使用spring-security 3.0和oauth2的应用程序。它工作正常。但看起来迁移到spring-security 3.1看起来不会是微不足道的。我一直无法确认仍然支持oauth模块。

例如,oauth教程提到3.0而不是3.1:

https://github.com/SpringSource/spring-security-oauth/wiki/tutorial

当我尝试使用spring-security-oauth 1.0.0.M3或M4直接升级到3.1时,我遇到了类似于2012年3月4日评论的问题:

http://code.google.com/p/spring-security-social/wiki/Usage

具体来说,我在Tomcat日志中看到了这一点:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration
problem: Failed to import bean definitions from URL location ...
Offending resource: class path resource [spring/applicationContext.xml]; nested
exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected
exception parsing XML document from URL ...; nested exception is
org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class
[org.springframework.security.oauth2.config.OAuth2SecurityNamespaceHandler] for namespace
[http://www.springframework.org/schema/security/oauth2]: problem with handler class file or
dependent class; nested exception is java.lang.NoClassDefFoundError:
org/springframework/security/web/util/AntUrlPathMatcher

有人可以建议上述问题的解决方案,或指向使用spring-security 3.1和spring-security-oauth的参考,或者建议使用spring-security 3.1实现oauth2的更好的替代方案?

或者,如果我错过了弹簧安全3.1的基本要点,那么知道也是有用的。

谢谢!

1 个答案:

答案 0 :(得分:5)

是的,Spring Security OAuth里程碑版本1.0.0.M6,特别是oauth2模块,支持Spring Security 3.1.0。它尚未被视为发布。 OAuth 2.0 spec本身不是最终的。

1.0.0.M6 samples似乎是最准确,最完整的实施参考。完整的1.0.0.M6标签zipball是here

OAuth 2 Developers Guide是一个很好的文字参考。它不是100%准确,至少相对于1.0.0.M6。例如,属性user-approval-page属于授权服务器而非授权代码。

Maven pom.xml必须引用artifactId spring-security-oauth2(而不是旧版本中的spring-security-oauth,如1.0.0.M3)。