49 List<IdentityProviderModel> identityProviders = realm.getIdentityProviders();
50 Set<FederatedIdentityModel>
identities =
session.users().getFederatedIdentities(user, realm);
52 int availableIdentities = 0;
53 if (identityProviders != null && !identityProviders.isEmpty()) {
54 for (IdentityProviderModel provider : identityProviders) {
55 if (!provider.isEnabled()) {
58 String providerId = provider.getAlias();
60 FederatedIdentityModel identity =
getIdentity(identities, providerId);
62 if (identity != null) {
63 availableIdentities++;
66 String displayName = KeycloakModelUtils.getIdentityProviderDisplayName(
session, provider);
67 FederatedIdentityEntry entry =
new FederatedIdentityEntry(identity, displayName, provider.getAlias(), provider.getAlias(),
68 provider.getConfig() != null ? provider.getConfig().get(
"guiOrder") : null);
69 this.identities.add(entry);
76 this.
removeLinkPossible = availableIdentities > 1 || user.getFederationLink() != null || AccountFormService.isPasswordSet(
session, realm, user);
final KeycloakSession session
Definition: AccountFederatedIdentityBean.java:44
final boolean removeLinkPossible
Definition: AccountFederatedIdentityBean.java:43
final List< FederatedIdentityEntry > identities
Definition: AccountFederatedIdentityBean.java:42
FederatedIdentityModel getIdentity(Set< FederatedIdentityModel > identities, String providerId)
Definition: AccountFederatedIdentityBean.java:79
static OrderedModel.OrderedModelComparator< FederatedIdentityEntry > IDP_COMPARATOR_INSTANCE
Definition: AccountFederatedIdentityBean.java:40