Search in sources :

Example 26 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.xsd.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");
}
Also used : FederatedAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig) HashMap(java.util.HashMap) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.ProvisioningConnectorConfig) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 27 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.xsd.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;
}
Also used : HashMap(java.util.HashMap) Property(org.wso2.carbon.identity.application.common.model.idp.xsd.Property) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.ProvisioningConnectorConfig)

Example 28 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.xsd.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.");
    }
}
Also used : IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) Property(org.wso2.carbon.identity.application.common.model.idp.xsd.Property) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.ProvisioningConnectorConfig) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 29 with ProvisioningConnectorConfig

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 = "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);
    }
}
Also used : JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.JustInTimeProvisioningConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ArrayList(java.util.ArrayList) IdentityProvider(org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) Test(org.testng.annotations.Test)

Example 30 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.xsd.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);
    }
}
Also used : IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) IdentityProviderManagementException(org.wso2.carbon.idp.mgt.IdentityProviderManagementException) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)

Aggregations

ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)39 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)19 IdentityProviderProperty (org.wso2.carbon.identity.application.common.model.IdentityProviderProperty)19 Property (org.wso2.carbon.identity.application.common.model.Property)19 ArrayList (java.util.ArrayList)17 IdentityProviderManagementException (org.wso2.carbon.idp.mgt.IdentityProviderManagementException)14 ClaimConfig (org.wso2.carbon.identity.application.common.model.ClaimConfig)10 FederatedAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig)10 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.idp.xsd.ProvisioningConnectorConfig)10 PreparedStatement (java.sql.PreparedStatement)9 Property (org.wso2.carbon.identity.application.common.model.idp.xsd.Property)9 Test (org.testng.annotations.Test)8 Claim (org.wso2.carbon.identity.application.common.model.Claim)7 ClaimMapping (org.wso2.carbon.identity.application.common.model.ClaimMapping)7 LocalRole (org.wso2.carbon.identity.application.common.model.LocalRole)7 PermissionsAndRoleConfig (org.wso2.carbon.identity.application.common.model.PermissionsAndRoleConfig)7 RoleMapping (org.wso2.carbon.identity.application.common.model.RoleMapping)7 ResultSet (java.sql.ResultSet)6 HashMap (java.util.HashMap)6 JustInTimeProvisioningConfig (org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig)6