Search in sources :

Example 6 with JustInTimeProvisioningConfig

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

the class JustInTimeProvisioningTestCase method updateIdentityProviderJitConfiguration.

/**
 * To update the Identity provider JIT configuration.
 *
 * @param isModifyUserNameAllowed To mention whether isModifyUserNameAllowed.
 * @throws Exception Exception.
 */
private void updateIdentityProviderJitConfiguration(boolean isPasswordProvisioningEnabled, boolean isModifyUserNameAllowed, boolean isPromptConsent, String userStore) throws Exception {
    IdentityProvider identityProvider = super.getIdentityProvider(PORT_OFFSET_0, IDENTITY_PROVIDER_NAME);
    JustInTimeProvisioningConfig justInTimeProvisioningConfig = identityProvider.getJustInTimeProvisioningConfig();
    justInTimeProvisioningConfig.setPasswordProvisioningEnabled(isPasswordProvisioningEnabled);
    justInTimeProvisioningConfig.setModifyUserNameAllowed(isModifyUserNameAllowed);
    justInTimeProvisioningConfig.setPromptConsent(isPromptConsent);
    justInTimeProvisioningConfig.setProvisioningUserStore(userStore);
    identityProvider.setJustInTimeProvisioningConfig(justInTimeProvisioningConfig);
    super.updateIdentityProvider(PORT_OFFSET_0, IDENTITY_PROVIDER_NAME, identityProvider);
}
Also used : JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.JustInTimeProvisioningConfig) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider)

Example 7 with JustInTimeProvisioningConfig

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

the class ProvisioningTestCase method addSP.

private void addSP(int portOffset) throws Exception {
    ServiceProvider serviceProvider = applicationManagementServiceClients.get(portOffset).getApplication("wso2carbon-local-sp");
    if (serviceProvider == null) {
        serviceProvider = new ServiceProvider();
        serviceProvider.setApplicationName("wso2carbon-local-sp");
        try {
            applicationManagementServiceClients.get(portOffset).createApplication(serviceProvider);
            serviceProvider = applicationManagementServiceClients.get(portOffset).getApplication("wso2carbon-local-sp");
        } catch (Exception ex) {
            // log.error("Error occurred during obtaining applicationManagementServiceClients", ex);
            throw new Exception("Error occurred during obtaining applicationManagementServiceClients", ex);
        }
    }
    InboundProvisioningConfig inBoundProConfig = new InboundProvisioningConfig();
    inBoundProConfig.setProvisioningUserStore("");
    serviceProvider.setInboundProvisioningConfig(inBoundProConfig);
    String proProvider = SAMPLE_IDENTITY_PROVIDER_NAME + "_" + Integer.toString(portOffset);
    String connector = "scim";
    JustInTimeProvisioningConfig jitpro = new JustInTimeProvisioningConfig();
    jitpro.setProvisioningEnabled(false);
    org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider proIdp = new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider();
    proIdp.setIdentityProviderName(proProvider);
    org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig proCon = new org.wso2.carbon.identity.application.common.model.xsd.ProvisioningConnectorConfig();
    proCon.setBlocking(true);
    proCon.setName(connector);
    proIdp.setJustInTimeProvisioningConfig(jitpro);
    proIdp.setDefaultProvisioningConnectorConfig(proCon);
    List<org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider> provisioningIdps = new ArrayList<org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider>();
    provisioningIdps.add(proIdp);
    if (provisioningIdps.size() > 0) {
        OutboundProvisioningConfig outboundProConfig = new OutboundProvisioningConfig();
        outboundProConfig.setProvisioningIdentityProviders(provisioningIdps.toArray(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[provisioningIdps.size()]));
        serviceProvider.setOutboundProvisioningConfig(outboundProConfig);
    }
    applicationManagementServiceClients.get(portOffset).updateApplicationData(serviceProvider);
}
Also used : InboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundProvisioningConfig) ArrayList(java.util.ArrayList) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) CharonException(org.wso2.charon.core.exceptions.CharonException) XPathExpressionException(javax.xml.xpath.XPathExpressionException) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.JustInTimeProvisioningConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.ProvisioningConnectorConfig)

Example 8 with JustInTimeProvisioningConfig

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

the class OIDCFederatedIdpInitLogoutTest method createIdentityProviderInPrimaryIS.

private void createIdentityProviderInPrimaryIS() throws Exception {
    IdentityProvider identityProvider = new IdentityProvider();
    identityProvider.setIdentityProviderName(PRIMARY_IS_IDP_NAME);
    // Set JWKS Uri to identity provider.
    IdentityProviderProperty jwksUriProperty = new IdentityProviderProperty();
    jwksUriProperty.setName("jwksUri");
    jwksUriProperty.setValue(SECONDARY_IS_JWKS_URI);
    IdentityProviderProperty issuerProperty = new IdentityProviderProperty();
    issuerProperty.setName("idpIssuerName");
    issuerProperty.setValue(SECONDARY_IS_TOKEN_ENDPOINT);
    IdentityProviderProperty[] properties = { jwksUriProperty, issuerProperty };
    identityProvider.setIdpProperties(properties);
    FederatedAuthenticatorConfig oidcAuthnConfig = new FederatedAuthenticatorConfig();
    oidcAuthnConfig.setName(PRIMARY_IS_IDP_AUTHENTICATOR_NAME_OIDC);
    oidcAuthnConfig.setDisplayName("openidconnect");
    oidcAuthnConfig.setEnabled(true);
    oidcAuthnConfig.setProperties(getOIDCAuthnConfigProperties());
    identityProvider.setDefaultAuthenticatorConfig(oidcAuthnConfig);
    identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { oidcAuthnConfig });
    JustInTimeProvisioningConfig jitConfig = new JustInTimeProvisioningConfig();
    jitConfig.setProvisioningEnabled(true);
    jitConfig.setProvisioningUserStore("PRIMARY");
    identityProvider.setJustInTimeProvisioningConfig(jitConfig);
    super.addIdentityProvider(PORT_OFFSET_0, identityProvider);
    Assert.assertNotNull(getIdentityProvider(PORT_OFFSET_0, PRIMARY_IS_IDP_NAME), "Failed to create " + "Identity Provider 'trustedIdP' in primary IS");
}
Also used : IdentityProviderProperty(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProviderProperty) FederatedAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig) JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.JustInTimeProvisioningConfig) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider)

Example 9 with JustInTimeProvisioningConfig

use of org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig 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 10 with JustInTimeProvisioningConfig

use of org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig in project identity-api-server by wso2.

the class ServerIdpManagementService method updateJIT.

private void updateJIT(IdentityProvider identityProvider, JustInTimeProvisioning jit) {
    if (jit != null) {
        JustInTimeProvisioning.SchemeEnum schemeEnum = jit.getScheme();
        JustInTimeProvisioningConfig jitConfig = new JustInTimeProvisioningConfig();
        jitConfig.setProvisioningEnabled(jit.getIsEnabled());
        jitConfig.setProvisioningUserStore(jit.getUserstore());
        switch(schemeEnum) {
            case PROMPT_USERNAME_PASSWORD_CONSENT:
                jitConfig.setModifyUserNameAllowed(true);
                jitConfig.setPasswordProvisioningEnabled(true);
                jitConfig.setPromptConsent(true);
                break;
            case PROMPT_PASSWORD_CONSENT:
                jitConfig.setModifyUserNameAllowed(false);
                jitConfig.setPasswordProvisioningEnabled(true);
                jitConfig.setPromptConsent(true);
                break;
            case PROMPT_CONSENT:
                jitConfig.setModifyUserNameAllowed(false);
                jitConfig.setPasswordProvisioningEnabled(false);
                jitConfig.setPromptConsent(true);
                break;
            case PROVISION_SILENTLY:
                jitConfig.setModifyUserNameAllowed(false);
                jitConfig.setPasswordProvisioningEnabled(false);
                jitConfig.setPromptConsent(false);
                break;
        }
        identityProvider.setJustInTimeProvisioningConfig(jitConfig);
    }
}
Also used : JustInTimeProvisioning(org.wso2.carbon.identity.api.server.idp.v1.model.JustInTimeProvisioning) JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig)

Aggregations

JustInTimeProvisioningConfig (org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig)8 ArrayList (java.util.ArrayList)7 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)6 IdentityProvider (org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider)6 JustInTimeProvisioningConfig (org.wso2.carbon.identity.application.common.model.idp.xsd.JustInTimeProvisioningConfig)6 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)5 FederatedAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig)4 JustInTimeProvisioningConfig (org.wso2.carbon.identity.application.common.model.xsd.JustInTimeProvisioningConfig)4 OutboundProvisioningConfig (org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig)4 IdentityProviderManagementException (org.wso2.carbon.idp.mgt.IdentityProviderManagementException)4 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 Test (org.testng.annotations.Test)3 ClaimConfig (org.wso2.carbon.identity.application.common.model.ClaimConfig)3 IdentityProviderProperty (org.wso2.carbon.identity.application.common.model.IdentityProviderProperty)3 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 ServiceProvider (org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider)3 SQLException (java.sql.SQLException)2