KEYCLOAK-18981 Infinispan: prevent fetching all sessions from remotes

This commit is contained in:
Sven-Torben Janus 2021-09-24 14:21:43 +02:00 committed by Hynek Mlnařík
parent 271033c3a4
commit 7c0d10130e

View file

@ -369,9 +369,8 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
cache = CacheDecorators.skipCacheLoaders(cache);
// return a stream that 'wraps' the infinispan cache stream so that the cache stream's elements are read one by one
// and then filtered/mapped locally to avoid serialization issues when trying to manipulate the cache stream directly.
return StreamSupport.stream(cache.entrySet().stream().spliterator(), true)
.filter(predicate)
// and then mapped locally to avoid serialization issues when trying to manipulate the cache stream directly.
return StreamSupport.stream(cache.entrySet().stream().filter(predicate).spliterator(), true)
.map(Mappers.userSessionEntity())
.map(entity -> this.wrap(realm, entity, offline));
}