<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>I agree with Stian here – the process to normalize a collection of logins requires human-interaction nuance that should not be automated. I think Keycloak can provide a nice user experience to
<span style="font-weight: bold;">aid</span> the process, but it should always be an interactive process with plenty of re-authentication challenges to make sure an individual still retains ownership of the various candidate linked accounts.&nbsp;</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>&lt;<a href="mailto:keycloak-dev-bounces@lists.jboss.org">keycloak-dev-bounces@lists.jboss.org</a>&gt; on behalf of Stian Thorgersen &lt;<a href="mailto:sthorger@redhat.com">sthorger@redhat.com</a>&gt;<br>
<span style="font-weight:bold">Reply-To: </span>&quot;<a href="mailto:stian@redhat.com">stian@redhat.com</a>&quot; &lt;<a href="mailto:stian@redhat.com">stian@redhat.com</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Wednesday, October 28, 2015 at 8:06 AM<br>
<span style="font-weight:bold">To: </span>Marek Posolda &lt;<a href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&gt;<br>
<span style="font-weight:bold">Cc: </span>keycloak-dev &lt;<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>Re: [keycloak-dev] Plan for &quot;First login with identity brokers&quot;<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">I'm quite concerned about auto linking accounts. If someone has loads of social networks enabled and a user has a single of those compromised (that happens quite frequently) the attackers would then also be able to gain access to whatever Keycloak
 secures. The user wouldn't even know they have access to Keycloak, since the user has never used to compromised account to login to Keycloak.
<div><br>
</div>
<div>I strongly feel we should never link to any account without requiring user to first authenticate to the account we are linking with.&nbsp;</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 27 October 2015 at 08:04, Marek Posolda <span dir="ltr">
&lt;<a href="mailto:mposolda@redhat.com" target="_blank">mposolda@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">
<span class="">On 27/10/15 14:05, Bill Burke wrote:<br>
&gt; IMO, most applications will not care about account duplication.&nbsp; Most<br>
&gt; users won't care about account linking.&nbsp; So, IMO:<br>
</span>Remember you mentioned that already in the previous discussions. IMO<br>
people care and usually want to have single account on single site. If<br>
you have 2 accounts, you never know to which of your accounts you are<br>
authenticated. This causes various issues, like permissions available to<br>
account1, but you are logged with account2 etc.<br>
<br>
Remember some time ago I messed on some site and have 2 accounts like<br>
&quot;mposolda&quot; and &quot;<a href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&quot; . I had always issues like that<br>
when I was logged as &quot;mposolda&quot; I had &quot;Access denied&quot; when going to page<br>
I was supposed to have permission. So needed to logout and login again<br>
as &quot;<a href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&quot; etc.<br>
<span class="">&gt;<br>
&gt; 1) users should not be required to link accounts.&nbsp; In the case where an<br>
&gt; account cannot be automatically linked a duplicate account should be<br>
&gt; created<br>
&gt; 2) Providers should be trusted by default.&nbsp; Trusted providers can just<br>
&gt; automatically link themselves to existing accounts that were logged in<br>
&gt; by other trusted providers.<br>
&gt; 3) Untrusted providers can automatically link if email has been verified<br>
&gt; for all parties.<br>
&gt; 4) Users can merge accounts that have verified emails.<br>
&gt; 5) An alternative to user self merging of account could be requiring to<br>
&gt; enter in a temporary code after logging into each account.<br>
&gt;<br>
&gt;<br>
&gt; #1 and #2 can be added with minimal changes to code.&nbsp; #3 requires a flow<br>
&gt; on broker login and a rework of the broker SPI.&nbsp; #4 is account service<br>
&gt; changes.&nbsp; #5 might be as easy as adding a required action.<br>
&gt;<br>
&gt; I guess it depends if ultimate flexibility is needed.&nbsp; #1, #2 and #4<br>
&gt; might be enough and require the least amount of changes and SPI refactoring.<br>
</span>I think that flexibility is needed based on various JIRAs and feedback.<br>
Just talked with Vlasta Elias from <a href="http://jboss.org" rel="noreferrer" target="_blank">
jboss.org</a>. They have even more<br>
requirements for possible conditions when accounts should be merged and<br>
how to merge accounts. For example Vlasta mentioned the usecase like:<br>
- When user logges with Facebook (or other provider) account, which is<br>
not yet linked to any Keycloak account, then new account on Keycloak<br>
side shouldn't be created automatically. Even if I logged with Facebook<br>
<a href="mailto:bob@gmail.com">bob@gmail.com</a> and there is no KC account for email
<a href="mailto:bob@gmail.com">bob@gmail.com</a>, there<br>
is requirement to always show the screen like: &quot;You just logged with<br>
facebook account <a href="mailto:bob@gmail.com">bob@gmail.com</a>. Do you want to link it with existing<br>
keycloak account?&quot; If user agree, he would need to provide Keycloak<br>
account he wants to merge and then verify email or re-authenticate to<br>
link Facebook with existing account<br>
<br>
- Another use-case was to merge account automatically based on username<br>
from thirdparty SAML provider. For example the SAMLResponse with<br>
username &quot;john&quot; returned from SAML provider, there is a need to<br>
automatically merge it with Keycloak account &quot;john&quot; . In this case, they<br>
know that &quot;john&quot; will be always available on Keycloak side because of<br>
Federation provider, which SAML IDP uses as storage as well.<br>
<br>
Based on all of this, it looks that introducing Auth SPI for first time<br>
broker login is a way to go. This will address all of #1, #2 and #3 and<br>
many other usecases.<br>
<br>
For your #2, I agree that providers should be trusted by default. But<br>
not all of providers, because some of them don't verify email. AFAIK<br>
Facebook and Google verify email. But Github doesn't . It will be a<br>
security hole to trust github provider by default because then user can<br>
do something like:<br>
- He can create github account with any email he wants like<br>
&quot;<a href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&quot;<br>
- Login with this github account into Keycloak. If we trust the email by<br>
default, he will be logged into Keycloak&nbsp; to account<br>
&quot;<a href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&quot;, which is not his email -&gt; FAIL<br>
<br>
I am not sure about support for merging accounts in Account management<br>
(like #4 and #5), will try to work on login flow first and will try to<br>
possibly look at account management then.<br>
<span class="HOEnZb"><font color="#888888"><br>
Marek<br>
</font></span>
<div class="HOEnZb">
<div class="h5">&gt;<br>
&gt;<br>
&gt; On 10/27/2015 4:33 AM, Marek Posolda wrote:<br>
&gt;&gt; I went again through all the previous discussions, related JIRAs and<br>
&gt;&gt; requirements. As of now, my plan is to:<br>
&gt;&gt;<br>
&gt;&gt; - Use authentication SPI to handle the flow and related actions for<br>
&gt;&gt; first social login. (Update user profile, Detect duplicated account,<br>
&gt;&gt; Verify email or reauthenticate user if duplication is detected, Create<br>
&gt;&gt; social link to existing account). This allows most flexibility for<br>
&gt;&gt; admins to specify how exactly the linking should work<br>
&gt;&gt;<br>
&gt;&gt; - Detecting duplication will be based on email only by default - (For<br>
&gt;&gt; example duplication is detected if Facebook user with email<br>
&gt;&gt; <a href="mailto:bob@gmail.com">bob@gmail.com</a> authenticates, but there is already Keycloak user with<br>
&gt;&gt; email <a href="mailto:bob@gmail.com">bob@gmail.com</a> ). The people can provide their own execution if<br>
&gt;&gt; they want different way for detect duplications<br>
&gt;&gt;<br>
&gt;&gt; - It seems it's more proper to postpone creating user account later,<br>
&gt;&gt; once we know that there is no duplication. In other words, if &quot;Update<br>
&gt;&gt; profile on first login&quot; is enabled, the user account is not yet created<br>
&gt;&gt; when the update profile page is shown. All the info related to<br>
&gt;&gt; BrokeredIdentityContext stuff will be available on ClientSession. This<br>
&gt;&gt; seems to me easier and more proper solution then creating temporary<br>
&gt;&gt; account with email in some &quot;temporary&quot; attribute. Temporary accounts<br>
&gt;&gt; have other challenges (Cleaner thread for delete outdated unmerged<br>
&gt;&gt; accounts etc).<br>
&gt;&gt;<br>
&gt;&gt; - If &quot;trustEmail&quot; flag is on for IdentityProvider, the provider link<br>
&gt;&gt; will be created automatically. (For example if Facebook user<br>
&gt;&gt; <a href="mailto:bob@gmail.com">bob@gmail.com</a> authenticates for the first time and there is already<br>
&gt;&gt; Keycloak user with email <a href="mailto:bob@gmail.com">bob@gmail.com</a> and trustEmail is on, the<br>
&gt;&gt; Facebook link is automatically created for Keycloak account<br>
&gt;&gt; <a href="mailto:bob@gmail.com">bob@gmail.com</a> without any additional verification)<br>
&gt;&gt;<br>
&gt;&gt; - If &quot;trustEmail&quot; flag is off, there would need to be other way to<br>
&gt;&gt; verify user before creating social link. The user will first confirm if<br>
&gt;&gt; he wants to merge the accounts. Then there will be either:<br>
&gt;&gt; -- Email verification: The mail will be sent to <a href="mailto:bob@gmail.com">
bob@gmail.com</a> like<br>
&gt;&gt; &quot;Someone authenticates to Keycloak server <a href="http://www.keycloak.org:8080" rel="noreferrer" target="_blank">
http://www.keycloak.org:8080</a><br>
&gt;&gt; through Facebook account <a href="mailto:bob@gmail.com">bob@gmail.com</a> and wants to link Facebook<br>
&gt;&gt; account with existing Keycloak account <a href="mailto:bob@gmail.com">bob@gmail.com</a> . If it is you,<br>
&gt;&gt; click here&quot; . After user clicks, the social link is created<br>
&gt;&gt; -- Further authentication: User will need to authenticate to existing<br>
&gt;&gt; <a href="mailto:bob@gmail.com">bob@gmail.com</a> keycloak account through password (or OTP or both or<br>
&gt;&gt; something else)<br>
&gt;&gt; All of this is configurable through flows, so admin can disable the &quot;Do<br>
&gt;&gt; you want to create social link?&quot; screen, or enforce email verification<br>
&gt;&gt; instead of authentication, configure required authenticators etc.<br>
&gt;&gt;<br>
&gt;&gt; - I am not sure if we want to handle just merge with existing account<br>
&gt;&gt; during first broker login, or if we also want to handle merging of<br>
&gt;&gt; accounts in account management? For now, I am planning to handle just<br>
&gt;&gt; the login flow and possibly address Account management later if there is<br>
&gt;&gt; need for it. The merging accounts in account management might be quite a<br>
&gt;&gt; challenge as there is merge of 2 already existing user accounts with<br>
&gt;&gt; various issues related to it (Which roles/permissions should merged<br>
&gt;&gt; account have? Which attributes it should have? Which federation link?<br>
&gt;&gt; etc.). But at least, I am planning to address the issue with redirect to<br>
&gt;&gt; login forms error screen instead of stay in account management -<br>
&gt;&gt; <a href="https://issues.jboss.org/browse/KEYCLOAK-1822" rel="noreferrer" target="_blank">
https://issues.jboss.org/browse/KEYCLOAK-1822</a><br>
&gt;&gt;<br>
&gt;&gt; Marek<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; keycloak-dev mailing list<br>
&gt;&gt; <a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
&gt;&gt; <a 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>
<br>
_______________________________________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span>
</body>
</html>