2012-03-27 143 views
2

我正在使用spring-security-oauth-1.0.0.M3使用spring-security 3.0和oauth2的应用程序。它工作正常。但它似乎迁移到春季安全3.1不会是微不足道的。我一直无法确认oauth模块是否仍受支持。spring-security 3.1支持spring-security-oauth(for oauth2)吗?有参考吗?

例如,OAuth的教程中提到的3.0不是3.1:

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

而且我也碰到过类似的3月4日的一个问题,在下面的讨论2012评论时,我试图做一个直线升级至3.1使用弹簧安全的OAuth 1.0.0.M3或M4:

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的更好选择吗?

或者如果我错过了spring-security 3.1的一个基本点,那也知道这很有用。

谢谢!

+1

答案是肯定的,它是支持的。感叹,Spring Security OAuth 1.0.0.M6对于Spring Security 3.1是必需的(或者至少是足够的): http://forum.springsource.org/showthread.php?123470-Spring-Security-OAuth-1- 0-0-M6发布 这解决了上面的BeanDefinitionParsingException。 – Will 2012-03-27 21:33:26

+0

到目前为止,这看起来像最好的参考指南:https://github.com/SpringSource/spring-security-oauth/wiki/oauth2 – Will 2012-03-29 18:33:06

回答

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(而不是像1.0.0.M3之类的旧版本中的spring-security-oauth)。