Skip to content

Commit f00d130

Browse files
authored
Merge pull request #232 from jdev-org/fix-231
Fix #231 - force username from ldap if possible
2 parents cda079a + 7d768ad commit f00d130

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gateway/src/main/java/org/georchestra/gateway/accounts/admin/AbstractAccountsManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ public void createUserOrgUniqueIdIfMissing(@NonNull GeorchestraUser mapped) thro
159159
GeorchestraUser existing = findInternal(mapped).orElse(null);
160160
// verify if user org match between ldap and OAuth2 info
161161
if (!isSameOrgUniqueId(mapped, existing)) {
162+
// force username from ldap instead unknown external username
163+
// See issue #231 : https://github.com/georchestra/georchestra-gateway/issues/231
164+
if (existing != null) {
165+
mapped.setUsername(existing.getUsername());
166+
}
162167
// we find or create org from this orgUniqueId and add user to this org
163168
// unlink
164169
unlinkUserOrg(existing);

0 commit comments

Comments
 (0)