Remove user from KC after removing from federation

This commit is contained in:
mposolda 2015-05-06 16:53:47 +02:00
parent ad606cbce6
commit 0f4497e53e
2 changed files with 12 additions and 3 deletions

View file

@ -63,8 +63,7 @@ public class KerberosFederationProvider implements UserFederationProvider {
@Override
public boolean removeUser(RealmModel realm, UserModel user) {
// TODO: Not sure if federation provider is expected to delete user in localStorage. Looks rather like a bug in UserFederationManager.removeUser .
return session.userStorage().removeUser(realm, user);
return true;
}
@Override

View file

@ -67,7 +67,17 @@ public class UserFederationManager implements UserProvider {
public boolean removeUser(RealmModel realm, UserModel user) {
UserFederationProvider link = getFederationLink(realm, user);
if (link != null) {
return link.removeUser(realm, user);
boolean fedRemoved = link.removeUser(realm, user);
if (fedRemoved) {
boolean localRemoved = session.userStorage().removeUser(realm, user);
if (!localRemoved) {
logger.warn("User removed from federation provider, but failed to remove him from keycloak model");
}
return localRemoved;
} else {
logger.warn("Failed to remove user from federation provider");
return false;
}
}
return session.userStorage().removeUser(realm, user);