From cb0c88182148fd352969383a33f2eeb56cc4de9f Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Tue, 14 Jun 2022 13:58:43 +0200 Subject: [PATCH] rename SingleEntityCredentialManager to SubjectCredentialManager --- .../kerberos/KerberosFederationProvider.java | 4 +- .../storage/ldap/LDAPStorageProvider.java | 4 +- ...SubjectCredentialManagerCacheAdapter.java} | 44 +++++++++---------- .../models/cache/infinispan/UserAdapter.java | 6 +-- .../org/keycloak/models/jpa/UserAdapter.java | 8 ++-- .../storage/adapter/InMemoryUserAdapter.java | 8 ++-- ....java => LegacyUserCredentialManager.java} | 8 ++-- .../AbstractUserAdapterFederatedStorage.java | 8 ++-- ...ger.java => MapUserCredentialManager.java} | 6 +-- .../models/map/user/MapUserProvider.java | 8 ++-- .../credential/UserCredentialStore.java | 6 +-- ...ger.java => SubjectCredentialManager.java} | 2 +- .../models/UserCredentialManager.java | 4 +- .../java/org/keycloak/models/UserModel.java | 2 +- .../models/utils/UserModelDelegate.java | 4 +- .../BackwardsCompatibilityUserStorage.java | 2 - ...ssThroughFederatedUserStorageProvider.java | 2 - .../testsuite/federation/UserMapStorage.java | 2 - .../federation/UserPropertyFileStorage.java | 8 ++-- 19 files changed, 64 insertions(+), 72 deletions(-) rename model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/{SingleEntityCredentialManagerCacheAdapter.java => SubjectCredentialManagerCacheAdapter.java} (62%) rename model/legacy/src/main/java/org/keycloak/credential/{LegacySingleUserCredentialManager.java => LegacyUserCredentialManager.java} (96%) rename model/map/src/main/java/org/keycloak/models/map/credential/{MapSingleUserCredentialManager.java => MapUserCredentialManager.java} (97%) rename server-spi/src/main/java/org/keycloak/models/{SingleEntityCredentialManager.java => SubjectCredentialManager.java} (98%) diff --git a/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java b/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java index eee8e710b3..f0a1a785f7 100755 --- a/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java +++ b/federation/kerberos/src/main/java/org/keycloak/federation/kerberos/KerberosFederationProvider.java @@ -24,7 +24,7 @@ import org.keycloak.credential.CredentialAuthentication; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputValidator; -import org.keycloak.credential.LegacySingleUserCredentialManager; +import org.keycloak.credential.LegacyUserCredentialManager; import org.keycloak.federation.kerberos.impl.KerberosUsernamePasswordAuthenticator; import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator; import org.keycloak.models.CredentialValidationOutput; @@ -169,7 +169,7 @@ public class KerberosFederationProvider implements UserStorageProvider, @Override public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) { if (!(input instanceof UserCredentialModel)) return false; - if (input.getType().equals(PasswordCredentialModel.TYPE) && !((LegacySingleUserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { + if (input.getType().equals(PasswordCredentialModel.TYPE) && !((LegacyUserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { return validPassword(user.getUsername(), input.getChallengeResponse()); } else { return false; // invalid cred type diff --git a/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java b/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java index d66aa59993..754cdaa1fc 100755 --- a/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java +++ b/federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java @@ -36,7 +36,7 @@ import org.keycloak.credential.CredentialAuthentication; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputValidator; -import org.keycloak.credential.LegacySingleUserCredentialManager; +import org.keycloak.credential.LegacyUserCredentialManager; import org.keycloak.federation.kerberos.impl.KerberosUsernamePasswordAuthenticator; import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator; import org.keycloak.models.CredentialValidationOutput; @@ -715,7 +715,7 @@ public class LDAPStorageProvider implements UserStorageProvider, @Override public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) { if (!(input instanceof UserCredentialModel)) return false; - if (input.getType().equals(PasswordCredentialModel.TYPE) && !((LegacySingleUserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { + if (input.getType().equals(PasswordCredentialModel.TYPE) && !((LegacyUserCredentialManager) user.credentialManager()).isConfiguredLocally(PasswordCredentialModel.TYPE)) { return validPassword(realm, user, input.getChallengeResponse()); } else { return false; // invalid cred type diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SingleEntityCredentialManagerCacheAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SubjectCredentialManagerCacheAdapter.java similarity index 62% rename from model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SingleEntityCredentialManagerCacheAdapter.java rename to model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SubjectCredentialManagerCacheAdapter.java index 978c75d863..a509754dad 100644 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SingleEntityCredentialManagerCacheAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/SubjectCredentialManagerCacheAdapter.java @@ -19,7 +19,7 @@ package org.keycloak.models.cache.infinispan; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialModel; -import org.keycloak.models.SingleEntityCredentialManager; +import org.keycloak.models.SubjectCredentialManager; import java.util.List; import java.util.stream.Stream; @@ -27,12 +27,12 @@ import java.util.stream.Stream; /** * @author Alexander Schwartz */ -public abstract class SingleEntityCredentialManagerCacheAdapter implements SingleEntityCredentialManager { +public abstract class SubjectCredentialManagerCacheAdapter implements SubjectCredentialManager { - private final SingleEntityCredentialManager singleEntityCredentialManager; + private final SubjectCredentialManager subjectCredentialManager; - protected SingleEntityCredentialManagerCacheAdapter(SingleEntityCredentialManager singleEntityCredentialManager) { - this.singleEntityCredentialManager = singleEntityCredentialManager; + protected SubjectCredentialManagerCacheAdapter(SubjectCredentialManager subjectCredentialManager) { + this.subjectCredentialManager = subjectCredentialManager; } public abstract void invalidateCacheForEntity(); @@ -42,95 +42,95 @@ public abstract class SingleEntityCredentialManagerCacheAdapter implements Singl // validating a password might still update its hashes, similar logic might apply to OTP logic // instead of having each invalidateCacheForEntity(); - return singleEntityCredentialManager.isValid(inputs); + return subjectCredentialManager.isValid(inputs); } @Override public boolean updateCredential(CredentialInput input) { invalidateCacheForEntity(); - return singleEntityCredentialManager.updateCredential(input); + return subjectCredentialManager.updateCredential(input); } @Override public void updateStoredCredential(CredentialModel cred) { invalidateCacheForEntity(); - singleEntityCredentialManager.updateStoredCredential(cred); + subjectCredentialManager.updateStoredCredential(cred); } @Override public CredentialModel createStoredCredential(CredentialModel cred) { invalidateCacheForEntity(); - return singleEntityCredentialManager.createStoredCredential(cred); + return subjectCredentialManager.createStoredCredential(cred); } @Override public boolean removeStoredCredentialById(String id) { invalidateCacheForEntity(); - return singleEntityCredentialManager.removeStoredCredentialById(id); + return subjectCredentialManager.removeStoredCredentialById(id); } @Override public CredentialModel getStoredCredentialById(String id) { - return singleEntityCredentialManager.getStoredCredentialById(id); + return subjectCredentialManager.getStoredCredentialById(id); } @Override public Stream getStoredCredentialsStream() { - return singleEntityCredentialManager.getStoredCredentialsStream(); + return subjectCredentialManager.getStoredCredentialsStream(); } @Override public Stream getStoredCredentialsByTypeStream(String type) { - return singleEntityCredentialManager.getStoredCredentialsByTypeStream(type); + return subjectCredentialManager.getStoredCredentialsByTypeStream(type); } @Override public CredentialModel getStoredCredentialByNameAndType(String name, String type) { - return singleEntityCredentialManager.getStoredCredentialByNameAndType(name, type); + return subjectCredentialManager.getStoredCredentialByNameAndType(name, type); } @Override public boolean moveStoredCredentialTo(String id, String newPreviousCredentialId) { invalidateCacheForEntity(); - return singleEntityCredentialManager.moveStoredCredentialTo(id, newPreviousCredentialId); + return subjectCredentialManager.moveStoredCredentialTo(id, newPreviousCredentialId); } @Override public void updateCredentialLabel(String credentialId, String userLabel) { invalidateCacheForEntity(); - singleEntityCredentialManager.updateCredentialLabel(credentialId, userLabel); + subjectCredentialManager.updateCredentialLabel(credentialId, userLabel); } @Override public void disableCredentialType(String credentialType) { invalidateCacheForEntity(); - singleEntityCredentialManager.disableCredentialType(credentialType); + subjectCredentialManager.disableCredentialType(credentialType); } @Override public Stream getDisableableCredentialTypesStream() { - return singleEntityCredentialManager.getDisableableCredentialTypesStream(); + return subjectCredentialManager.getDisableableCredentialTypesStream(); } @Override public boolean isConfiguredFor(String type) { - return singleEntityCredentialManager.isConfiguredFor(type); + return subjectCredentialManager.isConfiguredFor(type); } @Override public boolean isConfiguredLocally(String type) { - return singleEntityCredentialManager.isConfiguredLocally(type); + return subjectCredentialManager.isConfiguredLocally(type); } @Override public Stream getConfiguredUserStorageCredentialTypesStream() { - return singleEntityCredentialManager.getConfiguredUserStorageCredentialTypesStream(); + return subjectCredentialManager.getConfiguredUserStorageCredentialTypesStream(); } @Override public CredentialModel createCredentialThroughProvider(CredentialModel model) { invalidateCacheForEntity(); - return singleEntityCredentialManager.createCredentialThroughProvider(model); + return subjectCredentialManager.createCredentialThroughProvider(model); } } diff --git a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java index 5cbdb559f1..3e782c352c 100755 --- a/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java +++ b/model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/UserAdapter.java @@ -23,7 +23,7 @@ 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.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.models.cache.CachedUserModel; import org.keycloak.models.cache.infinispan.entities.CachedUser; @@ -287,12 +287,12 @@ public class UserAdapter implements CachedUserModel.Streams { } @Override - public SingleEntityCredentialManager credentialManager() { + public SubjectCredentialManager credentialManager() { if (updated == null) { updated = modelSupplier.get(); if (updated == null) throw new IllegalStateException("Not found in database"); } - return new SingleEntityCredentialManagerCacheAdapter(updated.credentialManager()) { + return new SubjectCredentialManagerCacheAdapter(updated.credentialManager()) { @Override public CredentialModel getStoredCredentialById(String id) { if (!userRegisteredForInvalidation) { diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java b/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java index 275a40c326..6387b0be64 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/UserAdapter.java @@ -19,13 +19,13 @@ package org.keycloak.models.jpa; import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.common.util.ObjectUtil; -import org.keycloak.credential.LegacySingleUserCredentialManager; +import org.keycloak.credential.LegacyUserCredentialManager; 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.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.models.jpa.entities.UserAttributeEntity; import org.keycloak.models.jpa.entities.UserEntity; @@ -518,8 +518,8 @@ public class UserAdapter implements UserModel.Streams, JpaModel { } @Override - public SingleEntityCredentialManager credentialManager() { - return new LegacySingleUserCredentialManager(session, realm, this); + public SubjectCredentialManager credentialManager() { + return new LegacyUserCredentialManager(session, realm, this); } diff --git a/model/legacy-private/src/main/java/org/keycloak/storage/adapter/InMemoryUserAdapter.java b/model/legacy-private/src/main/java/org/keycloak/storage/adapter/InMemoryUserAdapter.java index f531623d92..dc8c69dda0 100644 --- a/model/legacy-private/src/main/java/org/keycloak/storage/adapter/InMemoryUserAdapter.java +++ b/model/legacy-private/src/main/java/org/keycloak/storage/adapter/InMemoryUserAdapter.java @@ -18,13 +18,13 @@ package org.keycloak.storage.adapter; import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.common.util.Time; -import org.keycloak.credential.LegacySingleUserCredentialManager; +import org.keycloak.credential.LegacyUserCredentialManager; 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.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.models.UserModelDefaultMethods; import org.keycloak.models.utils.KeycloakModelUtils; @@ -257,8 +257,8 @@ public class InMemoryUserAdapter extends UserModelDefaultMethods.Streams { } @Override - public SingleEntityCredentialManager credentialManager() { - return new LegacySingleUserCredentialManager(session, realm, this); + public SubjectCredentialManager credentialManager() { + return new LegacyUserCredentialManager(session, realm, this); } @Override diff --git a/model/legacy/src/main/java/org/keycloak/credential/LegacySingleUserCredentialManager.java b/model/legacy/src/main/java/org/keycloak/credential/LegacyUserCredentialManager.java similarity index 96% rename from model/legacy/src/main/java/org/keycloak/credential/LegacySingleUserCredentialManager.java rename to model/legacy/src/main/java/org/keycloak/credential/LegacyUserCredentialManager.java index 6b187e5049..562a723701 100644 --- a/model/legacy/src/main/java/org/keycloak/credential/LegacySingleUserCredentialManager.java +++ b/model/legacy/src/main/java/org/keycloak/credential/LegacyUserCredentialManager.java @@ -20,7 +20,7 @@ package org.keycloak.credential; import org.keycloak.common.util.reflections.Types; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; -import org.keycloak.models.SingleEntityCredentialManager; +import org.keycloak.models.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.storage.AbstractStorageManager; import org.keycloak.storage.DatastoreProvider; @@ -38,17 +38,15 @@ import java.util.stream.Stream; /** * Handling credentials for a given user for the legacy store. * - * Its companion is the MapSingleUserCredentialManagerStrategy that doesn't contain storage related elements. - * * @author Alexander Schwartz */ -public class LegacySingleUserCredentialManager extends AbstractStorageManager implements SingleEntityCredentialManager { +public class LegacyUserCredentialManager extends AbstractStorageManager implements SubjectCredentialManager { private final UserModel user; private final KeycloakSession session; private final RealmModel realm; - public LegacySingleUserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user) { + public LegacyUserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user) { super(session, UserStorageProviderFactory.class, UserStorageProvider.class, UserStorageProviderModel::new, "user"); this.user = user; this.session = session; diff --git a/model/legacy/src/main/java/org/keycloak/storage/adapter/AbstractUserAdapterFederatedStorage.java b/model/legacy/src/main/java/org/keycloak/storage/adapter/AbstractUserAdapterFederatedStorage.java index 15c37b28f6..116edd7f95 100644 --- a/model/legacy/src/main/java/org/keycloak/storage/adapter/AbstractUserAdapterFederatedStorage.java +++ b/model/legacy/src/main/java/org/keycloak/storage/adapter/AbstractUserAdapterFederatedStorage.java @@ -18,13 +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.credential.LegacyUserCredentialManager; 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.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.models.UserModelDefaultMethods; import org.keycloak.models.utils.RoleUtils; @@ -404,8 +404,8 @@ public abstract class AbstractUserAdapterFederatedStorage extends UserModelDefau } @Override - public SingleEntityCredentialManager credentialManager() { - return new LegacySingleUserCredentialManager(session, realm, this); + public SubjectCredentialManager credentialManager() { + return new LegacyUserCredentialManager(session, realm, this); } @Override diff --git a/model/map/src/main/java/org/keycloak/models/map/credential/MapSingleUserCredentialManager.java b/model/map/src/main/java/org/keycloak/models/map/credential/MapUserCredentialManager.java similarity index 97% rename from model/map/src/main/java/org/keycloak/models/map/credential/MapSingleUserCredentialManager.java rename to model/map/src/main/java/org/keycloak/models/map/credential/MapUserCredentialManager.java index 3c1a00a64c..0b6eb1d239 100644 --- a/model/map/src/main/java/org/keycloak/models/map/credential/MapSingleUserCredentialManager.java +++ b/model/map/src/main/java/org/keycloak/models/map/credential/MapUserCredentialManager.java @@ -27,7 +27,7 @@ import org.keycloak.credential.CredentialProviderFactory; import org.keycloak.models.KeycloakSession; import org.keycloak.models.ModelDuplicateException; import org.keycloak.models.RealmModel; -import org.keycloak.models.SingleEntityCredentialManager; +import org.keycloak.models.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.models.map.user.MapUserCredentialEntity; import org.keycloak.models.map.user.MapUserEntity; @@ -47,14 +47,14 @@ import java.util.stream.Stream; * * @author Alexander Schwartz */ -public class MapSingleUserCredentialManager implements SingleEntityCredentialManager { +public class MapUserCredentialManager implements SubjectCredentialManager { private final UserModel user; private final KeycloakSession session; private final RealmModel realm; private final MapUserEntity entity; - public MapSingleUserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user, MapUserEntity entity) { + public MapUserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user, MapUserEntity entity) { this.user = user; this.session = session; this.realm = realm; diff --git a/model/map/src/main/java/org/keycloak/models/map/user/MapUserProvider.java b/model/map/src/main/java/org/keycloak/models/map/user/MapUserProvider.java index 3013fdb473..3c9143a88f 100644 --- a/model/map/src/main/java/org/keycloak/models/map/user/MapUserProvider.java +++ b/model/map/src/main/java/org/keycloak/models/map/user/MapUserProvider.java @@ -41,13 +41,13 @@ import org.keycloak.models.ProtocolMapperModel; import org.keycloak.models.RealmModel; import org.keycloak.models.RequiredActionProviderModel; import org.keycloak.models.RoleModel; -import org.keycloak.models.SingleEntityCredentialManager; +import org.keycloak.models.SubjectCredentialManager; import org.keycloak.models.UserConsentModel; import org.keycloak.models.UserModel; import org.keycloak.models.UserModel.SearchableFields; import org.keycloak.models.UserProvider; import org.keycloak.models.map.common.TimeAdapter; -import org.keycloak.models.map.credential.MapSingleUserCredentialManager; +import org.keycloak.models.map.credential.MapUserCredentialManager; import org.keycloak.models.map.storage.MapKeycloakTransactionWithAuth; import org.keycloak.models.map.storage.MapKeycloakTransaction; import org.keycloak.models.map.storage.MapStorage; @@ -110,8 +110,8 @@ public class MapUserProvider implements UserProvider.Streams { } @Override - public SingleEntityCredentialManager credentialManager() { - return new MapSingleUserCredentialManager(session, realm, this, entity); + public SubjectCredentialManager credentialManager() { + return new MapUserCredentialManager(session, realm, this, entity); } }; } diff --git a/server-spi/src/main/java/org/keycloak/credential/UserCredentialStore.java b/server-spi/src/main/java/org/keycloak/credential/UserCredentialStore.java index f2835fd7bd..4a81715921 100644 --- a/server-spi/src/main/java/org/keycloak/credential/UserCredentialStore.java +++ b/server-spi/src/main/java/org/keycloak/credential/UserCredentialStore.java @@ -17,7 +17,7 @@ package org.keycloak.credential; import org.keycloak.models.RealmModel; -import org.keycloak.models.SingleEntityCredentialManager; +import org.keycloak.models.SubjectCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.provider.Provider; @@ -47,7 +47,7 @@ public interface UserCredentialStore extends Provider { CredentialModel getStoredCredentialById(RealmModel realm, UserModel user, String id); /** - * @deprecated Use {@link SingleEntityCredentialManager#getStoredCredentialsStream()} instead. + * @deprecated Use {@link SubjectCredentialManager#getStoredCredentialsStream()} instead. */ @Deprecated List getStoredCredentials(RealmModel realm, UserModel user); @@ -65,7 +65,7 @@ public interface UserCredentialStore extends Provider { } /** - * @deprecated Use {@link SingleEntityCredentialManager#getStoredCredentialsByTypeStream(String)} + * @deprecated Use {@link SubjectCredentialManager#getStoredCredentialsByTypeStream(String)} * instead. */ @Deprecated diff --git a/server-spi/src/main/java/org/keycloak/models/SingleEntityCredentialManager.java b/server-spi/src/main/java/org/keycloak/models/SubjectCredentialManager.java similarity index 98% rename from server-spi/src/main/java/org/keycloak/models/SingleEntityCredentialManager.java rename to server-spi/src/main/java/org/keycloak/models/SubjectCredentialManager.java index 9933b8e86b..2ad85d3cbc 100644 --- a/server-spi/src/main/java/org/keycloak/models/SingleEntityCredentialManager.java +++ b/server-spi/src/main/java/org/keycloak/models/SubjectCredentialManager.java @@ -27,7 +27,7 @@ import java.util.stream.Stream; /** * Validates and manages the credentials of a known entity (for example, a user). */ -public interface SingleEntityCredentialManager { +public interface SubjectCredentialManager { /** * Validate a list of credentials. diff --git a/server-spi/src/main/java/org/keycloak/models/UserCredentialManager.java b/server-spi/src/main/java/org/keycloak/models/UserCredentialManager.java index b2096a65c2..bdbf125bbe 100644 --- a/server-spi/src/main/java/org/keycloak/models/UserCredentialManager.java +++ b/server-spi/src/main/java/org/keycloak/models/UserCredentialManager.java @@ -101,7 +101,7 @@ public interface UserCredentialManager extends UserCredentialStore { * @param realm * @param user * @return - * @deprecated Use {@link UserModel#credentialManager()} and {@link SingleEntityCredentialManager#getDisableableCredentialTypesStream()} instead. + * @deprecated Use {@link UserModel#credentialManager()} and {@link SubjectCredentialManager#getDisableableCredentialTypesStream()} instead. */ @Deprecated Set getDisableableCredentialTypes(RealmModel realm, UserModel user); @@ -158,7 +158,7 @@ public interface UserCredentialManager extends UserCredentialStore { * Return credential types, which are provided by the user storage where user is stored. Returned values can contain for example "password", "otp" etc. * This will always return empty list for "local" users, which are not backed by any user storage * - * @deprecated Use {@link UserModel#credentialManager()} and then call {@link SingleEntityCredentialManager#getConfiguredUserStorageCredentialTypesStream()} + * @deprecated Use {@link UserModel#credentialManager()} and then call {@link SubjectCredentialManager#getConfiguredUserStorageCredentialTypesStream()} * instead. */ @Deprecated diff --git a/server-spi/src/main/java/org/keycloak/models/UserModel.java b/server-spi/src/main/java/org/keycloak/models/UserModel.java index fff4ee4f62..0669ccfdc2 100755 --- a/server-spi/src/main/java/org/keycloak/models/UserModel.java +++ b/server-spi/src/main/java/org/keycloak/models/UserModel.java @@ -301,7 +301,7 @@ public interface UserModel extends RoleMapperModel { /** * Instance of a user credential manager to validate and update the credentials of this user. */ - SingleEntityCredentialManager credentialManager(); + SubjectCredentialManager credentialManager(); enum RequiredAction { VERIFY_EMAIL, diff --git a/server-spi/src/main/java/org/keycloak/models/utils/UserModelDelegate.java b/server-spi/src/main/java/org/keycloak/models/utils/UserModelDelegate.java index fb9b213396..fe628a89db 100755 --- a/server-spi/src/main/java/org/keycloak/models/utils/UserModelDelegate.java +++ b/server-spi/src/main/java/org/keycloak/models/utils/UserModelDelegate.java @@ -20,7 +20,7 @@ package org.keycloak.models.utils; import org.keycloak.models.ClientModel; import org.keycloak.models.GroupModel; import org.keycloak.models.RoleModel; -import org.keycloak.models.SingleEntityCredentialManager; +import org.keycloak.models.SubjectCredentialManager; import org.keycloak.models.UserModel; import java.util.List; @@ -211,7 +211,7 @@ public class UserModelDelegate implements UserModel.Streams { } @Override - public SingleEntityCredentialManager credentialManager() { + public SubjectCredentialManager credentialManager() { return delegate.credentialManager(); } diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/BackwardsCompatibilityUserStorage.java b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/BackwardsCompatibilityUserStorage.java index fc6c56d737..54ecb5e8fc 100644 --- a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/BackwardsCompatibilityUserStorage.java +++ b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/BackwardsCompatibilityUserStorage.java @@ -33,14 +33,12 @@ import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputValidator; import org.keycloak.credential.CredentialModel; -import org.keycloak.credential.LegacySingleUserCredentialManager; import org.keycloak.credential.hash.PasswordHashProvider; import org.keycloak.models.GroupModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.OTPPolicy; import org.keycloak.models.PasswordPolicy; import org.keycloak.models.RealmModel; -import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserModel; import org.keycloak.models.cache.UserCache; diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/PassThroughFederatedUserStorageProvider.java b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/PassThroughFederatedUserStorageProvider.java index 3a79435d31..936c3e8ebf 100644 --- a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/PassThroughFederatedUserStorageProvider.java +++ b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/PassThroughFederatedUserStorageProvider.java @@ -21,10 +21,8 @@ import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputValidator; import org.keycloak.credential.CredentialModel; -import org.keycloak.credential.LegacySingleUserCredentialManager; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; -import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.UserModel; import org.keycloak.models.credential.PasswordCredentialModel; import org.keycloak.storage.StorageId; diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserMapStorage.java b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserMapStorage.java index 131024e138..06c575fce5 100644 --- a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserMapStorage.java +++ b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserMapStorage.java @@ -21,13 +21,11 @@ import org.keycloak.component.ComponentModel; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputValidator; -import org.keycloak.credential.LegacySingleUserCredentialManager; import org.keycloak.models.GroupModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.LDAPConstants; import org.keycloak.models.RealmModel; import org.keycloak.models.RoleModel; -import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserModel; import org.keycloak.models.credential.PasswordCredentialModel; diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java index a2b5800a32..19b029073a 100644 --- a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java +++ b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/UserPropertyFileStorage.java @@ -19,12 +19,12 @@ package org.keycloak.testsuite.federation; import org.keycloak.component.ComponentModel; import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInputValidator; -import org.keycloak.credential.LegacySingleUserCredentialManager; +import org.keycloak.credential.LegacyUserCredentialManager; 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.SubjectCredentialManager; import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserModel; import org.keycloak.models.credential.PasswordCredentialModel; @@ -143,8 +143,8 @@ public class UserPropertyFileStorage implements UserLookupProvider.Streams, User } @Override - public SingleEntityCredentialManager credentialManager() { - return new LegacySingleUserCredentialManager(session, realm, this); + public SubjectCredentialManager credentialManager() { + return new LegacyUserCredentialManager(session, realm, this); } }; }