Hello guys,
we have a production enviroment currently authenticating with the company ldap, during the installation we left the UUID value on default, so there is currently a mapping in the db between our ldap cn and the nextcloud UUID which is used as username.
Since we are migrating all the company authentications to Keycloak we installed the oicd plugin for nextcloud but in this case the cn is used by default as username and so if someone tries to log in through keycloak he results as a new user even if he is not.
What is the easiest and least invasive way to do this migration without losing all the users data?
I had the same trouble with an existing nextcloud instance linked to LDAP an implementation of Keyloack with Social Login.
First as @joergschulz stated you need to be sure that you have the sub attribute in the data sent in the JWT token. I mapped it to the LDAP_ID user attribute populated by the Ldap in Keycloak
Then I modified the Social Login code for my needs, actually you can implement a specific behaviour in the UID computation and it is easier than creating a new mapper for KC.
You add your changes in the ProviderService.php class line 462
Before: