我尝试使用 oauth 2.0 与我们的客户建立安全通信。首先,我必须承认我对 oauth 完全陌生。使用的技术如下:wicket,spring,我采取了以下步骤。
在 pom.xml 中添加依赖
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth</artifactId>
<version>1.0.0.M3</version>
</dependency>然后我在 WEB-INF/web.xml 中添加了以下内容
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain </filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>最后我将这些行添加到 META-INF/spring-context/application.xml
<beans:bean id="tokenServices" class="org.springframework.security.oauth2.provider.token.InMemoryOAuth2ProviderTokenServices">
<beans:property name="supportRefreshToken" value="true" />
</beans:bean>
< oauth:provider client-details-service-ref="clientDetails" token-services-ref="tokenServices">
<oauth:verification-code user-approval-page="/oauth/confirm_access" />
</oauth:provider>
<oauth:client-details-service id="clientDetails">
<oauth:client clientId="foo" authorizedGrantTypes="authorization_code" />
</oauth:client-details-service>
但我得到了这个错误:
25 09 12 14:48:11:921:ERROR: [ContextLoader] Context initialization failed
java.lang.NoClassDefFoundError: org/springframework/core/env/ConfigurableEnvironment
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.getDeclaredConstructor(Class.java:2002)
...