rename SingleEntityCredentialManager to SubjectCredentialManager

This commit is contained in:
Alexander Schwartz 2022-06-14 13:58:43 +02:00 committed by Hynek Mlnařík
parent 84d21f0230
commit cb0c881821
19 changed files with 64 additions and 72 deletions

View file

@ -24,7 +24,7 @@ import org.keycloak.credential.CredentialAuthentication;
import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputUpdater;
import org.keycloak.credential.CredentialInputValidator; 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.KerberosUsernamePasswordAuthenticator;
import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator; import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator;
import org.keycloak.models.CredentialValidationOutput; import org.keycloak.models.CredentialValidationOutput;
@ -169,7 +169,7 @@ public class KerberosFederationProvider implements UserStorageProvider,
@Override @Override
public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) { public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) {
if (!(input instanceof UserCredentialModel)) return false; 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()); return validPassword(user.getUsername(), input.getChallengeResponse());
} else { } else {
return false; // invalid cred type return false; // invalid cred type

View file

@ -36,7 +36,7 @@ import org.keycloak.credential.CredentialAuthentication;
import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputUpdater;
import org.keycloak.credential.CredentialInputValidator; 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.KerberosUsernamePasswordAuthenticator;
import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator; import org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator;
import org.keycloak.models.CredentialValidationOutput; import org.keycloak.models.CredentialValidationOutput;
@ -715,7 +715,7 @@ public class LDAPStorageProvider implements UserStorageProvider,
@Override @Override
public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) { public boolean isValid(RealmModel realm, UserModel user, CredentialInput input) {
if (!(input instanceof UserCredentialModel)) return false; 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()); return validPassword(realm, user, input.getChallengeResponse());
} else { } else {
return false; // invalid cred type return false; // invalid cred type

View file

@ -19,7 +19,7 @@ package org.keycloak.models.cache.infinispan;
import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialModel; import org.keycloak.credential.CredentialModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import java.util.List; import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -27,12 +27,12 @@ import java.util.stream.Stream;
/** /**
* @author Alexander Schwartz * @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) { protected SubjectCredentialManagerCacheAdapter(SubjectCredentialManager subjectCredentialManager) {
this.singleEntityCredentialManager = singleEntityCredentialManager; this.subjectCredentialManager = subjectCredentialManager;
} }
public abstract void invalidateCacheForEntity(); 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 // validating a password might still update its hashes, similar logic might apply to OTP logic
// instead of having each // instead of having each
invalidateCacheForEntity(); invalidateCacheForEntity();
return singleEntityCredentialManager.isValid(inputs); return subjectCredentialManager.isValid(inputs);
} }
@Override @Override
public boolean updateCredential(CredentialInput input) { public boolean updateCredential(CredentialInput input) {
invalidateCacheForEntity(); invalidateCacheForEntity();
return singleEntityCredentialManager.updateCredential(input); return subjectCredentialManager.updateCredential(input);
} }
@Override @Override
public void updateStoredCredential(CredentialModel cred) { public void updateStoredCredential(CredentialModel cred) {
invalidateCacheForEntity(); invalidateCacheForEntity();
singleEntityCredentialManager.updateStoredCredential(cred); subjectCredentialManager.updateStoredCredential(cred);
} }
@Override @Override
public CredentialModel createStoredCredential(CredentialModel cred) { public CredentialModel createStoredCredential(CredentialModel cred) {
invalidateCacheForEntity(); invalidateCacheForEntity();
return singleEntityCredentialManager.createStoredCredential(cred); return subjectCredentialManager.createStoredCredential(cred);
} }
@Override @Override
public boolean removeStoredCredentialById(String id) { public boolean removeStoredCredentialById(String id) {
invalidateCacheForEntity(); invalidateCacheForEntity();
return singleEntityCredentialManager.removeStoredCredentialById(id); return subjectCredentialManager.removeStoredCredentialById(id);
} }
@Override @Override
public CredentialModel getStoredCredentialById(String id) { public CredentialModel getStoredCredentialById(String id) {
return singleEntityCredentialManager.getStoredCredentialById(id); return subjectCredentialManager.getStoredCredentialById(id);
} }
@Override @Override
public Stream<CredentialModel> getStoredCredentialsStream() { public Stream<CredentialModel> getStoredCredentialsStream() {
return singleEntityCredentialManager.getStoredCredentialsStream(); return subjectCredentialManager.getStoredCredentialsStream();
} }
@Override @Override
public Stream<CredentialModel> getStoredCredentialsByTypeStream(String type) { public Stream<CredentialModel> getStoredCredentialsByTypeStream(String type) {
return singleEntityCredentialManager.getStoredCredentialsByTypeStream(type); return subjectCredentialManager.getStoredCredentialsByTypeStream(type);
} }
@Override @Override
public CredentialModel getStoredCredentialByNameAndType(String name, String type) { public CredentialModel getStoredCredentialByNameAndType(String name, String type) {
return singleEntityCredentialManager.getStoredCredentialByNameAndType(name, type); return subjectCredentialManager.getStoredCredentialByNameAndType(name, type);
} }
@Override @Override
public boolean moveStoredCredentialTo(String id, String newPreviousCredentialId) { public boolean moveStoredCredentialTo(String id, String newPreviousCredentialId) {
invalidateCacheForEntity(); invalidateCacheForEntity();
return singleEntityCredentialManager.moveStoredCredentialTo(id, newPreviousCredentialId); return subjectCredentialManager.moveStoredCredentialTo(id, newPreviousCredentialId);
} }
@Override @Override
public void updateCredentialLabel(String credentialId, String userLabel) { public void updateCredentialLabel(String credentialId, String userLabel) {
invalidateCacheForEntity(); invalidateCacheForEntity();
singleEntityCredentialManager.updateCredentialLabel(credentialId, userLabel); subjectCredentialManager.updateCredentialLabel(credentialId, userLabel);
} }
@Override @Override
public void disableCredentialType(String credentialType) { public void disableCredentialType(String credentialType) {
invalidateCacheForEntity(); invalidateCacheForEntity();
singleEntityCredentialManager.disableCredentialType(credentialType); subjectCredentialManager.disableCredentialType(credentialType);
} }
@Override @Override
public Stream<String> getDisableableCredentialTypesStream() { public Stream<String> getDisableableCredentialTypesStream() {
return singleEntityCredentialManager.getDisableableCredentialTypesStream(); return subjectCredentialManager.getDisableableCredentialTypesStream();
} }
@Override @Override
public boolean isConfiguredFor(String type) { public boolean isConfiguredFor(String type) {
return singleEntityCredentialManager.isConfiguredFor(type); return subjectCredentialManager.isConfiguredFor(type);
} }
@Override @Override
public boolean isConfiguredLocally(String type) { public boolean isConfiguredLocally(String type) {
return singleEntityCredentialManager.isConfiguredLocally(type); return subjectCredentialManager.isConfiguredLocally(type);
} }
@Override @Override
public Stream<String> getConfiguredUserStorageCredentialTypesStream() { public Stream<String> getConfiguredUserStorageCredentialTypesStream() {
return singleEntityCredentialManager.getConfiguredUserStorageCredentialTypesStream(); return subjectCredentialManager.getConfiguredUserStorageCredentialTypesStream();
} }
@Override @Override
public CredentialModel createCredentialThroughProvider(CredentialModel model) { public CredentialModel createCredentialThroughProvider(CredentialModel model) {
invalidateCacheForEntity(); invalidateCacheForEntity();
return singleEntityCredentialManager.createCredentialThroughProvider(model); return subjectCredentialManager.createCredentialThroughProvider(model);
} }
} }

View file

@ -23,7 +23,7 @@ import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.cache.CachedUserModel; import org.keycloak.models.cache.CachedUserModel;
import org.keycloak.models.cache.infinispan.entities.CachedUser; import org.keycloak.models.cache.infinispan.entities.CachedUser;
@ -287,12 +287,12 @@ public class UserAdapter implements CachedUserModel.Streams {
} }
@Override @Override
public SingleEntityCredentialManager credentialManager() { public SubjectCredentialManager credentialManager() {
if (updated == null) { if (updated == null) {
updated = modelSupplier.get(); updated = modelSupplier.get();
if (updated == null) throw new IllegalStateException("Not found in database"); if (updated == null) throw new IllegalStateException("Not found in database");
} }
return new SingleEntityCredentialManagerCacheAdapter(updated.credentialManager()) { return new SubjectCredentialManagerCacheAdapter(updated.credentialManager()) {
@Override @Override
public CredentialModel getStoredCredentialById(String id) { public CredentialModel getStoredCredentialById(String id) {
if (!userRegisteredForInvalidation) { if (!userRegisteredForInvalidation) {

View file

@ -19,13 +19,13 @@ package org.keycloak.models.jpa;
import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.common.util.MultivaluedHashMap;
import org.keycloak.common.util.ObjectUtil; 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.ClientModel;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.jpa.entities.UserAttributeEntity; import org.keycloak.models.jpa.entities.UserAttributeEntity;
import org.keycloak.models.jpa.entities.UserEntity; import org.keycloak.models.jpa.entities.UserEntity;
@ -518,8 +518,8 @@ public class UserAdapter implements UserModel.Streams, JpaModel<UserEntity> {
} }
@Override @Override
public SingleEntityCredentialManager credentialManager() { public SubjectCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this); return new LegacyUserCredentialManager(session, realm, this);
} }

View file

@ -18,13 +18,13 @@ package org.keycloak.storage.adapter;
import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.common.util.MultivaluedHashMap;
import org.keycloak.common.util.Time; 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.ClientModel;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.UserModelDefaultMethods; import org.keycloak.models.UserModelDefaultMethods;
import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.models.utils.KeycloakModelUtils;
@ -257,8 +257,8 @@ public class InMemoryUserAdapter extends UserModelDefaultMethods.Streams {
} }
@Override @Override
public SingleEntityCredentialManager credentialManager() { public SubjectCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this); return new LegacyUserCredentialManager(session, realm, this);
} }
@Override @Override

View file

@ -20,7 +20,7 @@ package org.keycloak.credential;
import org.keycloak.common.util.reflections.Types; import org.keycloak.common.util.reflections.Types;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.storage.AbstractStorageManager; import org.keycloak.storage.AbstractStorageManager;
import org.keycloak.storage.DatastoreProvider; import org.keycloak.storage.DatastoreProvider;
@ -38,17 +38,15 @@ import java.util.stream.Stream;
/** /**
* Handling credentials for a given user for the legacy store. * 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 * @author Alexander Schwartz
*/ */
public class LegacySingleUserCredentialManager extends AbstractStorageManager<UserStorageProvider, UserStorageProviderModel> implements SingleEntityCredentialManager { public class LegacyUserCredentialManager extends AbstractStorageManager<UserStorageProvider, UserStorageProviderModel> implements SubjectCredentialManager {
private final UserModel user; private final UserModel user;
private final KeycloakSession session; private final KeycloakSession session;
private final RealmModel realm; 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"); super(session, UserStorageProviderFactory.class, UserStorageProvider.class, UserStorageProviderModel::new, "user");
this.user = user; this.user = user;
this.session = session; this.session = session;

View file

@ -18,13 +18,13 @@ package org.keycloak.storage.adapter;
import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.common.util.MultivaluedHashMap;
import org.keycloak.component.ComponentModel; import org.keycloak.component.ComponentModel;
import org.keycloak.credential.LegacySingleUserCredentialManager; import org.keycloak.credential.LegacyUserCredentialManager;
import org.keycloak.models.ClientModel; import org.keycloak.models.ClientModel;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.UserModelDefaultMethods; import org.keycloak.models.UserModelDefaultMethods;
import org.keycloak.models.utils.RoleUtils; import org.keycloak.models.utils.RoleUtils;
@ -404,8 +404,8 @@ public abstract class AbstractUserAdapterFederatedStorage extends UserModelDefau
} }
@Override @Override
public SingleEntityCredentialManager credentialManager() { public SubjectCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this); return new LegacyUserCredentialManager(session, realm, this);
} }
@Override @Override

View file

@ -27,7 +27,7 @@ import org.keycloak.credential.CredentialProviderFactory;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.ModelDuplicateException; import org.keycloak.models.ModelDuplicateException;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.map.user.MapUserCredentialEntity; import org.keycloak.models.map.user.MapUserCredentialEntity;
import org.keycloak.models.map.user.MapUserEntity; import org.keycloak.models.map.user.MapUserEntity;
@ -47,14 +47,14 @@ import java.util.stream.Stream;
* *
* @author Alexander Schwartz * @author Alexander Schwartz
*/ */
public class MapSingleUserCredentialManager implements SingleEntityCredentialManager { public class MapUserCredentialManager implements SubjectCredentialManager {
private final UserModel user; private final UserModel user;
private final KeycloakSession session; private final KeycloakSession session;
private final RealmModel realm; private final RealmModel realm;
private final MapUserEntity entity; 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.user = user;
this.session = session; this.session = session;
this.realm = realm; this.realm = realm;

View file

@ -41,13 +41,13 @@ import org.keycloak.models.ProtocolMapperModel;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RequiredActionProviderModel; import org.keycloak.models.RequiredActionProviderModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserConsentModel; import org.keycloak.models.UserConsentModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.UserModel.SearchableFields; import org.keycloak.models.UserModel.SearchableFields;
import org.keycloak.models.UserProvider; import org.keycloak.models.UserProvider;
import org.keycloak.models.map.common.TimeAdapter; 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.MapKeycloakTransactionWithAuth;
import org.keycloak.models.map.storage.MapKeycloakTransaction; import org.keycloak.models.map.storage.MapKeycloakTransaction;
import org.keycloak.models.map.storage.MapStorage; import org.keycloak.models.map.storage.MapStorage;
@ -110,8 +110,8 @@ public class MapUserProvider implements UserProvider.Streams {
} }
@Override @Override
public SingleEntityCredentialManager credentialManager() { public SubjectCredentialManager credentialManager() {
return new MapSingleUserCredentialManager(session, realm, this, entity); return new MapUserCredentialManager(session, realm, this, entity);
} }
}; };
} }

View file

@ -17,7 +17,7 @@
package org.keycloak.credential; package org.keycloak.credential;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.provider.Provider; import org.keycloak.provider.Provider;
@ -47,7 +47,7 @@ public interface UserCredentialStore extends Provider {
CredentialModel getStoredCredentialById(RealmModel realm, UserModel user, String id); CredentialModel getStoredCredentialById(RealmModel realm, UserModel user, String id);
/** /**
* @deprecated Use {@link SingleEntityCredentialManager#getStoredCredentialsStream()} instead. * @deprecated Use {@link SubjectCredentialManager#getStoredCredentialsStream()} instead.
*/ */
@Deprecated @Deprecated
List<CredentialModel> getStoredCredentials(RealmModel realm, UserModel user); List<CredentialModel> 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. * instead.
*/ */
@Deprecated @Deprecated

View file

@ -27,7 +27,7 @@ import java.util.stream.Stream;
/** /**
* Validates and manages the credentials of a known entity (for example, a user). * Validates and manages the credentials of a known entity (for example, a user).
*/ */
public interface SingleEntityCredentialManager { public interface SubjectCredentialManager {
/** /**
* Validate a list of credentials. * Validate a list of credentials.

View file

@ -101,7 +101,7 @@ public interface UserCredentialManager extends UserCredentialStore {
* @param realm * @param realm
* @param user * @param user
* @return * @return
* @deprecated Use {@link UserModel#credentialManager()} and {@link SingleEntityCredentialManager#getDisableableCredentialTypesStream()} instead. * @deprecated Use {@link UserModel#credentialManager()} and {@link SubjectCredentialManager#getDisableableCredentialTypesStream()} instead.
*/ */
@Deprecated @Deprecated
Set<String> getDisableableCredentialTypes(RealmModel realm, UserModel user); Set<String> 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. * 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 * 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. * instead.
*/ */
@Deprecated @Deprecated

View file

@ -301,7 +301,7 @@ public interface UserModel extends RoleMapperModel {
/** /**
* Instance of a user credential manager to validate and update the credentials of this user. * Instance of a user credential manager to validate and update the credentials of this user.
*/ */
SingleEntityCredentialManager credentialManager(); SubjectCredentialManager credentialManager();
enum RequiredAction { enum RequiredAction {
VERIFY_EMAIL, VERIFY_EMAIL,

View file

@ -20,7 +20,7 @@ package org.keycloak.models.utils;
import org.keycloak.models.ClientModel; import org.keycloak.models.ClientModel;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import java.util.List; import java.util.List;
@ -211,7 +211,7 @@ public class UserModelDelegate implements UserModel.Streams {
} }
@Override @Override
public SingleEntityCredentialManager credentialManager() { public SubjectCredentialManager credentialManager() {
return delegate.credentialManager(); return delegate.credentialManager();
} }

View file

@ -33,14 +33,12 @@ import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputUpdater;
import org.keycloak.credential.CredentialInputValidator; import org.keycloak.credential.CredentialInputValidator;
import org.keycloak.credential.CredentialModel; import org.keycloak.credential.CredentialModel;
import org.keycloak.credential.LegacySingleUserCredentialManager;
import org.keycloak.credential.hash.PasswordHashProvider; import org.keycloak.credential.hash.PasswordHashProvider;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.OTPPolicy; import org.keycloak.models.OTPPolicy;
import org.keycloak.models.PasswordPolicy; import org.keycloak.models.PasswordPolicy;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.SingleEntityCredentialManager;
import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.cache.UserCache; import org.keycloak.models.cache.UserCache;

View file

@ -21,10 +21,8 @@ import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputUpdater;
import org.keycloak.credential.CredentialInputValidator; import org.keycloak.credential.CredentialInputValidator;
import org.keycloak.credential.CredentialModel; import org.keycloak.credential.CredentialModel;
import org.keycloak.credential.LegacySingleUserCredentialManager;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.SingleEntityCredentialManager;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.credential.PasswordCredentialModel; import org.keycloak.models.credential.PasswordCredentialModel;
import org.keycloak.storage.StorageId; import org.keycloak.storage.StorageId;

View file

@ -21,13 +21,11 @@ import org.keycloak.component.ComponentModel;
import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialInputUpdater; import org.keycloak.credential.CredentialInputUpdater;
import org.keycloak.credential.CredentialInputValidator; import org.keycloak.credential.CredentialInputValidator;
import org.keycloak.credential.LegacySingleUserCredentialManager;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.LDAPConstants; import org.keycloak.models.LDAPConstants;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager;
import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.credential.PasswordCredentialModel; import org.keycloak.models.credential.PasswordCredentialModel;

View file

@ -19,12 +19,12 @@ package org.keycloak.testsuite.federation;
import org.keycloak.component.ComponentModel; import org.keycloak.component.ComponentModel;
import org.keycloak.credential.CredentialInput; import org.keycloak.credential.CredentialInput;
import org.keycloak.credential.CredentialInputValidator; import org.keycloak.credential.CredentialInputValidator;
import org.keycloak.credential.LegacySingleUserCredentialManager; import org.keycloak.credential.LegacyUserCredentialManager;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.SingleEntityCredentialManager; import org.keycloak.models.SubjectCredentialManager;
import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.credential.PasswordCredentialModel; import org.keycloak.models.credential.PasswordCredentialModel;
@ -143,8 +143,8 @@ public class UserPropertyFileStorage implements UserLookupProvider.Streams, User
} }
@Override @Override
public SingleEntityCredentialManager credentialManager() { public SubjectCredentialManager credentialManager() {
return new LegacySingleUserCredentialManager(session, realm, this); return new LegacyUserCredentialManager(session, realm, this);
} }
}; };
} }