It looks like no matter which External IDP I use, it always checks the federation provider also which is not something that I think wants to be done. Is this a bug in the Keycloak software?
So it looks like one cannot do external IDP and federation at the same time. This should be fixed.
From: Scott Rossillo <firstname.lastname@example.org>
Date: Wednesday, January 27, 2016 at 1:02 PM
To: Reed Lewis <RLewis@carbonite.com>
Cc: Thomas Darimont <email@example.com>, "firstname.lastname@example.org" <email@example.com>
Subject: Re: [keycloak-user] External Username, Password, Email... dataset with Keycloak
I think that’s a more general question about user account merging so maybe one of the core devs can chime in. However, I just want to clarify, you don’t want to query the federation provider at all when a user signs in with external IDP, right? In that case, you could modify the findByUsername() method to not create a user if the login is with a IDP. I’m not sure if it still exists in 1.7+ but the username used to be created as firstname.lastname@example.org where the IDP is the username prefix.
Does that make sense / sufficiently address the use case?
On Jan 27, 2016, at 12:34 PM, Reed Lewis <RLewis@carbonite.com> wrote:
This is working for me now. I created a service that listens on a port and implements the GET, HEAD and POST requests that are being made.
The one issue now is that integration with other Identity providers does not work now since it still calls my server with the username from the external provider. How can I tell Keycloak that when a user comes from an external Identity provider not to check the user Federation provider?
We just put up and blog post and some sample code on how to do this type of migration.
Scott RossilloSmartling | Senior Software Engineer
On Jan 15, 2016, at 11:06 AM, Thomas Darimont <email@example.com> wrote:
as you already wrote, you can write a federation provider that queries yourbackend service via REST for user data.Within the federation provider you can then import the user datareturned from the REST call.
This would work as follows - within the method:org.keycloak.models.UserFederationProvider.getUserByUsername(RealmModel, String)you call your backend REST service.
As a next step you create a new user with the given usernameUserModel keycloakUser = session.userStorage().addUser(realm, username);
Then you copy all the user data from your backend into Keycloak's UserModel.
After that your backend user has a corresponding representation in Keycloakwith a reference to this federation provider (id) via the "userModel.federationLink" property.
The federation link will also be shown in the user page in the keycloak admin console.As long as the federation link is in place keycloak will ask the federation providerfor the latest user data. Once you decide to cut the link to the federation provider you cansimply do userModel.setFederationLink(null). You could basically cut (or rather omit) the federationlink right after you added the user to Keycloak.
Keycloak has no link information after that anymore and it will only use the user data storedin the Keycloak database for that particular user.
You also have the option to do that for all your users via:org.keycloak.models.UserFederationProviderFactory.syncAllUsers(KeycloakSessionFactory, String, UserFederationProviderModel)
or just use on demand per User when he / she want's to login for the first time.
2016-01-15 16:16 GMT+01:00 Reed Lewis <RLewis@carbonite.com>:
Hi,We are examining KeyCloak (It looks like it can do what we want), but we have the need to have an external lookup of accounts who are not in KeyCloak in an external database which is accessible via a REST call. I know about federation, but would prefer to only check the external datasource if the user is not in KeyCloak, but from then on have all the data “live” in KeyCloak and never refer to the external datasource again once the account is “migrated” into KeyCloak.
Can this be done with some modification of federation?
We do not want to add the user accounts directly into KeyCloak as there are many more there than will ever be in KeyCloak.
keycloak-user mailing list
keycloak-user mailing list
_______________________________________________ keycloak-user mailing list firstname.lastname@example.org://lists.jboss.org/mailman/listinfo/keycloak-user