Co-Existing of local users and AD users & their database entry creation #658
-
Hello, i am trying to have both, local users and AD users in my application, with the option to create local users via my UI. Additionally i allow admin users to adjust the ldap config using the UI to adjust port, host, base dn ... Now lets say a admin user has not configured the connection to the AD yet and a local user is created with their AD mail as the (unique) email field. Now i got a local user in my database using their AD mail address (but without guid & domain, which i am storing for AD users). Now to the problem: If the admin then enables AD users to join and the user (who already created a local user) now uses their email address of their AD account and tries to log in, i get a 500 error due to LdapRecord trying to create a database entry, even though the email already exists in the database. Does anyone have an idea on how to catch that specific edge case? Any help is appreciated :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @jonaskindermann, Yes this use-case is built into LdapRecord-Laravel: https://ldaprecord.com/docs/laravel/v3/auth/database/configuration/#sync-existing-records Add the 'providers' => [
// ...
'users' => [
// ...
'database' => [
// ...
'sync_existing' => [
'email' => 'mail',
],
],
],
], |
Beta Was this translation helpful? Give feedback.
Hi @jonaskindermann,
Remove
'name' => 'cn'
from thesync_existing
array and try again. This is likely the cause:'sync_existing' => [ - 'name' => 'cn', 'email' => 'mail', ],