added PostBrokerLoginFlow to idp used by query (#20208)

fixes: #19942
This commit is contained in:
Erik Jan de Wit 2023-05-25 20:23:26 +02:00 committed by GitHub
parent 34e5884415
commit b958d8b205
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -105,7 +105,8 @@ public class AuthenticationManagementResource extends RoleMappingResource {
if ("idp".equals(type)) { if ("idp".equals(type)) {
final Stream<IdentityProviderModel> identityProviders = realm.getIdentityProvidersStream(); final Stream<IdentityProviderModel> 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)) .map(IdentityProviderModel::getAlias).filter(f -> f.contains(search))
.skip("".equals(search) ? first : 0).limit(max).collect(Collectors.toList()); .skip("".equals(search) ? first : 0).limit(max).collect(Collectors.toList());
} }

View file

@ -3,6 +3,7 @@ package org.keycloak.admin.ui.rest.model;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.keycloak.models.AuthenticationFlowModel; import org.keycloak.models.AuthenticationFlowModel;
import org.keycloak.models.ClientModel; import org.keycloak.models.ClientModel;
import org.keycloak.models.IdentityProviderModel; import org.keycloak.models.IdentityProviderModel;
@ -22,7 +23,8 @@ public class AuthenticationMapper {
authentication.setBuiltIn(flow.isBuiltIn()); authentication.setBuiltIn(flow.isBuiltIn());
authentication.setDescription(flow.getDescription()); authentication.setDescription(flow.getDescription());
final List<String> usedByIdp = identityProviders.filter(idp -> idp.getFirstBrokerLoginFlowId().equals(flow.getId())) final List<String> usedByIdp = identityProviders.filter(idp -> flow.getId().equals(idp.getFirstBrokerLoginFlowId())
|| flow.getId().equals(idp.getPostBrokerLoginFlowId()))
.map(IdentityProviderModel::getAlias).limit(MAX_USED_BY).collect(Collectors.toList()); .map(IdentityProviderModel::getAlias).limit(MAX_USED_BY).collect(Collectors.toList());
if (!usedByIdp.isEmpty()) { if (!usedByIdp.isEmpty()) {
authentication.setUsedBy(new UsedBy(UsedBy.UsedByType.SPECIFIC_PROVIDERS, usedByIdp)); authentication.setUsedBy(new UsedBy(UsedBy.UsedByType.SPECIFIC_PROVIDERS, usedByIdp));