2012-03-27 146 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)。