Simplify implementation of a federated storage by moving the default implementation to the abstract base class; this will also allow the quickstarts and implementations derived from that to run without changes.

This commit is contained in:
Alexander Schwartz 2022-05-24 10:32:56 +02:00 committed by Hynek Mlnařík
parent 08bbb1fb92
commit 1a227212de
5 changed files with 7 additions and 20 deletions

View file

@ -18,11 +18,13 @@ package org.keycloak.storage.adapter;
import org.keycloak.common.util.MultivaluedHashMap;
import org.keycloak.component.ComponentModel;
import org.keycloak.credential.LegacySingleUserCredentialManager;
import org.keycloak.models.ClientModel;
import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager;
import org.keycloak.models.UserModel;
import org.keycloak.models.UserModelDefaultMethods;
import org.keycloak.models.utils.RoleUtils;
@ -400,6 +402,11 @@ public abstract class AbstractUserAdapterFederatedStorage extends UserModelDefau
}
@Override
public SingleEntityCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View file

@ -102,11 +102,6 @@ public class BackwardsCompatibilityUserStorage implements UserLookupProvider, Us
throw new RuntimeException("Unsupported to change username");
}
}
@Override
public SingleEntityCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this);
}
};
}

View file

@ -165,11 +165,6 @@ public class PassThroughFederatedUserStorageProvider implements
@Override
public void setUsername(String username) {
}
@Override
public SingleEntityCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this);
}
};
}
}

View file

@ -144,11 +144,6 @@ public class UserMapStorage implements UserLookupProvider.Streams, UserStoragePr
public String getFederationLink() {
return model.getId();
}
@Override
public SingleEntityCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this);
}
};
}

View file

@ -134,11 +134,6 @@ public class UserPropertyFileStorage implements UserLookupProvider.Streams, User
public void setUsername(String username) {
throw new RuntimeException("Unsupported");
}
@Override
public SingleEntityCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this);
}
};
} else {
return new AbstractUserAdapter.Streams(session, realm, model) {