You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by camelcoder07 <dm...@hotmail.com> on 2014/10/13 21:44:21 UTC

Need help with OAuth for Camel Https Client

I am needing some help understanding how I can change a camel router from
using API key authentication to OAuth which is required by the web service. 
I currently have the below code working to the web service using API key but
I need help understanding how to make the conversion to OAuth.  I have found
a tutorial for Gauth, but must I use google for this?  

I have also been given the following additional information as to what to
call when using OAuth:
GET:
https://{API sub-domain}/ui/oauth/authorize

POST:
https://{API sub-domain}/ui/oauth/token


Any help is very much appreciated.

<?xml version="1.0" encoding="UTF-8"?>


<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

  <camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
    	   	
        <from uri="timer://foo?fixedRate=true&amp;period=60000"/>
        <setHeader headerName="CamelHttpMethod">
            <constant>POST</constant>
        </setHeader>
        <to
uri="https://api.url.com/api/v3.1/site/query/setup/?apiKey=abcd1234"/>
        <to uri="file:target/messages/testmessages"/>
    </route>
</camelContext>

</beans>



Thank you!



--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-with-OAuth-for-Camel-Https-Client-tp5757513.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help with OAuth for Camel Https Client

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 14/10/14 15:26, camelcoder07 wrote:
> Thanks for the reply.  Is it possible to do what I am doing above using cxf
> and oauth since the web service I am posting to is a REST web service?

CXF ships OAuthClientUtils which might help; it is all quite 
boilerplate, most of the client-side OAuth2 interactions can be done 
with a pure HTTP client which would either redirect or request a token 
with a form payload request...Most of the dedicated client libraries for 
working with well known providers are just thin wrappers on top of the 
plain HTTP code...It becomes more involved once signed tokens are 
introduced but for many cases it is easy enough...

Thanks, Sergey



>
> Thank you
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Need-help-with-OAuth-for-Camel-Https-Client-tp5757513p5757561.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Need help with OAuth for Camel Https Client

Posted by camelcoder07 <dm...@hotmail.com>.
Thanks for the reply.  Is it possible to do what I am doing above using cxf
and oauth since the web service I am posting to is a REST web service?

Thank you



--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-with-OAuth-for-Camel-Https-Client-tp5757513p5757561.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Need help with OAuth for Camel Https Client

Posted by Charles Moulliard <ch...@gmail.com>.
Hi,

The camel-http or camel-http4 does not yet support Oauth or Oauth2
authentication. So, for the moment, I would like to suggest that you code
yourself the client requesting the token with by example the Apache OLTU
client (
https://cwiki.apache.org/confluence/display/OLTU/OAuth+2.0+Client+Quickstart
)

Regards,

Charles

On Mon, Oct 13, 2014 at 9:44 PM, camelcoder07 <dm...@hotmail.com> wrote:

> I am needing some help understanding how I can change a camel router from
> using API key authentication to OAuth which is required by the web service.
> I currently have the below code working to the web service using API key
> but
> I need help understanding how to make the conversion to OAuth.  I have
> found
> a tutorial for Gauth, but must I use google for this?
>
> I have also been given the following additional information as to what to
> call when using OAuth:
> GET:
> https://{API sub-domain}/ui/oauth/authorize
>
> POST:
> https://{API sub-domain}/ui/oauth/token
>
>
> Any help is very much appreciated.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>            xmlns:context="http://www.springframework.org/schema/context"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>        xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>   <camelContext xmlns="http://camel.apache.org/schema/spring">
>     <route>
>
>         <from uri="timer://foo?fixedRate=true&period=60000"/>
>         <setHeader headerName="CamelHttpMethod">
>             <constant>POST</constant>
>         </setHeader>
>         <to
> uri="https://api.url.com/api/v3.1/site/query/setup/?apiKey=abcd1234"/>
>         <to uri="file:target/messages/testmessages"/>
>     </route>
> </camelContext>
>
> </beans>
>
>
>
> Thank you!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Need-help-with-OAuth-for-Camel-Https-Client-tp5757513.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io