<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 16.7.2015 03:31, Scott Rossillo
      wrote:<br>
    </div>
    <blockquote
cite="mid:CALAqdu9F=e81fbYADh2WB0LDc5D-rEfQnXsg4pb6p9f62jwc0A@mail.gmail.com"
      type="cite">Why can't we just require email scope from upstream
      IDPs? What system these days doesn't use email as some sort of
      unique identifier, including Twitter and Github?<br>
    </blockquote>
    <br>
    You should be surprised ;-). Some Oauth providers simply doesn't
    have separate email scope, some of them doesn't return email at all
    (twitter, StackOverflow), some of them doesn't return email in some
    cases, eg. Github does not return email if user sets "Public email"
    to "Don't show my email address" in his user profile Setting (which
    looks like error for me that this setting affects REST API, but it
    is how it works). Facebook user can deny providing email during
    approving login for your server on Facebok's "Consent" page.<br>
    <br>
    Vl.<br>
    <blockquote
cite="mid:CALAqdu9F=e81fbYADh2WB0LDc5D-rEfQnXsg4pb6p9f62jwc0A@mail.gmail.com"
      type="cite"><br>
      <div class="gmail_quote">
        <div dir="ltr">On Wed, Jul 15, 2015 at 9:09 AM Bill Burke &lt;<a
            moz-do-not-send="true" href="mailto:bburke@redhat.com">bburke@redhat.com</a>&gt;
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">Looks like
          IDP logins will require configurable auth flows too like<br>
          registration and login currently have in master.  Man, all
          this stuff is<br>
          going to be hard to get both easy to use and easy to extend.<br>
          <br>
          On 7/15/2015 4:40 AM, Vlastimil Elias wrote:<br>
          &gt; I agree also that solution with temporary user account is
          not ideal.<br>
          &gt; Ideal solution (which I proposed originally) is to
          present "Update<br>
          &gt; Account Page" as part of social registration flow before
          KC DB account<br>
          &gt; is created. So you sort out all conflicts in this phase
          and then create<br>
          &gt; final correct user or link social account to existing KC
          account.<br>
          &gt;<br>
          &gt; Vl.<br>
          &gt;<br>
          &gt; On 15.7.2015 10:00, Stian Thorgersen wrote:<br>
          &gt;&gt; After some thought I agree the proposal I made is way
          to complicated. Implementing the migrate account feature would
          be way to complicated, and probably not that often used.<br>
          &gt;&gt;<br>
          &gt;&gt; I like the idea of having an option on an IdP to
          trust email or not. We don't need that many options though, a
          simple on/off toggle will be enough. When login using a new
          IdP and email exists if this option is enabled we should just
          add the link to the existing account, if it's disabled we
          should just display the error message that email is already in
          use (like we do now), but we can improve on that message to
          make it more clear to the user what they have to do.<br>
          &gt;&gt;<br>
          &gt;&gt; That won't solve the initial problem that sparked
          this conservation though. If the user logs in with a IdP that
          doesn't require email we can now ask the user to enter the
          email address, but if they then add an email address that's
          already in use there's not an easy way to recover from that.
          Maybe that could be solved by not creating the account until
          the user has performed the initial set of required actions on
          a first login with IdP?<br>
          &gt;&gt;<br>
          &gt;&gt; ----- Original Message -----<br>
          &gt;&gt;&gt; From: "Scott Rossillo" &lt;<a
            moz-do-not-send="true" href="mailto:srossillo@smartling.com"
            target="_blank">srossillo@smartling.com</a>&gt;<br>
          &gt;&gt;&gt; To: "Bill Burke" &lt;<a moz-do-not-send="true"
            href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;,
          <a moz-do-not-send="true"
            href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
          &gt;&gt;&gt; Sent: Tuesday, 14 July, 2015 9:16:12 PM<br>
          &gt;&gt;&gt; Subject: Re: [keycloak-dev] Improve first login
          with identity provider<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; +1 for auto-merge. We modified the code to do
          that.<br>
          &gt;&gt;&gt; I like Bill's approach with multiple options
          though as this is the most<br>
          &gt;&gt;&gt; flexible and different people will have different
          requirements.<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; On Tue, Jul 14, 2015 at 11:13 AM Bill Burke &lt;
          <a moz-do-not-send="true" href="mailto:bburke@redhat.com"
            target="_blank">bburke@redhat.com</a> &gt; wrote:<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; On 7/14/2015 10:30 AM, Marek Posolda wrote:<br>
          &gt;&gt;&gt;&gt; On 14.7.2015 15:15, Stian Thorgersen wrote:<br>
          &gt;&gt;&gt;&gt;&gt; ----- Original Message -----<br>
          &gt;&gt;&gt;&gt;&gt;&gt; From: "Marek Posolda" &lt; <a
            moz-do-not-send="true" href="mailto:mposolda@redhat.com"
            target="_blank">mposolda@redhat.com</a> &gt;<br>
          &gt;&gt;&gt;&gt;&gt;&gt; To: "Vlastimil Elias" &lt; <a
            moz-do-not-send="true" href="mailto:velias@redhat.com"
            target="_blank">velias@redhat.com</a> &gt;, <a
            moz-do-not-send="true"
            href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
          &gt;&gt;&gt;&gt;&gt;&gt; Sent: Tuesday, 14 July, 2015 3:05:06
          PM<br>
          &gt;&gt;&gt;&gt;&gt;&gt; Subject: Re: [keycloak-dev] Improve
          first login with identity provider<br>
          &gt;&gt;&gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt;&gt;&gt; +1 for do it like this. It seems the
          biggest challenge is merging the<br>
          &gt;&gt;&gt;&gt;&gt;&gt; accounts. Not sure if it's better
          creating temporary user accounts or<br>
          &gt;&gt;&gt;&gt;&gt;&gt; rather keep all the state in
          ClientSession. It seems the both approaches<br>
          &gt;&gt;&gt;&gt;&gt;&gt; has pros and cons...<br>
          &gt;&gt;&gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt;&gt;&gt; Do we want to support linking
          multiple accounts during single<br>
          &gt;&gt;&gt;&gt;&gt;&gt; authentication? It looks we should
          support it too to have all the things<br>
          &gt;&gt;&gt;&gt;&gt;&gt; covered properly. I mean the usecase
          like:<br>
          &gt;&gt;&gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt;&gt;&gt; 1) User is registered with
          username/password and email " <a moz-do-not-send="true"
            href="mailto:john@gmail.com" target="_blank">john@gmail.com</a>
          "<br>
          &gt;&gt;&gt;&gt;&gt;&gt; 2) User clicks to "Sign in with
          Facebook" and authenticates. Keycloak<br>
          &gt;&gt;&gt;&gt;&gt;&gt; displays "There is already account
          with <a moz-do-not-send="true" href="mailto:john@gmail.com"
            target="_blank">john@gmail.com</a> . Do you want to<br>
          &gt;&gt;&gt;&gt;&gt;&gt; merge account?"<br>
          &gt;&gt;&gt;&gt;&gt;&gt; 3) Now login screen is displayed
          again (IMO it should be without<br>
          &gt;&gt;&gt;&gt;&gt;&gt; Facebook button this time) and user
          click to "Sign in with Google"<br>
          &gt;&gt;&gt;&gt;&gt;&gt; 4) Keycloak again displays "There is
          already account with<br>
          &gt;&gt;&gt;&gt;&gt;&gt; <a moz-do-not-send="true"
            href="mailto:john@gmail.com" target="_blank">john@gmail.com</a>
          . Do you want to merge account?"<br>
          &gt;&gt;&gt;&gt;&gt;&gt; 5) Now login screen is displayed
          again (without both Facebook and Google<br>
          &gt;&gt;&gt;&gt;&gt;&gt; buttons) and user finally login with
          username/password . After<br>
          &gt;&gt;&gt;&gt;&gt;&gt; authentication is user <a
            moz-do-not-send="true" href="mailto:john@gmail.com"
            target="_blank">john@gmail.com</a> linked with both Facebok
          and Google<br>
          &gt;&gt;&gt;&gt;&gt; Yes, but I had a different approach in
          mind:<br>
          &gt;&gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt;&gt; 1) User is registered with
          username/password and email " <a moz-do-not-send="true"
            href="mailto:john@gmail.com" target="_blank">john@gmail.com</a>
          "<br>
          &gt;&gt;&gt;&gt;&gt; 2) User clicks to "Sign in with Facebook"
          and authenticates. Keycloak<br>
          &gt;&gt;&gt;&gt;&gt; creates the account, but sets the email
          address ' <a moz-do-not-send="true"
            href="mailto:john@gmail.com" target="_blank">john@gmail.com</a>
          ' as an<br>
          &gt;&gt;&gt;&gt;&gt; tmp attribute. Then it displays existing
          account blah blah, do you want<br>
          &gt;&gt;&gt;&gt;&gt; to merge?<br>
          &gt;&gt;&gt;&gt;&gt; 3) User clicks merge and is shown a login
          screen without username, but<br>
          &gt;&gt;&gt;&gt;&gt; only password (and any linked identity
          providers)<br>
          &gt;&gt;&gt;&gt;&gt; 4) Once user is logged in the account
          created in step 2 is merged with the<br>
          &gt;&gt;&gt;&gt;&gt; account created in step 1. After it's
          merged the account from step 2 is<br>
          &gt;&gt;&gt;&gt;&gt; deleted.<br>
          &gt;&gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt;&gt; This lets the user merge the account from
          Facebook at any point as long as<br>
          &gt;&gt;&gt;&gt;&gt; it's within the expiration time. Newly
          created (but not active accounts,<br>
          &gt;&gt;&gt;&gt;&gt; i.e. outstanding required actions) will
          have a expiration time and be<br>
          &gt;&gt;&gt;&gt;&gt; removed by a background thread.<br>
          &gt;&gt;&gt;&gt; Yeah, I agree with creating separate
          temporary accounts. Was just<br>
          &gt;&gt;&gt;&gt; wondering about use-case with chaining
          multiple identity providers<br>
          &gt;&gt;&gt;&gt; during single authentication (both Facebook
          and Google). In this case,<br>
          &gt;&gt;&gt;&gt; there will be 2 temporary accounts, so the
          question is if:<br>
          &gt;&gt;&gt;&gt; - The "facebook" temporary account is merged
          with "google" temporary<br>
          &gt;&gt;&gt;&gt; account after successful Google
          authentication (my step 4)<br>
          &gt;&gt;&gt;&gt; - Both "facebook" and "google" temporary
          accounts are merged with the<br>
          &gt;&gt;&gt;&gt; original <a moz-do-not-send="true"
            href="mailto:john@gmail.com" target="_blank">john@gmail.com</a>
          account after authentication is completely<br>
          &gt;&gt;&gt;&gt; finished (my step 5)<br>
          &gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt; but maybe this is implementation detail? Not
          sure...<br>
          &gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt; IMO the period for keep these temporary
          accounts should be really small.<br>
          &gt;&gt;&gt;&gt; I think user should finish the authentication
          (which will delete<br>
          &gt;&gt;&gt;&gt; temporary accounts) within minutes (not the
          other day or so) and<br>
          &gt;&gt;&gt;&gt; shouldn't never be assigned access token to.
          Otherwise there might be<br>
          &gt;&gt;&gt;&gt; issues with temporary account already linked
          with some application data<br>
          &gt;&gt;&gt;&gt; etc...<br>
          &gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt;&gt; Also for your step (3), we don't want to be
          limited just for the default<br>
          &gt;&gt;&gt;&gt; password form right? I think that with
          Authentication SPI, people may<br>
          &gt;&gt;&gt;&gt; want various authentication mechanisms (maybe
          some don't even want to<br>
          &gt;&gt;&gt;&gt; use password at all). The tricky part is,
          that username is already known<br>
          &gt;&gt;&gt;&gt; and we want people to just provide
          credentials (aka password) . But IMO<br>
          &gt;&gt;&gt;&gt; if we limit only to form with password +
          identity providers, the issue<br>
          &gt;&gt;&gt;&gt; will return again after some time...<br>
          &gt;&gt;&gt;&gt;<br>
          &gt;&gt;&gt; This is WAY too complicated. Please see my long
          previous email. There<br>
          &gt;&gt;&gt; should never be any temporary accounts. I'll
          summarize my previous<br>
          &gt;&gt;&gt; email again:<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; * Existing accounts should only be detected by
          email. "Bill Burke" gets<br>
          &gt;&gt;&gt; 56 million hits on Google. It is a very common
          name.<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; Default behavior:<br>
          &gt;&gt;&gt; 1) User registers with " <a
            moz-do-not-send="true" href="mailto:bburke@redhat.com"
            target="_blank">bburke@redhat.com</a> " and password<br>
          &gt;&gt;&gt; 2) User does a social login, new account is
          created " <a moz-do-not-send="true"
            href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>
          "<br>
          &gt;&gt;&gt; is stored in a user attribute. i.e. "Alternative
          email".<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; Website requires linking:<br>
          &gt;&gt;&gt; 1) User registers with " <a
            moz-do-not-send="true" href="mailto:bburke@redhat.com"
            target="_blank">bburke@redhat.com</a> " and password<br>
          &gt;&gt;&gt; 2) User logins with Facebook, " <a
            moz-do-not-send="true" href="mailto:bburke@redhat.com"
            target="_blank">bburke@redhat.com</a> " exists. Prompted<br>
          &gt;&gt;&gt; "Account exists with same email you have
          registered at Facebook. You<br>
          &gt;&gt;&gt; have been sent an email verification message.
          Please follow the<br>
          &gt;&gt;&gt; directions of this email to login"<br>
          &gt;&gt;&gt; 3) User goes to Inbox, clicks link in email,
          message screen appears<br>
          &gt;&gt;&gt; "Your Facebook account has been linked. Click
          "Ok" to continue.". User<br>
          &gt;&gt;&gt; gets forwarded to website.<br>
          &gt;&gt;&gt; 4) Facebook is linked to pre-existing " <a
            moz-do-not-send="true" href="mailto:bburke@redhat.com"
            target="_blank">bburke@redhat.com</a> " account.<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; This would be implemented with Authentication
          Flows. There would be no<br>
          &gt;&gt;&gt; temporary account. Step #2 would create a
          ClientSession model and store<br>
          &gt;&gt;&gt; all the facebook metadata within it. Step #3
          would import the facebook<br>
          &gt;&gt;&gt; metadata.<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; Alternatively, you could just trust the IDP and
          do the link<br>
          &gt;&gt;&gt; automatically. Does Google et. al. send an
          "email-verified" metadata?<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; User wants to link accounts:<br>
          &gt;&gt;&gt; 1) User goes to Account Service, Account LInking
          page<br>
          &gt;&gt;&gt; 2) User is provided with list of IDPs i.e.
          (Facebook, Google, etc). And<br>
          &gt;&gt;&gt; clicks one.<br>
          &gt;&gt;&gt; 3) User is prompted to login via that IDP<br>
          &gt;&gt;&gt; 4) User receives prompt "Your Facebook account
          has been linked. Click<br>
          &gt;&gt;&gt; "OK" to continue". User gets forwarded to
          website.<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; In this scenario, there is no removal of old
          accounts. The initiating<br>
          &gt;&gt;&gt; account,X, would import the old Facebook account,
          Y. X would create a<br>
          &gt;&gt;&gt; new federation link to Facebook. Y would be
          disabled and its facebook<br>
          &gt;&gt;&gt; link removed. Y is marked as "merged" or "linked"
          and points to account<br>
          &gt;&gt;&gt; X. You need to keep Y around as the user may have
          done a bunch of<br>
          &gt;&gt;&gt; actions under that account...i.e. posted on <a
            moz-do-not-send="true" href="http://jboss.org"
            rel="noreferrer" target="_blank">jboss.org</a> forums.<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; --<br>
          &gt;&gt;&gt; Bill Burke<br>
          &gt;&gt;&gt; JBoss, a division of Red Hat<br>
          &gt;&gt;&gt; <a moz-do-not-send="true"
            href="http://bill.burkecentral.com" rel="noreferrer"
            target="_blank">http://bill.burkecentral.com</a><br>
          &gt;&gt;&gt; _______________________________________________<br>
          &gt;&gt;&gt; keycloak-dev mailing list<br>
          &gt;&gt;&gt; <a moz-do-not-send="true"
            href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
          &gt;&gt;&gt; <a moz-do-not-send="true"
            href="https://lists.jboss.org/mailman/listinfo/keycloak-dev"
            rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
          &gt;&gt;&gt;<br>
          &gt;&gt;&gt; _______________________________________________<br>
          &gt;&gt;&gt; keycloak-dev mailing list<br>
          &gt;&gt;&gt; <a moz-do-not-send="true"
            href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
          &gt;&gt;&gt; <a moz-do-not-send="true"
            href="https://lists.jboss.org/mailman/listinfo/keycloak-dev"
            rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
          &gt;&gt; _______________________________________________<br>
          &gt;&gt; keycloak-dev mailing list<br>
          &gt;&gt; <a moz-do-not-send="true"
            href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
          &gt;&gt; <a moz-do-not-send="true"
            href="https://lists.jboss.org/mailman/listinfo/keycloak-dev"
            rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
          &gt;<br>
          <br>
          --<br>
          Bill Burke<br>
          JBoss, a division of Red Hat<br>
          <a moz-do-not-send="true" href="http://bill.burkecentral.com"
            rel="noreferrer" target="_blank">http://bill.burkecentral.com</a><br>
          _______________________________________________<br>
          keycloak-dev mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
          <a moz-do-not-send="true"
            href="https://lists.jboss.org/mailman/listinfo/keycloak-dev"
            rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
keycloak-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-dev">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a></pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Vlastimil Elias
Principal Software Engineer
jboss.org Development Team</pre>
  </body>
</html>