Sorry Anita, I meant to specify the "jetty" component, although you will likely 
need the "gauth" as well.

On Oct 10, 2011, at 3:02 PM, Brian Topping wrote:

> I see, I didn't realize you were going exactly from the example.  
> 
> I ran into a couple of problems.  One was the accessibility of a java 
> keystore file and setting up the password.  This was required for the HTTPS 
> component of the Jetty server to function. That's not documented in this 
> example page, and it did not seem to work to provide a non SSL address so the 
> keystore was not required.
> 
> Please take a look at my routes.xml here and see if you can use the SSL setup 
> in order to resolve that part first by adding the "gauth" bean configuration 
> I have to your configuration.  If you still have problems, please provide 
> some stack traces for further analysis.example
> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> 
>> <beans xmlns="http://www.springframework.org/schema/beans"; 
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>       xmlns:cxf="http://camel.apache.org/schema/cxf"; 
>> xmlns:osgi="http://www.springframework.org/schema/osgi";
>>       xsi:schemaLocation="http://www.springframework.org/schema/beans 
>> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>>                           http://camel.apache.org/schema/spring 
>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>                           http://camel.apache.org/schema/cxf 
>> http://camel.apache.org/schema/cxf/camel-cxf.xsd
>>                           http://www.springframework.org/schema/osgi 
>> http://www.springframework.org/schema/osgi/spring-osgi.xsd";>
>> 
>>    <cxf:rsServer id="rsServer" address="http://0.0.0.0:9090/batch";
>>                  
>> serviceClass="net.example.component.sample.dbtest.ControllerService"/>
>> 
>>    <camelContext xmlns="http://camel.apache.org/schema/spring";>
>>        <route id="control">
>>            <from uri="cxfrs:bean:rsServer"/>
>>            <to uri="log:net.example.controller.sample"/>
>>            <bean ref="controllerBean" method="doSomething"/>
>>        </route>
>>        <route id="youtubeOauth">
>>            <!--Route 1: A GET request to http://gauth.example.org/authorize 
>> will trigger the the OAuth-->
>>            <!--sequence of interactions. The gauth:authorize endpoint 
>> obtains an unauthorized request-->
>>            <!--token from Google and then redirects the user (browser) to a 
>> Google authorization page.            -->
>>            <from uri="jetty:https://0.0.0.0:8980/authorize"/>
>>            <to 
>> uri="gauth:authorize?callback=https://localhost:8980/handler&amp;scope=http://gdata.youtube.com"/>
>>        </route>
>>        <route id="youtubeUpgrade">
>>            <!--Route 2: Handle callback from Google. After the user granted 
>> access to Google Calendar-->
>>            <!--Google redirects the user to 
>> https://gauth.example.org:8443/handler (see callback) along-->
>>            <!--with an authorized request token. The gauth:access endpoint 
>> exchanges the authorized-->
>>            <!--request token against a long-lived access token.-->
>>            <from 
>> uri="jetty:https://0.0.0.0:8980/handler?sslKeyPassword=changeit"/>
>>            <to uri="gauth:upgrade"/>
>>            <process ref="oauthProcessBean"/>
>>        </route>
>>    </camelContext>
>> 
>>    <bean id="gauth" 
>> class="org.apache.camel.component.gae.auth.GAuthComponent">
>>        <!-- Google will display a warning message on the authorization page 
>> -->
>>        <property name="consumerKey" value="anonymous" />
>>        <property name="consumerSecret" value="anonymous" />
>>    </bean>
>> 
>> 
>>    <bean id="jetty" 
>> class="org.apache.camel.component.jetty.JettyHttpComponent">
>>        <property name="sslSocketConnectorProperties">
>>            <props>
>>                <prop key="password">changeit</prop>
>>                <prop key="keyPassword">changeit</prop>
>>                <property name="keystore" value="/home/topping/keystore"/>
>>            </props>
>>        </property>
>>    </bean>
>> 
>>    <bean id="controllerBean" 
>> class="net.example.component.sample.dbtest.TestBean">
>>        <property name="partyDao">
>>            <osgi:reference interface="net.example.component.dao.PartyDao"/>
>>        </property>
>>    </bean>
>> 
>>    <bean id="oauthProcessBean" 
>> class="net.example.component.sample.dbtest.OauthProcessorBean"/>
>> </beans>
>> 
>> 
> 
> 
> 
> On Oct 10, 2011, at 2:05 PM, AnitaJ wrote:
> 
>> Hi Brian,
>> 
>> The route is in the TutorialRouteBuilder class in this link: 
>> http://camel.apache.org/tutorial-oauth.html Camel OAuth tutorial 
>> 
>> <snip>
>> 
>> // Callback URL for sending back an authorized access token.
>> String encodedCallback =
>> URLEncoder.encode(String.format("https://%s.appspot.com/camel/handler";,
>> application), "UTF-8");
>> 
>> // Google should issue an access token that is scoped to calendar feeds.
>> String encodedScope =
>> URLEncoder.encode("http://www.google.com/calendar/feeds/";, "UTF-8");
>> 
>> // Route for obtaining an unauthorized request token from Google Accounts.
>> The
>> // response redirects the browser to an authorization page provided by
>> Google.
>> from("ghttp:///authorize";)
>>           .to("gauth:authorize?callback=" + encodedCallback + "&scope=" +
>> encodedScope);
>> 
>> </snip>
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Need-help-with-Camel-OAuth-tp4888875p4889066.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> 
> 
> 

Reply via email to