diff --git a/federation/ldap2/src/main/java/org/keycloak/storage/ldap/mappers/LDAPMappersComparator.java b/federation/ldap2/src/main/java/org/keycloak/storage/ldap/mappers/LDAPMappersComparator.java index fda9b8d502..f659c2b3a9 100644 --- a/federation/ldap2/src/main/java/org/keycloak/storage/ldap/mappers/LDAPMappersComparator.java +++ b/federation/ldap2/src/main/java/org/keycloak/storage/ldap/mappers/LDAPMappersComparator.java @@ -62,8 +62,8 @@ public class LDAPMappersComparator { @Override public int compare(ComponentModel o1, ComponentModel o2) { // UserAttributeLDAPFederationMapper first - boolean isO1AttrMapper = o1.getProviderType().equals(UserAttributeLDAPStorageMapperFactory.PROVIDER_ID); - boolean isO2AttrMapper = o2.getProviderType().equals(UserAttributeLDAPStorageMapperFactory.PROVIDER_ID); + boolean isO1AttrMapper = o1.getProviderId().equals(UserAttributeLDAPStorageMapperFactory.PROVIDER_ID); + boolean isO2AttrMapper = o2.getProviderId().equals(UserAttributeLDAPStorageMapperFactory.PROVIDER_ID); if (!isO1AttrMapper) { if (isO2AttrMapper) { return 1; diff --git a/services/src/main/java/org/keycloak/credential/OTPCredentialProvider.java b/services/src/main/java/org/keycloak/credential/OTPCredentialProvider.java index fcd1e186cb..96351467e6 100644 --- a/services/src/main/java/org/keycloak/credential/OTPCredentialProvider.java +++ b/services/src/main/java/org/keycloak/credential/OTPCredentialProvider.java @@ -230,7 +230,7 @@ public class OTPCredentialProvider implements CredentialProvider, CredentialInpu } else { TimeBasedOTP validator = new TimeBasedOTP(policy.getAlgorithm(), policy.getDigits(), policy.getPeriod(), policy.getLookAheadWindow()); List creds = getCachedCredentials(user, CredentialModel.TOTP); - if (creds.isEmpty()) { + if (creds == null) { creds = getCredentialStore().getStoredCredentialsByType(realm, user, CredentialModel.TOTP); } else { logger.debugv("Cache hit for TOTP for user {0}", user.getUsername());