I recently upgraded Keycloak from v12.0.4 to the current latest 15.0.2. Everything went smoothly EXCEPT for the case where a new user registers using Keycloak.
We have an existing SQL database and are using the strategy covered in the server developer guide mentioned here: Server Developer Guide in v12.0.4 (and wish to continue using in 15.0.2 as well)
In v12.0.4, upon successfully validating the user registration form, the user registration class would then hit the success() method, where I have a method setup to store the user in the SQL database. And after storing the user it then goes through our UserProvider.createAdapter() method where it does the strategy mentioned in the developer guide (check for local user, if not there check user-federation, and if found create local user)
Upon updating to 15.0.2, however, I see that it is now performing these actions in the opposite order. It now hits the UserProvider.createAdapter() method, does the check for the local user, sees there isn’t one, then checks the SQL database, sees there isn’t one, and THEN hits the success() method of the registration class and creates the user in the SQL database, causing the newly created local Keycloak user to not be linked to the user-federation (we do not want to call UserModel.setFederationLink method until it finds the SQL user, which it doesn’t since it performs SQL insert last now after the update)
Our registration flow in Keycloak has not changed between versions, so it is my understanding that immediately after the registration class successfully runs through the validate() class that it will then perform the actions in the success() method.
Is this wrong/has changed with the latest Keycloak version? If I need to provide any additional information, screenshots, or anything else, please feel free to let me know. Thank you!