0
votes

I try to bring up secure communication with our customer using oauth 2.0. first of all I have to confess that I am totally new to oauth. Used technologies are as follow: wicket, spring, I took the following steps.

  1. Add dependency in pom.xml

    <dependency>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth</artifactId>
    <version>1.0.0.M3</version>
    </dependency>

  2. Then I added the following in 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>

  3. Finally I added these lines to 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>

But I got this error:

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)
...
2
Normally means a jar problem, you sure the right jar is on the class path?drobson
this post describes a similar setup: blog.comsysto.com/2013/05/13/…Val

2 Answers

2
votes

I think you need the spring-core in your maven dependencies. Specifically version 3.1 or upwards.

0
votes

It is usually like this that when we add a dependency, It contains necessary dependencies itself. Isn't it? Cause I got so Error and I add till now many dependency but still face some new ones? Is that logical ... to add dependency till I can run the project. I have still no code inside ... just try to add OAUTH dependency!