fix: handle emty username & email during sync
This commit is contained in:
parent
bd39b29422
commit
30e1df99cc
1 changed files with 10 additions and 3 deletions
|
@ -182,9 +182,16 @@ public class UserAdapter extends Adapter<UserModel, UserResource> {
|
|||
|
||||
@Override
|
||||
public Boolean tryToMap() {
|
||||
var sameUsernameUser = session.users().getUserByUsername(realm, username);
|
||||
var sameEmailUser = session.users().getUserByEmail(realm, email);
|
||||
if ((sameUsernameUser != null && sameEmailUser != null) && sameUsernameUser.getId() != sameEmailUser.getId()) {
|
||||
UserModel sameUsernameUser = null;
|
||||
UserModel sameEmailUser = null;
|
||||
if (username != null) {
|
||||
sameUsernameUser = session.users().getUserByUsername(realm, username);
|
||||
}
|
||||
if (email != null) {
|
||||
sameEmailUser = session.users().getUserByEmail(realm, email);
|
||||
}
|
||||
if ((sameUsernameUser != null && sameEmailUser != null)
|
||||
&& (sameUsernameUser.getId() != sameEmailUser.getId())) {
|
||||
LOGGER.warnf("found 2 possible users for remote user %s %s", username, email);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue