<div dir="ltr">Hi,<div>That sounds good !</div><div>Just one question, instead of using the callApi function couldn&#39;t we pass the oauth module (called &#39;thing&#39; in your example) to the pipe directly, using the &#39;authenticator&#39; setting. Behind the scene, the pipe manager will append the oauth token to the query or add the bearer header ?</div>
<div>Seb</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 26, 2013 at 8:05 PM, Lucas Holmquist <span dir="ltr">&lt;<a href="mailto:lholmqui@redhat.com" target="_blank">lholmqui@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><h2 style="font-weight:normal;color:rgb(17,17,17);line-height:1em;font-size:2em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:silver;padding-bottom:5px;font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif">
OAuth2 AeroGear Workflow - High Level</h2><h3 style="font-weight:normal;color:rgb(17,17,17);line-height:24px;font-size:1.5em;font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif">
Using Google api&#39;s</h3><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
<em>Server Side</em></p><ol style="margin:1em 0px;padding:0px 0px 0px 2em;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
<li>user needs to first create an &quot;application/project&quot; to get an api key</li><li>Then they would choose the services/api&#39;s then would like there application to access</li><li>other google server related items....</li>
</ol><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px"><em>Client Side</em></p>
<ol style="margin:1em 0px;padding:0px 0px 0px 2em;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
<li>Create a new OAuth2 module thing</li><li>Get access token for the services would need to specify the services they would like to access</li><li>validate the token</li><li>make calls to the service</li></ol><h3 style="font-weight:normal;color:rgb(17,17,17);line-height:24px;font-size:1.5em;font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif">
API</h3><pre style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);white-space:pre-wrap;word-wrap:break-word;padding:5px 12px;line-height:24px">
<code style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px!important;padding:0px">var thing = AerGear.OAuth2({
                name: googleEndPoints, //Just a Name
                clientID: &quot;12345&quot; //The client ID of the app from the API console
                settings: {
                    permissions: &quot;..&quot;,
                    ...
                }
            }).somecoolmodulename.googleEndPoints;
</code></pre><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
<em>Settings: Multiple settings based on paramters <a href="https://developers.google.com/accounts/docs/OAuth2UserAgent" style="color:rgb(11,0,128);text-decoration:none" target="_blank">here</a></em></p><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
<em>Methods</em></p><h3 style="font-weight:normal;color:rgb(17,17,17);line-height:24px;font-size:1.5em;font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif">
authenticate</h3><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
this will authenticate with the server to get the access token and then validate the token, once that is all good then the response is returned.</p><pre style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);white-space:pre-wrap;word-wrap:break-word;padding:5px 12px;line-height:24px">
<code style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px!important;padding:0px">thing.authenticate({
    success:{},
    error:{},
    settings: {
        //probably some settings here, like URL overides and such
    }
});
</code></pre><h3 style="font-weight:normal;color:rgb(17,17,17);line-height:24px;font-size:1.5em;font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif">
callApi</h3><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
not really a good name, but it would basically call the remote api/services. we could either do a query string option or a Head option</p><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
example:</p><pre style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);white-space:pre-wrap;word-wrap:break-word;padding:5px 12px;line-height:24px">
<code style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px!important;padding:0px">curl &#39;<a href="https://www.googleapis.com/oauth2/v1/userinfo?access_token=1/fFBGRNJru1FQd44AzqT3Zg&#39;" target="_blank">https://www.googleapis.com/oauth2/v1/userinfo?access_token=1/fFBGRNJru1FQd44AzqT3Zg&#39;</a>
</code></pre><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
or</p><pre style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);white-space:pre-wrap;word-wrap:break-word;padding:5px 12px;line-height:24px">
<code style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px!important;padding:0px">curl -H &quot;Authorization: Bearer {accessToken}&quot; <a href="https://www.googleapis.com/oauth2/v1/userinfo" target="_blank">https://www.googleapis.com/oauth2/v1/userinfo</a>
</code></pre><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
code:</p><pre style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);white-space:pre-wrap;word-wrap:break-word;padding:5px 12px;line-height:24px">
<code style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px!important;padding:0px">thing.callApi({
    service: &quot;userinfo&quot;, //don&#39;t really like this name either
    success:{},
    error:{},
    settings: {
        ... //overridable baseURLs?
    }
});
</code></pre><h3 style="font-weight:normal;color:rgb(17,17,17);line-height:24px;font-size:1.5em;font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif">
revoke</h3><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
again, maybe not the best name. calls the &quot;revoke&quot; service, to remove access to permissions</p><pre style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);white-space:pre-wrap;word-wrap:break-word;padding:5px 12px;line-height:24px">
<code style="font-size:0.88em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:0px!important;padding:0px">thing.revoke({
    success: {},
    error: {},
    settings: {}
});
</code></pre><p style="margin:1em 0px;color:rgb(68,68,68);font-family:Georgia,Palatino,&#39;Palatino Linotype&#39;,Times,&#39;Times New Roman&#39;,&#39;Hiragino Sans GB&#39;,STXihei,微软雅黑,serif;font-size:16px;line-height:24px">
Behind the scenes on all these calls, the &quot;access_token&quot; is beining used and possibly refreshed for the user, so they don&#39;t have to worry about it. They just need to call authenticate first. Maybe we can have a refresh method if the user wants to refresh the tokens themselves. this would do the token &quot;dance&quot;</p>
</div><div><br></div><br><div><div><div class="h5"><div>On Aug 26, 2013, at 1:35 PM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt; wrote:</div><br></div></div><blockquote type="cite">
<div><div class="h5">+1 I think is a good start to us.<br><br>Kris Borchers wrote:<br><blockquote type="cite">I would like to see that but what you are saying makes sense. It sounds like where I was headed with the Basic and Digest adapters before I ran into browser security issues with headers. I think and authorization API that basically just wraps itself around secured endpoints works for me.<br>
</blockquote><br>-- <br>abstractj<br><br><br></div></div><div class="im">_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div></blockquote></div><br></div><br>_______________________________________________<br>

aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br></div>