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
|
@Override
|
||||||
public Boolean tryToMap() {
|
public Boolean tryToMap() {
|
||||||
var sameUsernameUser = session.users().getUserByUsername(realm, username);
|
UserModel sameUsernameUser = null;
|
||||||
var sameEmailUser = session.users().getUserByEmail(realm, email);
|
UserModel sameEmailUser = null;
|
||||||
if ((sameUsernameUser != null && sameEmailUser != null) && sameUsernameUser.getId() != sameEmailUser.getId()) {
|
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);
|
LOGGER.warnf("found 2 possible users for remote user %s %s", username, email);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue