use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project product-is by wso2.
the class IdentityProviderMgtServiceTestCase method testGetResidentIdP.
@Test(priority = 1, groups = "wso2.is", description = "Test getResidentIdP operation")
public void testGetResidentIdP() throws Exception {
log.info("Retrieving resident identity provide");
IdentityProvider idProvider = idpMgtServiceClient.getResidentIdP();
Assert.assertNotNull(idProvider, "Resident identity provider retrieval failed");
sampleCertificate = idProvider.getCertificate();
// Extract authenticator configurations
FederatedAuthenticatorConfig[] authConfigs = idProvider.getFederatedAuthenticatorConfigs();
log.info("Authenticator configs : " + authConfigs.length);
// Extract provisioning configurations
ProvisioningConnectorConfig[] provisioningConfigs = idProvider.getProvisioningConnectorConfigs();
log.info("Provisioning configs : " + provisioningConfigs.length);
// check default identity provider name
Assert.assertEquals(idProvider.getIdentityProviderName(), "LOCAL", "Default resident identity provider name changed");
// check Default number of authentication configurations
Map<String, FederatedAuthenticatorConfig> fedAuthConfigMap = new HashMap<String, FederatedAuthenticatorConfig>();
for (FederatedAuthenticatorConfig config : authConfigs) {
fedAuthConfigMap.put(config.getName(), config);
}
Assert.assertEquals(fedAuthConfigMap.containsKey("openidconnect"), true, "Default auth config not found");
Assert.assertEquals(fedAuthConfigMap.containsKey("samlsso"), true, "Default auth config not found");
Assert.assertEquals(fedAuthConfigMap.containsKey("openid"), true, "Default auth config not found");
Assert.assertEquals(fedAuthConfigMap.containsKey("passivests"), true, "Default auth config not found");
// check Default number of provisioning configurations
Map<String, ProvisioningConnectorConfig> provisioningConfigMap = new HashMap<String, ProvisioningConnectorConfig>();
for (ProvisioningConnectorConfig config : provisioningConfigs) {
provisioningConfigMap.put(config.getName(), config);
}
Assert.assertEquals(provisioningConfigMap.containsKey("scim"), true, "Default provisioning config not found");
}
use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project product-is by wso2.
the class ResidentIDPConfigsTestCase method getProvisioningConfigMap.
private Map<String, String> getProvisioningConfigMap(IdentityProvider idProvider) {
ProvisioningConnectorConfig[] provisioningConfigs = idProvider.getProvisioningConnectorConfigs();
Map<String, String> provisioningConfigMap = new HashMap<String, String>();
for (ProvisioningConnectorConfig config : provisioningConfigs) {
for (Property property : config.getProvisioningProperties()) {
provisioningConfigMap.put(property.getName(), property.getValue());
}
}
return provisioningConfigMap;
}
use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project product-is by wso2.
the class DBSeperationTestCase method updateIdpTest.
@Test(alwaysRun = true, description = "Testing update Identity Provider")
public void updateIdpTest() {
try {
IdentityProvider identityProvider = new IdentityProvider();
identityProvider.setIdentityProviderName(TENANT_IDP);
ProvisioningConnectorConfig scimConfig = new ProvisioningConnectorConfig();
scimConfig.setName("scim");
Property userProperty = new Property();
userProperty.setName("scim-username");
userProperty.setValue("admin");
scimConfig.addProvisioningProperties(userProperty);
identityProvider.setProvisioningConnectorConfigs(new ProvisioningConnectorConfig[] { scimConfig });
identityProviderMgtServiceClient.addIdP(identityProvider);
identityProviderMgtServiceClient.deleteIdP(TENANT_IDP);
IdentityProvider deletedIdP = identityProviderMgtServiceClient.getIdPByName(TENANT_IDP);
Assert.assertNull("Failed to delete the IdP :" + TENANT_IDP, deletedIdP);
} catch (Exception e) {
Assert.fail("Identity Provider addition or deletion failed at database separation test.");
}
}
use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project product-is by wso2.
the class ApplicationManagementTestCase method testUpdateOutboundProvisioningData.
@Test(alwaysRun = true, description = "2.1.2.7")
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.ProvisioningConnectorConfig in project identity-api-server by wso2.
the class ServerIdpManagementService method getOutboundConnector.
/**
* Get specific outbound provisioning connector of an Identity Provider.
*
* @param idpId Identity Provider resource ID.
* @param connectorId Outbound provisioning connector ID.
* @return OutboundConnector.
*/
public OutboundConnector getOutboundConnector(String idpId, String connectorId) {
try {
IdentityProvider idp = IdentityProviderServiceHolder.getIdentityProviderManager().getIdPByResourceId(idpId, ContextLoader.getTenantDomainFromContext(), true);
if (idp == null) {
throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_IDP_NOT_FOUND, idpId);
}
ProvisioningConnectorConfig[] connectorConfigs = idp.getProvisioningConnectorConfigs();
if (connectorConfigs != null) {
for (ProvisioningConnectorConfig config : connectorConfigs) {
if (StringUtils.equals(config.getName(), base64URLDecode(connectorId))) {
return createOutboundConnector(connectorId, idp);
}
}
}
throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_CONNECTOR_NOT_FOUND_FOR_IDP, connectorId);
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_IDP_CONNECTOR, connectorId);
}
}
Aggregations