fix: use list instead of consumed stream

This commit is contained in:
kritzl 2025-11-01 01:49:54 +01:00 committed by June
commit c60c4978df
No known key found for this signature in database

View file

@ -53,10 +53,11 @@ public class SSHKeyResourceProvider implements RealmResourceProvider {
UserProfileProvider profileProvider = session.getProvider(UserProfileProvider.class); UserProfileProvider profileProvider = session.getProvider(UserProfileProvider.class);
UPConfig upconfig = profileProvider.getConfiguration(); UPConfig upconfig = profileProvider.getConfiguration();
Stream<String> attributeNames = upconfig.getAttributes() List<String> attributeNames = upconfig.getAttributes()
.stream() .stream()
.filter(a -> a.getGroup() != null && a.getGroup().equals("de.ccc.hamburg.keycloak.ssh_key.keys")) .filter(a -> a.getGroup() != null && a.getGroup().equals("de.ccc.hamburg.keycloak.ssh_key.keys"))
.map(a -> a.getName()); .map(a -> a.getName())
.toList();
try { try {
AuthHelper.getAuth( AuthHelper.getAuth(
@ -73,10 +74,11 @@ public class SSHKeyResourceProvider implements RealmResourceProvider {
List<String> keys = users List<String> keys = users
.map(user -> { .map(user -> {
return attributeNames return attributeNames
.map(attributeName -> user.getAttributeStream(attributeName).findFirst()) .stream()
.filter(attribute -> attribute.isPresent()) .map(attributeName -> user.getAttributeStream(attributeName).findFirst())
.map(attribute -> attribute.get()) .filter(attribute -> attribute.isPresent())
.toList(); .map(attribute -> attribute.get())
.toList();
}) })
.flatMap(List::stream) .flatMap(List::stream)
.map(key -> { .map(key -> {