public static Property getProperty(Property[] properties, String propertyName) { if (ArrayUtils.isEmpty(properties) || StringUtils.isBlank(propertyName)) { return null; } for (Property property : properties) { if (property == null) { continue; } if (propertyName.equals(property.getName())) { return property; } } return null; }
public static Property getProperty(Property[] properties, String propertyName) { if (ArrayUtils.isEmpty(properties) || StringUtils.isBlank(propertyName)) { return null; } for (Property property : properties) { if (property == null) { continue; } if (propertyName.equals(property.getName())) { return property; } } return null; }
private static Property[] removeEmptyElements(Property[] properties) { List<Property> propertyList = new ArrayList<>(); if (ArrayUtils.isNotEmpty(properties)) { for (Property property : properties) { if (property != null && StringUtils.isNotBlank(property.getName())) { propertyList.add(property); } } } return propertyList.toArray(new Property[0]); } }
private Property getFederatedAuthenticatorConfigProperty( FederatedAuthenticatorConfig samlFederatedAuthenticatorConfig, String name) { for (Property property : samlFederatedAuthenticatorConfig.getProperties()) { if (name.equals(property.getName())) { return property; } } return null; }
private Property[] removeUniqueIdProperty(Property [] properties) { if (ArrayUtils.isEmpty(properties)){ return new Property[0]; } for (int i=0 ; i < properties.length; i++) { if (properties[i] == null){ continue; } if (IdentityApplicationConstants.UNIQUE_ID_CONSTANT.equals(properties[i].getName())) { Property[] propertiesTemp = properties; if (log.isDebugEnabled()){ log.debug("Removing uniqueId property: " + properties[i].getName()); } properties = (Property[])ArrayUtils.removeElement(properties, properties[i]); //Removing uniqueId property from existing properties too propertiesTemp[i] = null; } } return properties; } }
private Property[] removeUniqueIdProperty(Property [] properties) { if (ArrayUtils.isEmpty(properties)){ return new Property[0]; } for (int i=0 ; i < properties.length; i++) { if (properties[i] == null){ continue; } if (IdentityApplicationConstants.UNIQUE_ID_CONSTANT.equals(properties[i].getName())) { Property[] propertiesTemp = properties; if (log.isDebugEnabled()){ log.debug("Removing uniqueId property: " + properties[i].getName()); } properties = (Property[])ArrayUtils.removeElement(properties, properties[i]); //Removing uniqueId property from existing properties too propertiesTemp[i] = null; } } return properties; } }
/** * Merge properties from config to request. * * @param sources * @param destinations */ private void mergedPropertiesMetaData(Property[] sources, Property[] destinations) { Map<String, Property> destinationMap = new HashMap<>(); if (ArrayUtils.isNotEmpty(destinations)) { for (Property destination : destinations) { destinationMap.put(destination.getName(), destination); } } if (ArrayUtils.isNotEmpty(sources)) { for (Property source : sources) { Property property = destinationMap.get(source.getName()); if (property == null) { destinationMap.put(source.getName(), source); } } } }
@Override public Property[] getConfiguration(String[] propertyNames, String tenantDomain) throws IdentityGovernanceException { List<Property> requestedProperties = new ArrayList<>(); Property[] allProperties = getConfiguration(tenantDomain); for (String propertyName : propertyNames) { for (int i = 0; i < allProperties.length; i++) { if (propertyName.equals(allProperties[i].getName())) { requestedProperties.add(allProperties[i]); break; } } } return requestedProperties.toArray(new Property[requestedProperties.size()]); }
@Override public Property[] getConfiguration(String[] propertyNames, String tenantDomain) throws IdentityGovernanceException { List<Property> requestedProperties = new ArrayList<>(); Property[] allProperties = getConfiguration(tenantDomain); for (String propertyName : propertyNames) { for (int i = 0; i < allProperties.length; i++) { if (propertyName.equals(allProperties[i].getName())) { requestedProperties.add(allProperties[i]); break; } } } return requestedProperties.toArray(new Property[requestedProperties.size()]); }
/** * Check whether the RelyingPartyKey is configured with the UI properties. * * @return */ public boolean isRelyingPartyKeyConfigured() { Property[] configurationProperties = getConfigurationProperties(); if (configurationProperties != null) { for (Property property : configurationProperties) { if (property != null && StringUtils.isNotBlank(property.getName()) && property.getName().equals (getRelyingPartyKey())) { return true; } } } return false; } }
@Override public void init(Property[] provisioningProperties) throws IdentityProvisioningException { Properties configs = new Properties(); if (provisioningProperties != null && provisioningProperties.length > 0) { for (Property property : provisioningProperties) { configs.put(property.getName(), property.getValue()); if (IdentityProvisioningConstants.JIT_PROVISIONING_ENABLED.equals(property .getName()) && "1".equals(property.getValue())){ jitProvisioningEnabled = true; } } } configHolder = new SPMLProvisioningConnectorConfig(configs); }
/** * Reading the mapping of properties. * * @param customAuthenticator * @param propertyName * @return */ private Property getMappedProperty(AbstractInboundAuthenticatorConfig customAuthenticator, String propertyName) { Property property = null; if (customAuthenticator != null) { Property[] confProps = customAuthenticator.getConfigurationProperties(); if (confProps != null) { for (Property confProp : confProps) { if (propertyName != null && propertyName.equals(confProp.getName())) { property = confProp; } } } } return property; }
/** * Check whether the RelyingPartyKey is configured with the UI properties. * * @return */ public boolean isRelyingPartyKeyConfigured() { Property[] configurationProperties = getConfigurationProperties(); if (configurationProperties != null) { for (Property property : configurationProperties) { if (property != null && StringUtils.isNotBlank(property.getName()) && StringUtils.equals(property .getName(), (getRelyingPartyKey()))) { return true; } } } return false; } }
@Override /** * */ public void init(Property[] provisioningProperties) throws IdentityProvisioningException { Properties configs = new Properties(); if (provisioningProperties != null && provisioningProperties.length > 0) { for (Property property : provisioningProperties) { configs.put(property.getName(), property.getValue()); if (IdentityProvisioningConstants.JIT_PROVISIONING_ENABLED.equals(property .getName()) && "1".equals(property.getValue())) { jitProvisioningEnabled = true; } } } configHolder = new SalesforceProvisioningConnectorConfig(configs); }
/** * Retrieves whether this property contains SAML Metadata * * * @param property * @return boolean * */ public boolean canHandle(Property property) { if (property != null) { String meta = property.getName(); if (meta != null && meta.contains(IDPMetadataConstant.SAML)) { if (property.getValue() != null && property.getValue().length() > 0){ return true; } return false; } else { return false; } } else { return false; } }
public void updateConfigurations (Property[] configurations) throws IdentityGovernanceException { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); identityGovernanceService = new IdentityGovernanceServiceImpl(); Map<String, String> confMap = new HashMap<>(); for (Property configuration : configurations) { confMap.put(configuration.getName(), configuration.getValue()); } identityGovernanceService.updateConfiguration(tenantDomain, confMap); }
public void updateConfigurations(Property[] configurations) throws IdentityGovernanceException { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); IdentityGovernanceService identityGovernanceService = IdentityMgtServiceDataHolder.getInstance() .getIdentityGovernanceService(); Map<String, String> confMap = new HashMap<>(); for (Property configuration : configurations) { confMap.put(configuration.getName(), configuration.getValue()); } identityGovernanceService.updateConfiguration(tenantDomain, confMap); }
/** * @param externalIdPConfig * @param name * @return */ public static Map<String, String> getAuthenticatorPropertyMapFromIdP( ExternalIdPConfig externalIdPConfig, String name) { Map<String, String> propertyMap = new HashMap<String, String>(); if (externalIdPConfig != null) { FederatedAuthenticatorConfig[] authenticatorConfigs = externalIdPConfig .getIdentityProvider().getFederatedAuthenticatorConfigs(); for (FederatedAuthenticatorConfig authenticatorConfig : authenticatorConfigs) { if (authenticatorConfig.getName().equals(name)) { for (Property property : authenticatorConfig.getProperties()) { propertyMap.put(property.getName(), property.getValue()); } break; } } } return propertyMap; }
private String getIDPProperty(String tenantDomain, String propertyName) throws IdentityRecoveryException { String propertyValue = ""; try { org.wso2.carbon.identity.application.common.model.Property[] configuration = IdentityRecoveryServiceDataHolder.getInstance().getIdentityGovernanceService(). getConfiguration(new String[]{IdentityRecoveryConstants.ConnectorConfig.ENABLE_SELF_SIGNUP}, tenantDomain); for (org.wso2.carbon.identity.application.common.model.Property configProperty : configuration) { if (configProperty != null && propertyName.equalsIgnoreCase(configProperty.getName())) { propertyValue = configProperty.getValue(); } } } catch (IdentityGovernanceException e) { throw new IdentityRecoveryException("Error while retrieving resident identity provider for tenant : " + tenantDomain, e); } return propertyValue; }
public static String getRecoveryConfigs(String key, String tenantDomain) throws IdentityRecoveryServerException { try { Property[] connectorConfigs; IdentityGovernanceService identityGovernanceService = IdentityRecoveryServiceDataHolder.getInstance() .getIdentityGovernanceService(); connectorConfigs = identityGovernanceService.getConfiguration(new String[]{key}, tenantDomain); for (Property connectorConfig : connectorConfigs) { if (key.equals(connectorConfig.getName())) { return connectorConfig.getValue(); } } throw Utils.handleServerException(IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_ISSUE_IN_LOADING_RECOVERY_CONFIGS, null); } catch (IdentityGovernanceException e) { throw Utils.handleServerException(IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_ISSUE_IN_LOADING_RECOVERY_CONFIGS, null, e); } }