UserStorageProvider - Can't create user using the admin UI as provider gets invoked trying to migrate the new user

Dear all,

I have implemented an own UserStorageProvider in Keycloak 18.0 which migrates users from our legacy system to Keycloak on first login attempt against Keycloak. This works fine so far.

Now I have tried to add a user manually using the admin UI of Keycloak but without success.

Every time I hit the ‘Save’ / ‘Create’ button, the custom UserStorageProvider gets invoked trying to search for that user in our legacy system - which at least results in an error due to the fact that the user does not exist in the legacy system. Which makes sense because I only want the user to be created locally in Keycloak.

The workaround for this is to disable my custom UserStorageProvider, create the desired user over the admin UI and enable the custom UserStorageProvideragain. This won’t invoke the UserStorageProvider due to the fact that it’s disabled.

Now, in my opinion, this is not how it should be.
Can somebody imagine what I am doing wrong here?

No ideas here? I am still facing this issue

Probably you want to implement also the interface in your custom UserStorageProvider implementation.

Just return null from the addUser() method and false from removeUser().

Thanks, I’ll give it a try

Sorry - makes no difference at all.