From b958d8b2051f938b3205ad3af0a496557869a0b0 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 25 May 2023 20:23:26 +0200 Subject: [PATCH] added PostBrokerLoginFlow to idp used by query (#20208) fixes: #19942 --- .../admin/ui/rest/AuthenticationManagementResource.java | 3 ++- .../keycloak/admin/ui/rest/model/AuthenticationMapper.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/AuthenticationManagementResource.java b/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/AuthenticationManagementResource.java index 5e78ffdd93..234ec652c9 100644 --- a/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/AuthenticationManagementResource.java +++ b/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/AuthenticationManagementResource.java @@ -105,7 +105,8 @@ public class AuthenticationManagementResource extends RoleMappingResource { if ("idp".equals(type)) { final Stream identityProviders = realm.getIdentityProvidersStream(); - return identityProviders.filter(idp -> idp.getFirstBrokerLoginFlowId().equals(flow.getId())) + return identityProviders.filter(idp -> flow.getId().equals(idp.getFirstBrokerLoginFlowId()) + || flow.getId().equals(idp.getPostBrokerLoginFlowId())) .map(IdentityProviderModel::getAlias).filter(f -> f.contains(search)) .skip("".equals(search) ? first : 0).limit(max).collect(Collectors.toList()); } diff --git a/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/model/AuthenticationMapper.java b/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/model/AuthenticationMapper.java index 25871befc8..1e4d52533f 100644 --- a/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/model/AuthenticationMapper.java +++ b/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/model/AuthenticationMapper.java @@ -3,6 +3,7 @@ package org.keycloak.admin.ui.rest.model; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; + import org.keycloak.models.AuthenticationFlowModel; import org.keycloak.models.ClientModel; import org.keycloak.models.IdentityProviderModel; @@ -22,7 +23,8 @@ public class AuthenticationMapper { authentication.setBuiltIn(flow.isBuiltIn()); authentication.setDescription(flow.getDescription()); - final List usedByIdp = identityProviders.filter(idp -> idp.getFirstBrokerLoginFlowId().equals(flow.getId())) + final List usedByIdp = identityProviders.filter(idp -> flow.getId().equals(idp.getFirstBrokerLoginFlowId()) + || flow.getId().equals(idp.getPostBrokerLoginFlowId())) .map(IdentityProviderModel::getAlias).limit(MAX_USED_BY).collect(Collectors.toList()); if (!usedByIdp.isEmpty()) { authentication.setUsedBy(new UsedBy(UsedBy.UsedByType.SPECIFIC_PROVIDERS, usedByIdp));