use of org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig in project carbon-identity-framework by wso2.
the class IdPManagementUIUtil method buildSalesforceProvisioningConfiguration.
/**
* @param fedIdp
* @param paramMap
* @throws IdentityApplicationManagementException
*/
private static void buildSalesforceProvisioningConfiguration(IdentityProvider fedIdp, Map<String, String> paramMap) throws IdentityApplicationManagementException {
ProvisioningConnectorConfig proConnector = new ProvisioningConnectorConfig();
proConnector.setName("salesforce");
Property userNameProp = null;
Property passwordProp = null;
Property clentIdProp = null;
Property clientSecretProp = null;
Property apiVersionProp = null;
Property domainNameProp = null;
Property tokenEndpointProp = null;
Property provisioningPattern = null;
Property provisioningSeparator = null;
Property provisioningDomain = null;
Property uniqueID = null;
if (paramMap.get("sfProvEnabled") != null && "on".equals(paramMap.get("sfProvEnabled"))) {
proConnector.setEnabled(true);
} else {
proConnector.setEnabled(false);
}
if (paramMap.get("sfProvDefault") != null && "on".equals(paramMap.get("sfProvDefault"))) {
fedIdp.setDefaultProvisioningConnectorConfig(proConnector);
}
if (paramMap.get("sf-username") != null) {
userNameProp = new Property();
userNameProp.setName("sf-username");
userNameProp.setValue(paramMap.get("sf-username"));
}
if (paramMap.get("sf-password") != null) {
passwordProp = new Property();
passwordProp.setConfidential(true);
passwordProp.setName("sf-password");
passwordProp.setValue(paramMap.get("sf-password"));
}
if (paramMap.get("sf-clientid") != null) {
clentIdProp = new Property();
clentIdProp.setName("sf-clientid");
clentIdProp.setValue(paramMap.get("sf-clientid"));
}
if (paramMap.get("sf-client-secret") != null) {
clientSecretProp = new Property();
clientSecretProp.setConfidential(true);
clientSecretProp.setName("sf-client-secret");
clientSecretProp.setValue(paramMap.get("sf-client-secret"));
}
if (paramMap.get("sf-clientid") != null) {
clentIdProp = new Property();
clentIdProp.setName("sf-clientid");
clentIdProp.setValue(paramMap.get("sf-clientid"));
}
if (paramMap.get("sf-api-version") != null) {
apiVersionProp = new Property();
apiVersionProp.setName("sf-api-version");
apiVersionProp.setValue(paramMap.get("sf-api-version"));
}
if (paramMap.get("sf-domain-name") != null) {
domainNameProp = new Property();
domainNameProp.setName("sf-domain-name");
domainNameProp.setValue(paramMap.get("sf-domain-name"));
}
if (paramMap.get("sf-token-endpoint") != null) {
tokenEndpointProp = new Property();
tokenEndpointProp.setName("sf-token-endpoint");
tokenEndpointProp.setValue(paramMap.get("sf-token-endpoint"));
}
if (paramMap.get("sf-prov-pattern") != null) {
provisioningPattern = new Property();
provisioningPattern.setName("sf-prov-pattern");
provisioningPattern.setValue(paramMap.get("sf-prov-pattern"));
}
if (paramMap.get("sf-prov-separator") != null) {
provisioningSeparator = new Property();
provisioningSeparator.setName("sf-prov-separator");
provisioningSeparator.setValue(paramMap.get("sf-prov-separator"));
}
if (paramMap.get("sf-prov-domainName") != null) {
provisioningDomain = new Property();
provisioningDomain.setName("sf-prov-domainName");
provisioningDomain.setValue(paramMap.get("sf-prov-domainName"));
}
if (paramMap.get("sf-unique-id") != null) {
uniqueID = new Property();
uniqueID.setName("UniqueID");
uniqueID.setValue(paramMap.get("sf-unique-id"));
}
Property[] proProperties = new Property[] { userNameProp, passwordProp, clentIdProp, clientSecretProp, apiVersionProp, domainNameProp, tokenEndpointProp, provisioningPattern, provisioningSeparator, provisioningDomain, uniqueID };
proConnector.setProvisioningProperties(proProperties);
ProvisioningConnectorConfig[] proConnectors = fedIdp.getProvisioningConnectorConfigs();
if (proConnector.getName() != null) {
if (proConnectors == null || proConnectors.length == 0) {
fedIdp.setProvisioningConnectorConfigs(new ProvisioningConnectorConfig[] { proConnector });
} else {
fedIdp.setProvisioningConnectorConfigs(concatArrays(new ProvisioningConnectorConfig[] { proConnector }, proConnectors));
}
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig in project carbon-identity-framework by wso2.
the class IdPManagementUIUtil method buildCustomProvisioningConfiguration.
private static void buildCustomProvisioningConfiguration(IdentityProvider fedIdp, List<String> proConnectorNames, Map<String, List<Property>> customProProperties, Map<String, String> paramMap) throws IdentityApplicationManagementException {
if (CollectionUtils.isNotEmpty(proConnectorNames)) {
ProvisioningConnectorConfig[] proConfigConnList = new ProvisioningConnectorConfig[proConnectorNames.size()];
int j = 0;
for (String conName : proConnectorNames) {
ProvisioningConnectorConfig customConfig = new ProvisioningConnectorConfig();
customConfig.setName(conName);
if ("on".equals(paramMap.get(conName + "_PEnabled"))) {
customConfig.setEnabled(true);
}
if ("on".equals(paramMap.get(conName + "_Default"))) {
fedIdp.setDefaultProvisioningConnectorConfig(customConfig);
}
List<Property> customProps = customProProperties.get(conName);
if (CollectionUtils.isNotEmpty(customProps)) {
customConfig.setProvisioningProperties(customProps.toArray(new Property[customProps.size()]));
}
proConfigConnList[j++] = customConfig;
}
ProvisioningConnectorConfig[] provConnectors = fedIdp.getProvisioningConnectorConfigs();
if (provConnectors == null || provConnectors.length == 0) {
fedIdp.setProvisioningConnectorConfigs(proConfigConnList);
} else {
fedIdp.setProvisioningConnectorConfigs(concatArrays(proConfigConnList, provConnectors));
}
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig in project product-is by wso2.
the class ProvisioningTestCase method buildSCIMProvisioningConnector.
private void buildSCIMProvisioningConnector(int portOffset) throws Exception {
String url = scim_url_2;
IdentityProvider fedIdp = new IdentityProvider();
fedIdp.setIdentityProviderName(SAMPLE_IDENTITY_PROVIDER_NAME + "_" + Integer.toString(portOffset));
ProvisioningConnectorConfig proConnector = new ProvisioningConnectorConfig();
proConnector.setName("scim");
proConnector.setEnabled(true);
fedIdp.setDefaultProvisioningConnectorConfig(proConnector);
Property userNameProp = new Property();
userNameProp.setName("scim-username");
userNameProp.setValue("admin");
Property passwordProp = new Property();
passwordProp.setConfidential(true);
passwordProp.setName("scim-password");
passwordProp.setValue("admin");
Property userEpProp = new Property();
userEpProp.setName("scim-user-ep");
userEpProp.setValue(url + "Users");
Property groupEpProp = new Property();
groupEpProp.setName("scim-group-ep");
groupEpProp.setValue(url + "Groups");
Property generatePassword = new Property();
generatePassword.setName("scim-enable-pwd-provisioning");
generatePassword.setValue("true");
Property[] proProperties = new Property[] { userNameProp, passwordProp, userEpProp, groupEpProp, generatePassword, null };
proConnector.setProvisioningProperties(proProperties);
fedIdp.setProvisioningConnectorConfigs(new ProvisioningConnectorConfig[] { proConnector });
try {
identityProviderMgtServiceClients.get(portOffset).addIdP(fedIdp);
IdentityProvider addedIdp = identityProviderMgtServiceClients.get(portOffset).getIdPByName(SAMPLE_IDENTITY_PROVIDER_NAME + "_" + Integer.toString(portOffset));
Assert.assertNotNull(addedIdp, "Failed to create Identity Provider ");
identityProviderMgtServiceClients.get(portOffset).updateIdP(SAMPLE_IDENTITY_PROVIDER_NAME + "_" + Integer.toString(portOffset), addedIdp);
} catch (Exception ex) {
// log.error("Error occurred during handling identityProviderMgtServiceClient", ex);
throw new Exception("Error occurred during handling identityProviderMgtServiceClient", ex);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig in project product-is by wso2.
the class ApplicationManagementTestCase method testUpdateOutboundProvisioningData.
@Test(alwaysRun = true, description = "Testing update Outbound Provisioning Data")
public void testUpdateOutboundProvisioningData() {
String applicationName = "TestServiceProvider";
try {
ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
List<IdentityProvider> provisioningIdps = new ArrayList<IdentityProvider>();
String connector = "provisioning_con_idp_test";
IdentityProvider proIdp = new IdentityProvider();
proIdp.setIdentityProviderName("idp_test");
JustInTimeProvisioningConfig jitpro = new JustInTimeProvisioningConfig();
jitpro.setProvisioningEnabled(true);
proIdp.setJustInTimeProvisioningConfig(jitpro);
ProvisioningConnectorConfig proCon = new ProvisioningConnectorConfig();
proCon.setBlocking(true);
proCon.setName(connector);
proIdp.setDefaultProvisioningConnectorConfig(proCon);
provisioningIdps.add(proIdp);
OutboundProvisioningConfig outboundProConfig = new OutboundProvisioningConfig();
outboundProConfig.setProvisioningIdentityProviders(provisioningIdps.toArray(new IdentityProvider[provisioningIdps.size()]));
serviceProvider.setOutboundProvisioningConfig(outboundProConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
IdentityProvider identityProvider = updatedServiceProvider.getOutboundProvisioningConfig().getProvisioningIdentityProviders()[0];
Assert.assertEquals(identityProvider.getIdentityProviderName(), "idp_test", "Update IDP failed");
Assert.assertEquals(identityProvider.getJustInTimeProvisioningConfig().getProvisioningEnabled(), true, "Update JIT provisioning config failed");
Assert.assertEquals(identityProvider.getDefaultProvisioningConnectorConfig().getBlocking(), true, "Set provisioning connector blocking failed");
Assert.assertEquals(identityProvider.getDefaultProvisioningConnectorConfig().getName(), connector, "Set default provisioning connector failed");
} catch (Exception e) {
Assert.fail("Error while trying to update outbound provisioning data", e);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig in project identity-api-server by wso2.
the class UpdateProvisioningConfiguration method getProvisioningIdentityProvider.
private IdentityProvider getProvisioningIdentityProvider(OutboundProvisioningConfiguration config) {
IdentityProvider identityProvider = new IdentityProvider();
identityProvider.setIdentityProviderName(config.getIdp());
JustInTimeProvisioningConfig jitProvisioningConfig = new JustInTimeProvisioningConfig();
setIfNotNull(config.getJit(), jitProvisioningConfig::setProvisioningEnabled);
identityProvider.setJustInTimeProvisioningConfig(jitProvisioningConfig);
ProvisioningConnectorConfig provisioningConfig = new ProvisioningConnectorConfig();
provisioningConfig.setName(config.getConnector());
provisioningConfig.setBlocking(config.getBlocking());
provisioningConfig.setRulesEnabled(config.getRules());
identityProvider.setDefaultProvisioningConnectorConfig(provisioningConfig);
return identityProvider;
}
Aggregations