Search in sources :

Example 11 with OutboundProvisioningConfig

use of org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig in project product-is by wso2.

the class ProvisioningTestCase method atEnd.

@AfterClass(alwaysRun = true)
public void atEnd() throws Exception {
    for (int portOff = 0; portOff < 2; portOff++) {
        ServiceProvider serviceProvider = applicationManagementServiceClients.get(portOff).getApplication("wso2carbon-local-sp");
        if (serviceProvider != null) {
            serviceProvider.setOutboundProvisioningConfig(new OutboundProvisioningConfig());
            applicationManagementServiceClients.get(portOff).updateApplicationData(serviceProvider);
        }
        identityProviderMgtServiceClients.get(portOff).deleteIdP(SAMPLE_IDENTITY_PROVIDER_NAME + "_" + Integer.toString(portOff));
    }
}
Also used : ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) AfterClass(org.testng.annotations.AfterClass)

Example 12 with OutboundProvisioningConfig

use of org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig in project product-is by wso2.

the class TestPassiveSTS method testUpdateSP.

@Test(alwaysRun = true, description = "4.1.5.2", dependsOnMethods = { "testAddSP" })
public void testUpdateSP() throws Exception {
    serviceProvider.setOutboundProvisioningConfig(new OutboundProvisioningConfig());
    List<InboundAuthenticationRequestConfig> authRequestList = new ArrayList<InboundAuthenticationRequestConfig>();
    String passiveSTSRealm = SERVICE_PROVIDER_NAME;
    if (passiveSTSRealm != null) {
        InboundAuthenticationRequestConfig opicAuthenticationRequest = new InboundAuthenticationRequestConfig();
        opicAuthenticationRequest.setInboundAuthKey(passiveSTSRealm);
        opicAuthenticationRequest.setInboundAuthType("passivests");
        Property property = new Property();
        property.setName("passiveSTSWReply");
        property.setValue(passiveStsSampleAppURL);
        opicAuthenticationRequest.setProperties(new Property[] { property });
        authRequestList.add(opicAuthenticationRequest);
    }
    if (authRequestList.size() > 0) {
        serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(authRequestList.toArray(new InboundAuthenticationRequestConfig[authRequestList.size()]));
    }
    appMgtclient.updateApplicationData(serviceProvider);
    Assert.assertNotEquals(appMgtclient.getApplication(SERVICE_PROVIDER_NAME).getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs().length, 0, "Fail to update service provider with passiveSTS configs");
}
Also used : ArrayList(java.util.ArrayList) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) Property(org.wso2.carbon.identity.application.common.model.xsd.Property) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) Test(org.testng.annotations.Test)

Example 13 with OutboundProvisioningConfig

use of org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig in project product-is by wso2.

the class TestPassiveSTS method testUpdateSP.

@Test(alwaysRun = true, description = "Update service provider with passiveSTS configs", dependsOnMethods = { "testAddSP" })
public void testUpdateSP() throws Exception {
    serviceProvider.setOutboundProvisioningConfig(new OutboundProvisioningConfig());
    List<InboundAuthenticationRequestConfig> authRequestList = new ArrayList<InboundAuthenticationRequestConfig>();
    InboundAuthenticationRequestConfig opicAuthenticationRequest = new InboundAuthenticationRequestConfig();
    opicAuthenticationRequest.setInboundAuthKey(SERVICE_PROVIDER_NAME);
    opicAuthenticationRequest.setInboundAuthType("passivests");
    Property property = new Property();
    property.setName("passiveSTSWReply");
    property.setValue(PASSIVE_STS_SAMPLE_APP_URL);
    opicAuthenticationRequest.setProperties(new Property[] { property });
    authRequestList.add(opicAuthenticationRequest);
    if (authRequestList.size() > 0) {
        serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(authRequestList.toArray(new InboundAuthenticationRequestConfig[0]));
    }
    appMgtClient.updateApplicationData(serviceProvider);
    Assert.assertNotEquals(appMgtClient.getApplication(SERVICE_PROVIDER_NAME).getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs().length, 0, "Fail to update service provider with passiveSTS configs for tenant domain: " + tenantDomain);
}
Also used : ArrayList(java.util.ArrayList) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) Property(org.wso2.carbon.identity.application.common.model.xsd.Property) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) Test(org.testng.annotations.Test) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest)

Example 14 with OutboundProvisioningConfig

use of org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig in project product-is by wso2.

the class OIDCAbstractUIIntegrationTest method createApplication.

/**
 * Register an OIDC application in OP
 *
 * @param application application instance
 * @throws Exception
 */
public void createApplication(OIDCApplication application) throws Exception {
    log.info("Creating application " + application.getApplicationName());
    OAuthConsumerAppDTO appDTO = new OAuthConsumerAppDTO();
    appDTO.setApplicationName(application.getApplicationName());
    appDTO.setCallbackUrl(application.getCallBackURL());
    appDTO.setOAuthVersion(OIDCUITestConstants.OAUTH_VERSION_2);
    appDTO.setGrantTypes("authorization_code implicit password client_credentials refresh_token " + "urn:ietf:params:oauth:grant-type:saml2-bearer iwa:ntlm");
    oauthAdminClient.registerOAuthApplicationData(appDTO);
    OAuthConsumerAppDTO[] appDtos = oauthAdminClient.getAllOAuthApplicationData();
    for (OAuthConsumerAppDTO appDto : appDtos) {
        if (appDto.getApplicationName().equals(application.getApplicationName())) {
            application.setClientId(appDto.getOauthConsumerKey());
            application.setClientSecret(appDto.getOauthConsumerSecret());
        }
    }
    ServiceProvider serviceProvider = new ServiceProvider();
    serviceProvider.setApplicationName(application.getApplicationName());
    serviceProvider.setDescription(application.getApplicationName());
    applicationManagementServiceClient.createApplication(serviceProvider);
    serviceProvider = applicationManagementServiceClient.getApplication(application.getApplicationName());
    ClaimConfig claimConfig = null;
    if (!application.getRequiredClaims().isEmpty()) {
        claimConfig = new ClaimConfig();
        for (String claimUri : application.getRequiredClaims()) {
            Claim claim = new Claim();
            claim.setClaimUri(claimUri);
            ClaimMapping claimMapping = new ClaimMapping();
            claimMapping.setRequested(true);
            claimMapping.setLocalClaim(claim);
            claimMapping.setRemoteClaim(claim);
            claimConfig.addClaimMappings(claimMapping);
        }
    }
    serviceProvider.setClaimConfig(claimConfig);
    serviceProvider.setOutboundProvisioningConfig(new OutboundProvisioningConfig());
    List<InboundAuthenticationRequestConfig> authRequestList = new ArrayList<>();
    if (application.getClientId() != null) {
        InboundAuthenticationRequestConfig inboundAuthenticationRequestConfig = new InboundAuthenticationRequestConfig();
        inboundAuthenticationRequestConfig.setInboundAuthKey(application.getClientId());
        inboundAuthenticationRequestConfig.setInboundAuthType(OIDCUITestConstants.OAUTH_2);
        if (StringUtils.isNotBlank(application.getClientSecret())) {
            Property property = new Property();
            property.setName(OIDCUITestConstants.OAUTH_CONSUMER_SECRET);
            property.setValue(application.getClientSecret());
            Property[] properties = { property };
            inboundAuthenticationRequestConfig.setProperties(properties);
        }
        authRequestList.add(inboundAuthenticationRequestConfig);
    }
    if (authRequestList.size() > 0) {
        serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(authRequestList.toArray(new InboundAuthenticationRequestConfig[authRequestList.size()]));
    }
    applicationManagementServiceClient.updateApplicationData(serviceProvider);
}
Also used : OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO) ArrayList(java.util.ArrayList) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) ClaimMapping(org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping) ClaimConfig(org.wso2.carbon.identity.application.common.model.xsd.ClaimConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) Property(org.wso2.carbon.identity.application.common.model.xsd.Property) Claim(org.wso2.carbon.identity.application.common.model.xsd.Claim)

Example 15 with OutboundProvisioningConfig

use of org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig 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);
    }
}
Also used : ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ArrayList(java.util.ArrayList) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest)

Aggregations

ArrayList (java.util.ArrayList)16 OutboundProvisioningConfig (org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig)14 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig)10 ServiceProvider (org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider)8 Property (org.wso2.carbon.identity.application.common.model.xsd.Property)7 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)6 Claim (org.wso2.carbon.identity.application.common.model.xsd.Claim)6 ClaimConfig (org.wso2.carbon.identity.application.common.model.xsd.ClaimConfig)6 ClaimMapping (org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping)6 OAuthConsumerAppDTO (org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO)6 OutboundProvisioningConfig (org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig)5 Test (org.testng.annotations.Test)4 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)4 JustInTimeProvisioningConfig (org.wso2.carbon.identity.application.common.model.xsd.JustInTimeProvisioningConfig)4 IdentityProvider (org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider)3 InboundProvisioningConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundProvisioningConfig)3 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig)3 PreparedStatement (java.sql.PreparedStatement)2 NamedPreparedStatement (org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement)2 AuthenticationStep (org.wso2.carbon.identity.application.common.model.AuthenticationStep)2