How to implement user's migration

Hello !

I have existing users and their password hashes in the web application, stored in a DB.
I would like to migrate them into Keycloak - seamlessly.
It means that I’d connect my site to Keycloak using OpenID. Existing users then get redirected to Keycloak login and they do so using their existing password.
The password hash is then stored in Keycloak and on the consecutive login, this one is checked.

How would you approach it? Should I create a new plugin (provider)?
I could pre-create the users in Keycloak if needed.

I’ve found some related development on github:

but I’m not sure about the approach I should take.

Hello! I used User SPI to migrate my legacy users. After successful authentication I saved to keycloak with password.