[keycloak-user] Duplicate User showing in admin console after user import via federation

Christian Chive bobwilson33 at gmail.com
Tue Feb 13 20:58:24 EST 2018


Hi,

This is my first time using a mailing list, and my colleagues found it
hysterical that I'd never heard of the concept before, so apologies if I'm
doing something incorrectly.

I have based my code off of
https://github.com/keycloak/keycloak/tree/master/examples/providers/user-storage-simple/src/main/java/org/keycloak/examples/userstorage/writeable

I've been reading Section 11.X to help troubleshoot
http://www.keycloak.org/docs/3.4/server_development/index.html#credentialinputvalidator-implementation

Here are (I think) all of the relevant methods I overrode. I excluded
methods I figured were irrelevant.
https://pastebin.com/0CF1n4xy

My goal:

Using keycloak 3.4, write a provider that allows me to log in with
credentials in a simple key/value properties file. Once a user logs in for
the first time while keycloak is up, keycloak will create a new user and
add it to the UserLocalStorage so the next time the user logs in, it will
query the UserLocalStorage to retrieve the user and skip hitting the
external store. The end goal is to hook into our SQL DB and slowly migrate
users on a per-login basis.

I've got all of this working, except whenever I go into the admin console
and go to Users -> View All Users, I see duplicates of all of the users
that have been migrated over - same ID, same username.

I had thrown debug statements all over my overridden methods and the
getUsers method seemed to be returning the correct (non duplicate) amount
of accounts, but the 'isConfiguredFor' coming from the
CredentialInputValidator interface was being called twice for each account,
but couldn't figure out why.

An important note, once I unlink the users and remove the provider, the
users that remain in the 'Users -> View All' display no duplicates.



Any help would be sincerely appreciated. Thank you!


More information about the keycloak-user mailing list