I'm trying to add 2-legged oauth 1.0 to a web service. The service was functional when I started. After modifying web.xml, creating applicationContext-security.xml, and adding the necessary jars, it won't come up: Spring closes the root context immediately after it's finished initializing it.
I'm using framework version 3.0.6, security version 3.1.0, and oauth version 1.0.0.M5.
I added the following to web.xml:
applicationContext-security.xml contains the following:Code:<filter> <filter-name>filterChainProxy</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>filterChainProxy</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
and you can see the trace output Spring is producing by going to http://thombrando.com/catalina.out.Code:<?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:oauth="http://www.springframework.org/schema/security/oauth" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/security/oauth http://www.springframework.org/schema/security/spring-security-oauth-1.0.xsd"> <authentication-manager alias="authenticationManager"/> <http entry-point-ref="oAuthEntryPoint"> <intercept-url pattern="/charges/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/> <intercept-url pattern="/compliance/**" access="IS_AUTHENTICATED_FULLY"/> </http> <beans:bean id="oAuthEntryPoint" class="org.springframework.security.oauth.provider.OAuthProcessingFilterEntryPoint"/> <oauth:provider token-services-ref="tokenServices" consumer-details-service-ref="consumerDetails"/> <oauth:token-services id="tokenServices"/> <oauth:consumer-details-service id="consumerDetails"> <oauth:consumer name="mymii" key="mymii" typeOfSecret="rsa-cert" secret="/WEB-INF/keys/mymii.der" requiredToObtainAuthenticatedToken="false"/> </oauth:consumer-details-service> </beans:beans>
Spring logs 3 suspicious messages while initializing the root WebApplicationContext:
Then it tries to initialize the filterChainProxy, and that's where it fails:Code:2011-12-13 19:01:14,454 TRACE [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Ignoring constructor [public org.springframework.security.authentication.ProviderManager(java.util.List,org.springframework.security.authentication.AuthenticationManager)] of bean 'org.springframework.security.authenticationManager': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.authenticationManager': Unsatisfied dependency expressed through constructor argument with index 1 of type [org.springframework.security.authentication.AuthenticationManager]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments? ... 2011-12-13 19:01:14,569 TRACE [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Ignoring constructor [public org.springframework.security.web.session.SessionManagementFilter(org.springframework.security.web.context.SecurityContextRepository,org.springframework.security.web.authentication.session.SessionAuthenticationStrategy)] of bean '(inner bean)#6': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#6': Unsatisfied dependency expressed through constructor argument with index 1 of type [org.springframework.security.web.authentication.session.SessionAuthenticationStrategy]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments? ... 2011-12-13 19:01:14,870 TRACE [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Ignoring constructor [public org.springframework.security.web.FilterChainProxy(org.springframework.security.web.SecurityFilterChain)] of bean 'org.springframework.security.filterChainProxy': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.filterChainProxy': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.web.SecurityFilterChain]: Could not convert constructor argument value of type [java.util.ArrayList] to required type [org.springframework.security.web.SecurityFilterChain]: Failed to convert value of type 'java.util.ArrayList' to required type 'org.springframework.security.web.SecurityFilterChain'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.util.ArrayList] to required type [org.springframework.security.web.SecurityFilterChain]: no matching editors or conversion strategy found
Any help would be greatly appreciated. I've tried this with different versions of the framework, security, and oauth, with the same results.Code:2011-12-13 19:01:14,913 INFO [org.springframework.web.context.ContextLoader] - Root WebApplicationContext: initialization completed in 1608 ms 2011-12-13 19:01:14,918 DEBUG [org.springframework.web.filter.DelegatingFilterProxy] - Initializing filter 'filterChainProxy' 2011-12-13 19:01:14,922 TRACE [org.springframework.beans.factory.support.DefaultListableBeanFactory] - No bean named 'filterChainProxy' found in org.springframework.beans.factory.support.DefaultListableBeanFactory@1762fc7: defining beans [dataSource,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,org.springframework.security.filterChains,org.springframework.security.filterChainProxy,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.userDetailsServiceFactory,org.springframework.security.web.DefaultSecurityFilterChain#0,oAuthEntryPoint,oauthVerifierServices,oauthSuccessfulAuthenticationHandler,oauthRequestTokenFilter,oauthAuthenticateTokenFilter,oauthAccessTokenFilter,oauthProtectedResourceFilter,tokenServices,consumerDetails]; root of factory hierarchy 2011-12-13 19:01:14,927 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Closing Root WebApplicationContext: startup date [Tue Dec 13 19:01:13 EST 2011]; root of context hierarchy
Thanks.
Thom


Reply With Quote