PDA

View Full Version : How to use "oauth:consumer-details-service" element?



davidshen84
Nov 21st, 2011, 01:28 AM
Hi,

I read the https://github.com/SpringSource/spring-security-oauth/wiki/oauth1 Wiki page. It does not explain the relationships of the elements.

I have experience with OAuth, and I have used the
org.springframework.security.oauth.consumer.client .CoreOAuthConsumerSupport class to make access Twitter service. Now I want to use more configurations in my application.

E.g.
I have defined:


<oauth:consumer-details-service id="twitterSvc">
<oauth:consumer name="twitter.com" key="k" secret="s">
<oauth:url pattern="http://twitter.com" resources="statuses/hometimeline" />
</oauth:consumer>
</oauth:consumer-details-service>


How do I define/provide the access token? How do I get an actual class to access the service?

Dave Syer
Nov 21st, 2011, 02:22 AM
I think to implement a consumer you need to use <oauth:resource/> and OAuth2RestTemplate (not <oauth:consumer/>, which I believe is defining a consumer registration with a provider). Look at the tonr sample for hints (https://github.com/SpringSource/spring-security-oauth/tree/master/samples/oauth/tonr/src/main/webapp/WEB-INF).