<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">... and the devil is in the details.<br>
      <br>
      It seems as though all the current AuzthzModules use an http based
      approach to requesting an Oauth2 token.  I see this being done in
      OAuth2WebFragmentFetchAutorization#doAuthorization method, where
      an OAuthWebViewDialog is used to trigger the Oauth2 token request.<br>
      <br>
      To use Google Play services to trigger an Oauth2 token request, we
      won't use an http approach, but rather we start an activity to
      select an account and request an Oauth2 token.  Once the token is
      retrieved it can then be used with the standard http Oauth2 API.<br>
      <br>
      (One caveat: the google play services token response doesn't
      provide a refresh token.  I believe this to be a non-issue as the
      token request process is trivial when using google play services
      (no authentication step)).<br>
      <br>
      I see to ways to implement this feature:<br>
      <br>
      1) Generalize the OAuth2WebFragmentFetchAutorization into an
      interface, and have one implementation to handle http-based token
      requests, and second implementation to handle intent-based token
      requests.<br>
      <br>
      2) Add a OAuth2AuthorizationConfiguration option to use intents
      instead of http, and trigger a different workflow within the
      OAuth2WebFragmentFetchAutorization#doAuthorization method if that
      config is set.<br>
      <br>
      My preference is for 2) because it's a) simpler, and b) it is
      really only during the #doAuthorization method that we have a
      different approach.<br>
      <br>
      Thoughts?  I'll start with implementing approach (2) unless I hear
      otherwise.<br>
      <br>
      Brian<br>
      <br>
      On 2015-02-24 07:25 PM, Matthias Wessendorf wrote:<br>
    </div>
    <blockquote
cite="mid:CAAg5f2TxvmrW8AuYDvFMCUvXrAwgDtBjqNQvuXd4ObU3spgxuA@mail.gmail.com"
      type="cite"><br>
      <br>
      On Wednesday, February 25, 2015, Daniel Passos &lt;<a
        moz-do-not-send="true" href="mailto:daniel@passos.me">daniel@passos.me</a>&gt;
      wrote:<br>
      <blockquote class="gmail_quote" style="margin:0 0 0
        .8ex;border-left:1px #ccc solid;padding-left:1ex">
        <div dir="ltr">No, we are not using Google Play services API for
          now for OAuth2 in Android land. 
          <div><br>
          </div>
          <div>But feel free create a new AuthzModule[1] for it ;)</div>
        </div>
      </blockquote>
      <div><br>
      </div>
      <div>+1<span></span></div>
      <div> </div>
      <blockquote class="gmail_quote" style="margin:0 0 0
        .8ex;border-left:1px #ccc solid;padding-left:1ex">
        <div dir="ltr">
          <div><br>
          </div>
          <div>[1] <a moz-do-not-send="true"
href="https://github.com/aerogear/aerogear-android-authz/blob/master/aerogear-android-authz/src/main/java/org/jboss/aerogear/android/authorization/AuthzModule.java"
              target="_blank">https://github.com/aerogear/aerogear-android-authz/blob/master/aerogear-android-authz/src/main/java/org/jboss/aerogear/android/authorization/AuthzModule.java</a><br>
            <div><br>
            </div>
            <div>-- Passos</div>
          </div>
          <div><br>
          </div>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Tue, Feb 24, 2015 at 4:01 PM,
            Sebastien Blanc <span dir="ltr">&lt;<a
                moz-do-not-send="true"
                href="javascript:_e(%7B%7D,'cvml','scm.blanc@gmail.com');"
                target="_blank">scm.blanc@gmail.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 dir="ltr">Cool stuff Brian ! 
                <div>The AeroGear OAuth2 Cordova plugin relies on the
                  Native AeroGear OAuth2  Libraries, so maybe Summers
                  and/or Daniel could tell  more about it. </div>
                <div>Sebi</div>
                <div> </div>
              </div>
              <div>
                <div>
                  <div class="gmail_extra"><br>
                    <div class="gmail_quote">On Tue, Feb 24, 2015 at
                      7:46 PM, Brian Leathem <span dir="ltr">&lt;<a
                          moz-do-not-send="true"
                          href="javascript:_e(%7B%7D,'cvml','bleathem@gmail.com');"
                          target="_blank">bleathem@gmail.com</a>&gt;</span>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">Hey gear-heads,<br>
                        <br>
                        I recently wrote a Cordova plugin that retrieves
                        a Oauth2 token on<br>
                        Android using Google Play Services.  The
                        advantage of this approach is<br>
                        it leverages the single-sign-on capabilities of
                        android, and the app can<br>
                        retrieve the Oauth2 token without requiring
                        Authentication from the<br>
                        user. I blogged about it here:<br>
                        <br>
                        <a moz-do-not-send="true"
href="http://www.bleathem.ca/blog/2015/02/cordova-oauth-google-services.html"
                          target="_blank">http://www.bleathem.ca/blog/2015/02/cordova-oauth-google-services.html</a><br>
                        <br>
                        Using a promise-based API it's fairly trivial to
                        fallback to a<br>
                        traditional Web authentication/authorisation for
                        the Oauth2 token when<br>
                        the google-play-services approach isn't
                        supported.<br>
                        <br>
                        I'm aware the aerogear team has a Oauth2 cordova
                        plugin [1], but it's<br>
                        not clear to me if the google-play-services
                        integration is supported.<br>
                        If the Aerogeam would find it useful, I'd be
                        more than happy to provide<br>
                        a PR to the aerogear cordova plugin providing
                        such integration.<br>
                        <br>
                        Thoughts?<br>
                        Brian<br>
                        <br>
                        [1]<br>
                        <a moz-do-not-send="true"
href="http://staging-aerogearsite.rhcloud.com/docs/specs/aerogear-cordova/OAuth2.html"
                          target="_blank">http://staging-aerogearsite.rhcloud.com/docs/specs/aerogear-cordova/OAuth2.html</a><br>
                        _______________________________________________<br>
                        aerogear-dev mailing list<br>
                        <a moz-do-not-send="true"
                          href="javascript:_e(%7B%7D,'cvml','aerogear-dev@lists.jboss.org');"
                          target="_blank">aerogear-dev@lists.jboss.org</a><br>
                        <a moz-do-not-send="true"
                          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>
                </div>
              </div>
              <br>
              _______________________________________________<br>
              aerogear-dev mailing list<br>
              <a moz-do-not-send="true"
                href="javascript:_e(%7B%7D,'cvml','aerogear-dev@lists.jboss.org');"
                target="_blank">aerogear-dev@lists.jboss.org</a><br>
              <a moz-do-not-send="true"
                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>
      </blockquote>
      <br>
      <br>
      -- <br>
      Sent from Gmail Mobile<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
aerogear-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/aerogear-dev">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>