update confidential status of idps
@@ -85,6 +85,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -2054,6 +2055,8 @@ public class IdentityProviderManager implements IdpManager {
public IdentityProvider addIdPWithResourceId(IdentityProvider identityProvider, String tenantDomain)
throws IdentityProviderManagementException {
+ setConfidentialStatusFromMeta(identityProvider);
+
validateAddIdPInputValues(identityProvider.getIdentityProviderName(), tenantDomain);
validateOutboundProvisioningRoles(identityProvider, tenantDomain);
@@ -2363,6 +2366,7 @@ public class IdentityProviderManager implements IdpManager {
public IdentityProvider updateIdPByResourceId(String resourceId, IdentityProvider
newIdentityProvider, String tenantDomain) throws IdentityProviderManagementException {
+ setConfidentialStatusFromMeta(newIdentityProvider);
// Invoking the pre listeners.
Collection<IdentityProviderMgtListener> listeners = IdPManagementServiceComponent.getIdpMgtListeners();
for (IdentityProviderMgtListener listener : listeners) {
@@ -3111,4 +3115,27 @@ public class IdentityProviderManager implements IdpManager {
}
return propertyWithName;
}
+
+ /**
+ * Set the confidential status of federated authenticator properties using metadata.
+ * @param identityProvider Identity Provider.
+ */
+ private void setConfidentialStatusFromMeta(IdentityProvider identityProvider)
+ throws IdentityProviderManagementException {
+
+ FederatedAuthenticatorConfig[] metaFederatedAuthenticatorConfigs = getAllFederatedAuthenticators();
+ Arrays.asList(identityProvider.getFederatedAuthenticatorConfigs()).forEach(fedAuthConfig -> {
+ Optional<FederatedAuthenticatorConfig> metaFedAuthConfig =
+ Arrays.stream(metaFederatedAuthenticatorConfigs).filter(metaFed -> metaFed.getName()
+ .equals(fedAuthConfig.getName())).findAny();
+ metaFedAuthConfig.ifPresent(
+ federatedAuthenticatorConfig -> Arrays.asList(fedAuthConfig.getProperties()).forEach(prop -> {
+ Property metaProperty = Arrays.stream(federatedAuthenticatorConfig.getProperties())
+ .filter(metaProp -> (metaProp.getName().equals(prop.getName()))).findAny().orElse(null);
+ if (metaProperty != null && metaProperty.isConfidential()) {
+ prop.setConfidential(true);
+ }
+ }));
+ });
+ }
}
