I'm still very new to STS and OAUTH both, but I'm running into a problem here that I can't find documentation on. I'm pretty sure it's a configuration issue, but I haven't found a good example yet.
I've setup the OAUTH 1.0a SPARKLR/TONR example from [OAuth 1.0.0.RC1] on APACHE 6.0 with a 2 Legged Fetch example as suggested by this blog:
http://bmocanu.ro/coding/409/client-...ring-security/
I've got the example working with standard form post variables. My problem lies within making a post where the OAUTH variables are contained within the HTTP header (our 3rd party client is sending them that way). The same post works fine on POJO Google OAUTH code.
The problem I'm running into is that as the post goes through the Spring filters I get the following message:Code:OAuth realm="http://localhost:8080/sparklr/photos?format=json",oauth_consumer_key="tonr-consumer-key",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1344436362",oauth_nonce="3838847075661",oauth_version="1.0",oauth_signature="s1LT1WHMLjfEF4oaVc59Sam591Q%3D"
Response realm name {0} does not match system realm name of {1}
Code:[DEBUG] FilterChainProxy - /photos?format=json at position 13 of 14 in additional filter chain; firing Filter: 'ProtectedResourceProcessingFilter' [DEBUG] ProtectedResourceProcessingFilter - OAuth parameters parsed: oauth_signature=Xs/zXES7LH5Ms2OV/fKl6Sf5mNI= realm=http://localhost:8080/sparklr/photos?format=json oauth_nonce=1907532289857 oauth_version=1.0 oauth_consumer_key=tonr-consumer-key oauth_signature_method=HMAC-SHA1 oauth_timestamp=1344434430 [DEBUG] ProtectedResourceProcessingFilter - Consumer details loaded for tonr-consumer-key: org.springframework.security.oauth.provider.BaseConsumerDetails@424c2849 [DEBUG] ProtectedResourceProcessingFilter - org.springframework.security.oauth.provider.InvalidOAuthParametersException: Response realm name {0} does not match system realm name of {1} [DEBUG] HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession. [DEBUG] ExceptionTranslationFilter - Chain processed normally
The OAUTH headers are all parsed correctly, but the [realmName] for the [ProtectedResourceProcessingFilter] is NULL.
If I then add the following to the SPRING-SERVLET.XML
The [realmName] is no longer NULL, but I get the following error:Code:... <bean id="ProtectedResourceProcessingFilter" class="org.springframework.security.oauth.provider.filter.ProtectedResourceProcessingFilter"> <property name="authenticationEntryPoint" ref="OAuthProcessingFilterEntryPoint"/> <property name="allowAllMethods" value="true"/> </bean> <bean id="OAuthProcessingFilterEntryPoint" class="org.springframework.security.oauth.provider.OAuthProcessingFilterEntryPoint"> <property name="realmName" value="sparklr" /> </bean> ...
Any help is appreciated, and please let me know if you need additional information.Code:[ERROR] DispatcherServlet - Context initialization failed <org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ProtectedResourceProcessingFilter' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: A consumer details service is required.>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ProtectedResourceProcessingFilter' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: A consumer details service is required.
FULL applicationContext.xml
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"> <http auto-config='true' access-denied-page="/login.jsp" realm="sparklr"> <intercept-url pattern="/xml/photos" access="ROLE_USER" /> <intercept-url pattern="/json/photos" access="ROLE_USER" /> <intercept-url pattern="/photo/**" access="ROLE_USER" /> <intercept-url pattern="/oauth/**" access="ROLE_USER" /> <intercept-url pattern="/request_token_authorized.jsp" access="ROLE_USER" /> <intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <form-login authentication-failure-url="/login.jsp" default-target-url="/index.jsp" login-page="/login.jsp" login-processing-url="/login.do"/> <logout logout-success-url="/index.jsp" logout-url="/logout.do"/> </http> <authentication-manager> <authentication-provider> <user-service id="userDetailsService"> <user name="marissa" password="koala" authorities="ROLE_USER" /> <user name="paul" password="emu" authorities="ROLE_USER" /> </user-service> </authentication-provider> </authentication-manager> <oauth:provider consumer-details-service-ref="consumerDetails" token-services-ref="tokenServices" request-token-url="/oauth/request_token" authenticate-token-url="/oauth/authorize" user-approval-url="/oauth/confirm_access" access-granted-url="/request_token_authorized.jsp" access-token-url="/oauth/access_token" require10a="false" /> <oauth:consumer-details-service id="consumerDetails"> <oauth:consumer name="Tonr.com" key="tonr-consumer-key" secret="SHHHHH!!!!!!!!!!" resourceName="Your Photos" resourceDescription="Your photos that you have uploaded to sparklr.com." requiredToObtainAuthenticatedToken="false" authorities="ROLE_CONSUMER" /> <oauth:consumer name="iGoogle" key="www.google.com" secret="classpath:/org/springframework/security/oauth/examples/sparklr/certs/igoogle.cert" typeOfSecret="rsa-cert" resourceName="Your Photos" resourceDescription="Your photos that you have uploaded to sparklr.com."/> </oauth:consumer-details-service> <oauth:token-services id="tokenServices"/> </beans:beans>


Reply With Quote