mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-07 23:50:03 -05:00
Ensure IDPs returned from infinispan provider are ordered by alias
Closes #33243 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
This commit is contained in:
committed by
Pedro Igor
parent
58596b916f
commit
0fc0dcd119
+7
-4
@@ -17,6 +17,7 @@
|
||||
package org.keycloak.models.cache.infinispan.idp;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -216,13 +217,14 @@ public class InfinispanIdentityProviderStorageProvider implements IdentityProvid
|
||||
// there is a cache entry, but the current search is not yet cached
|
||||
cache.invalidateObject(cacheKey);
|
||||
Long loaded = cache.getCurrentRevision(cacheKey);
|
||||
cached = idpDelegate.getByOrganization(orgId, first, max).map(IdentityProviderModel::getInternalId).collect(Collectors.toSet());
|
||||
cached = idpDelegate.getByOrganization(orgId, first, max).map(IdentityProviderModel::getInternalId)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
query = new IdentityProviderListQuery(loaded, cacheKey, realm, searchKey, cached, query);
|
||||
cache.addRevisioned(query, cache.getCurrentCounter());
|
||||
}
|
||||
}
|
||||
|
||||
Set<IdentityProviderModel> identityProviders = new HashSet<>();
|
||||
Set<IdentityProviderModel> identityProviders = new LinkedHashSet<>();
|
||||
for (String id : cached) {
|
||||
IdentityProviderModel idp = session.identityProviders().getById(id);
|
||||
if (idp == null) {
|
||||
@@ -251,7 +253,8 @@ public class InfinispanIdentityProviderStorageProvider implements IdentityProvid
|
||||
if (query == null) {
|
||||
// not cached yet
|
||||
Long loaded = cache.getCurrentRevision(cacheKey);
|
||||
cached = idpDelegate.getForLogin(mode, organizationId).map(IdentityProviderModel::getInternalId).collect(Collectors.toSet());
|
||||
cached = idpDelegate.getForLogin(mode, organizationId).map(IdentityProviderModel::getInternalId)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
query = new IdentityProviderListQuery(loaded, cacheKey, getRealm(), searchKey, cached);
|
||||
cache.addRevisioned(query, startupRevision);
|
||||
} else {
|
||||
@@ -266,7 +269,7 @@ public class InfinispanIdentityProviderStorageProvider implements IdentityProvid
|
||||
}
|
||||
}
|
||||
|
||||
Set<IdentityProviderModel> identityProviders = new HashSet<>();
|
||||
Set<IdentityProviderModel> identityProviders = new LinkedHashSet<>();
|
||||
for (String id : cached) {
|
||||
IdentityProviderModel idp = session.identityProviders().getById(id);
|
||||
if (idp == null) {
|
||||
|
||||
Reference in New Issue
Block a user