<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">i've hacked together a sample app that shows sort of the flow.<div><br></div><div><a href="https://github.com/lholmquist/oauth2test">https://github.com/lholmquist/oauth2test</a></div><div><br></div><div>it is still very rough</div><div><br><div><div>On Aug 27, 2013, at 12:42 PM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">+1 keep it simple, please<br><br>Lucas Holmquist wrote:<br><blockquote type="cite"><br>On Aug 27, 2013, at 3:39 AM, Sebastien Blanc &lt;<a href="mailto:scm.blanc@gmail.com">scm.blanc@gmail.com</a><br>&lt;<a href="mailto:scm.blanc@gmail.com">mailto:scm.blanc@gmail.com</a>&gt;&gt; wrote:<br><br><blockquote type="cite">Hi,<br>That sounds good !<br>Just one question, instead of using the callApi function couldn't we<br>pass the oauth module (called 'thing' in your example) to the pipe<br>directly, using the 'authenticator' setting. Behind the scene, the<br>pipe manager will append the oauth token to the query or add the<br>bearer header ?<br></blockquote><br>I'm not sure if that is what this is going to do. &nbsp;This is more of an<br>Authorization thing and i don't think it totally fits the pipeline<br>stuff. ( or it would make it a bit more complicated, and we want to keep<br>it simple )<br><br><br> i should probably change the method to be "authorize" instead<br><br><blockquote type="cite">Seb<br><br><br><br>On Mon, Aug 26, 2013 at 8:05 PM, Lucas Holmquist &lt;<a href="mailto:lholmqui@redhat.com">lholmqui@redhat.com</a><br>&lt;<a href="mailto:lholmqui@redhat.com">mailto:lholmqui@redhat.com</a>&gt;&gt; wrote:<br><br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OAuth2 AeroGear Workflow - High Level<br><br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Using Google api's<br><br> &nbsp;&nbsp;&nbsp;/Server Side/<br><br> &nbsp;&nbsp;&nbsp;&nbsp;1. user needs to first create an "application/project" to get an<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;api key<br> &nbsp;&nbsp;&nbsp;&nbsp;2. Then they would choose the services/api's then would like<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;there application to access<br> &nbsp;&nbsp;&nbsp;&nbsp;3. other google server related items....<br><br> &nbsp;&nbsp;&nbsp;/Client Side/<br><br> &nbsp;&nbsp;&nbsp;&nbsp;1. Create a new OAuth2 module thing<br> &nbsp;&nbsp;&nbsp;&nbsp;2. Get access token for the services would need to specify the<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;services they would like to access<br> &nbsp;&nbsp;&nbsp;&nbsp;3. validate the token<br> &nbsp;&nbsp;&nbsp;&nbsp;4. make calls to the service<br><br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;API<br><br> &nbsp;&nbsp;&nbsp;|var thing = AerGear.OAuth2({<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name: googleEndPoints, //Just a Name<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clientID: "12345" //The client ID of the app from the API console<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settings: {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permissions: "..",<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}).somecoolmodulename.googleEndPoints;<br> &nbsp;&nbsp;&nbsp;|<br><br> &nbsp;&nbsp;&nbsp;/Settings: Multiple settings based on paramters here<br> &nbsp;&nbsp;&nbsp;&lt;<a href="https://developers.google.com/accounts/docs/OAuth2UserAgent">https://developers.google.com/accounts/docs/OAuth2UserAgent</a>&gt;/<br><br> &nbsp;&nbsp;&nbsp;/Methods/<br><br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;authenticate<br><br> &nbsp;&nbsp;&nbsp;this will authenticate with the server to get the access token and<br> &nbsp;&nbsp;&nbsp;then validate the token, once that is all good then the response<br> &nbsp;&nbsp;&nbsp;is returned.<br><br> &nbsp;&nbsp;&nbsp;|thing.authenticate({<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success:{},<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error:{},<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settings: {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//probably some settings here, like URL overides and such<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &nbsp;&nbsp;&nbsp;});<br> &nbsp;&nbsp;&nbsp;|<br><br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;callApi<br><br> &nbsp;&nbsp;&nbsp;not really a good name, but it would basically call the remote<br> &nbsp;&nbsp;&nbsp;api/services. we could either do a query string option or a Head<br> &nbsp;&nbsp;&nbsp;option<br><br> &nbsp;&nbsp;&nbsp;example:<br><br> &nbsp;&nbsp;&nbsp;|curl '<a href="https://www.googleapis.com/oauth2/v1/userinfo?access_token=1/fFBGRNJru1FQd44AzqT3Zg'">https://www.googleapis.com/oauth2/v1/userinfo?access_token=1/fFBGRNJru1FQd44AzqT3Zg'</a><br> &nbsp;&nbsp;&nbsp;|<br><br> &nbsp;&nbsp;&nbsp;or<br><br> &nbsp;&nbsp;&nbsp;|curl -H "Authorization: Bearer {accessToken}" <a href="https://www.googleapis.com/oauth2/v1/userinfo">https://www.googleapis.com/oauth2/v1/userinfo</a><br> &nbsp;&nbsp;&nbsp;|<br><br> &nbsp;&nbsp;&nbsp;code:<br><br> &nbsp;&nbsp;&nbsp;|thing.callApi({<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service: "userinfo", //don't really like this name either<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success:{},<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error:{},<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settings: {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;... //overridable baseURLs?<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &nbsp;&nbsp;&nbsp;});<br> &nbsp;&nbsp;&nbsp;|<br><br><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;revoke<br><br> &nbsp;&nbsp;&nbsp;again, maybe not the best name. calls the "revoke" service, to<br> &nbsp;&nbsp;&nbsp;remove access to permissions<br><br> &nbsp;&nbsp;&nbsp;|thing.revoke({<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success: {},<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error: {},<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settings: {}<br> &nbsp;&nbsp;&nbsp;});<br> &nbsp;&nbsp;&nbsp;|<br><br> &nbsp;&nbsp;&nbsp;Behind the scenes on all these calls, the "access_token" is<br> &nbsp;&nbsp;&nbsp;beining used and possibly refreshed for the user, so they don't<br> &nbsp;&nbsp;&nbsp;have to worry about it. They just need to call authenticate first.<br> &nbsp;&nbsp;&nbsp;Maybe we can have a refresh method if the user wants to refresh<br> &nbsp;&nbsp;&nbsp;the tokens themselves. this would do the token "dance"<br><br><br><br> &nbsp;&nbsp;&nbsp;On Aug 26, 2013, at 1:35 PM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a><br> &nbsp;&nbsp;&nbsp;&lt;<a href="mailto:bruno@abstractj.org">mailto:bruno@abstractj.org</a>&gt;&gt; wrote:<br><br><blockquote type="cite"> &nbsp;&nbsp;&nbsp;+1 I think is a good start to us.<br><br> &nbsp;&nbsp;&nbsp;Kris Borchers wrote:<br><blockquote type="cite"> &nbsp;&nbsp;&nbsp;I would like to see that but what you are saying makes sense. It<br> &nbsp;&nbsp;&nbsp;sounds like where I was headed with the Basic and Digest<br> &nbsp;&nbsp;&nbsp;adapters before I ran into browser security issues with headers.<br> &nbsp;&nbsp;&nbsp;I think and authorization API that basically just wraps itself<br> &nbsp;&nbsp;&nbsp;around secured endpoints works for me.<br></blockquote><br> &nbsp;&nbsp;&nbsp;-- <br> &nbsp;&nbsp;&nbsp;abstractj<br><br><br> &nbsp;&nbsp;&nbsp;_______________________________________________<br> &nbsp;&nbsp;&nbsp;aerogear-dev mailing list<br> &nbsp;&nbsp;&nbsp;<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a> &lt;<a href="mailto:aerogear-dev@lists.jboss.org">mailto:aerogear-dev@lists.jboss.org</a>&gt;<br> &nbsp;&nbsp;&nbsp;<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote><br><br> &nbsp;&nbsp;&nbsp;_______________________________________________<br> &nbsp;&nbsp;&nbsp;aerogear-dev mailing list<br> &nbsp;&nbsp;&nbsp;<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a> &lt;<a href="mailto:aerogear-dev@lists.jboss.org">mailto:aerogear-dev@lists.jboss.org</a>&gt;<br> &nbsp;&nbsp;&nbsp;<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br><br><br>_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a> &lt;<a href="mailto:aerogear-dev@lists.jboss.org">mailto:aerogear-dev@lists.jboss.org</a>&gt;<br><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote><br>_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev<br></blockquote><br>-- <br>abstractj<br><br><br>_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev</blockquote></div><br></div></body></html>