Hi

On 27/11/12 14:01, Lekkie wrote:
Hi,

I was wondering if anyone can show me or point me where I can see a sample
implementation of OAuth2 Client Credentails.

I've updated the documentation recently a bit:

http://cxf.apache.org/docs/jax-rs-oauth2.html#JAX-RSOAuth2-ClientCredentials, please also check the info on the use of refresh token grant

Given that this should work end to end the same way as with the authorization code flow, except that the redirection part required to get the code grant is not needed in this case, probably the simplest way to 'demo' it is to modify the demo at

https://github.com/Talend/tesb-rt-se/tree/master/examples/cxf/jaxrs-oauth2 a bit, and specifically RestaurantReservationService code where it redirects the user and then gets back the code and exchanges it for the access token, instead, instead of doing all the redirection, immediately use AccesstokenService WebClient and OAuthClientUtils to request an access token based on the client credentials grant, and that should do it...

One more thing, ClientCredentialsGrant helper has been added to the trunk recently so in meantime you can create a basic custom AccessTokenGrant impl to be used with OAuthClientUtils

Let me know please if if you have more questions

HTH, Sergey


Thanks.



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-RS-OAuth2-for-Client-Credentials-tp5719212.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to