Search in sources :

Example 1 with OutboundProvisioningConfiguration

use of org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration in project carbon-identity-framework by wso2.

the class OutboundProvisioningManager method getOutboundProvisioningConnectors.

/**
 * TODO: Need to cache the output from this method.
 *
 * @return
 * @throws UserStoreException
 */
private Map<String, RuntimeProvisioningConfig> getOutboundProvisioningConnectors(ServiceProvider serviceProvider, String tenantDomain) throws IdentityProvisioningException {
    Map<String, RuntimeProvisioningConfig> connectors = new HashMap<>();
    ServiceProviderProvisioningConnectorCacheKey key;
    ServiceProviderProvisioningConnectorCacheEntry entry;
    // Reading from the cache.
    if (serviceProvider != null && tenantDomain != null) {
        key = new ServiceProviderProvisioningConnectorCacheKey(serviceProvider.getApplicationName());
        entry = ServiceProviderProvisioningConnectorCache.getInstance().getValueFromCache(key, tenantDomain);
        // cache hit
        if (entry != null) {
            if (log.isDebugEnabled()) {
                log.debug("Provisioning cache HIT for " + serviceProvider + " of " + tenantDomain);
            }
            return entry.getConnectors();
        }
    } else {
        throw new IdentityProvisioningException("Error reading service provider from cache.");
    }
    // NOW build the Map
    // a list of registered provisioning connector factories.
    Map<String, AbstractProvisioningConnectorFactory> registeredConnectorFactories = IdentityProvisionServiceComponent.getConnectorFactories();
    // get all registered list of out-bound provisioning connectors registered for the local
    // service provider.
    OutboundProvisioningConfig outboundProvisioningConfiguration = serviceProvider.getOutboundProvisioningConfig();
    if (outboundProvisioningConfiguration == null) {
        if (log.isDebugEnabled()) {
            log.debug("No outbound provisioning configuration defined for local service provider.");
        }
        // empty list.
        return new HashMap<String, RuntimeProvisioningConfig>();
    }
    // get the list of registered provisioning identity providers in out-bound provisioning
    // configuration.
    IdentityProvider[] provisionningIdPList = outboundProvisioningConfiguration.getProvisioningIdentityProviders();
    if (provisionningIdPList != null && provisionningIdPList.length > 0) {
        for (IdentityProvider fIdP : provisionningIdPList) {
            try {
                AbstractOutboundProvisioningConnector connector;
                ProvisioningConnectorConfig defaultConnector = fIdP.getDefaultProvisioningConnectorConfig();
                if (defaultConnector != null) {
                    // if no default provisioning connector defined for this identity provider,
                    // we can safely ignore it - need not to worry about provisioning.
                    String connectorType = fIdP.getDefaultProvisioningConnectorConfig().getName();
                    boolean enableJitProvisioning = false;
                    if (fIdP.getJustInTimeProvisioningConfig() != null && fIdP.getJustInTimeProvisioningConfig().isProvisioningEnabled()) {
                        enableJitProvisioning = true;
                    }
                    connector = getOutboundProvisioningConnector(fIdP, registeredConnectorFactories, tenantDomain, enableJitProvisioning);
                    // configuration of the local service provider.
                    if (connector != null) {
                        RuntimeProvisioningConfig proConfig = new RuntimeProvisioningConfig();
                        proConfig.setProvisioningConnectorEntry(new SimpleEntry<>(connectorType, connector));
                        proConfig.setBlocking(defaultConnector.isBlocking());
                        proConfig.setPolicyEnabled(defaultConnector.isRulesEnabled());
                        connectors.put(fIdP.getIdentityProviderName(), proConfig);
                    }
                }
            } catch (IdentityProviderManagementException e) {
                throw new IdentityProvisioningException("Error while retrieving idp configuration for " + fIdP.getIdentityProviderName(), e);
            }
        }
    }
    entry = new ServiceProviderProvisioningConnectorCacheEntry();
    entry.setConnectors(connectors);
    ServiceProviderProvisioningConnectorCache.getInstance().addToCache(key, entry, tenantDomain);
    if (log.isDebugEnabled()) {
        log.debug("Entry added successfully ");
    }
    return connectors;
}
Also used : HashMap(java.util.HashMap) IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig) ServiceProviderProvisioningConnectorCacheEntry(org.wso2.carbon.identity.provisioning.cache.ServiceProviderProvisioningConnectorCacheEntry) ServiceProviderProvisioningConnectorCacheKey(org.wso2.carbon.identity.provisioning.cache.ServiceProviderProvisioningConnectorCacheKey) IdentityProviderManagementException(org.wso2.carbon.idp.mgt.IdentityProviderManagementException) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)

Example 2 with OutboundProvisioningConfiguration

use of org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration in project identity-api-server by wso2.

the class BuildProvisioningConfiguration method getOutboundProvisioningConfiguration.

private OutboundProvisioningConfiguration getOutboundProvisioningConfiguration(IdentityProvider identityProvider) {
    ProvisioningConnectorConfig provisioningConfig = identityProvider.getDefaultProvisioningConnectorConfig();
    JustInTimeProvisioningConfig justInTimeProvisioningConfig = identityProvider.getJustInTimeProvisioningConfig();
    return new OutboundProvisioningConfiguration().idp(identityProvider.getIdentityProviderName()).blocking(provisioningConfig.isBlocking()).connector(provisioningConfig.getName()).rules(provisioningConfig.isRulesEnabled()).jit(justInTimeProvisioningConfig != null && justInTimeProvisioningConfig.isProvisioningEnabled());
}
Also used : JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig) OutboundProvisioningConfiguration(org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)

Example 3 with OutboundProvisioningConfiguration

use of org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration in project identity-api-server by wso2.

the class BuildProvisioningConfiguration method apply.

@Override
public ProvisioningConfiguration apply(ServiceProvider application) {
    ProvisioningConfiguration config = new ProvisioningConfiguration();
    if (application.getInboundProvisioningConfig() != null) {
        config.inboundProvisioning(buildInboundProvisioningConfig(application.getInboundProvisioningConfig()));
    }
    if (application.getOutboundProvisioningConfig() != null) {
        List<OutboundProvisioningConfiguration> provisioningIdps = buildOutboundProvisioningConfig(application.getOutboundProvisioningConfig());
        config.outboundProvisioningIdps(provisioningIdps);
    }
    return config;
}
Also used : OutboundProvisioningConfiguration(org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration) InboundSCIMProvisioningConfiguration(org.wso2.carbon.identity.api.server.application.management.v1.InboundSCIMProvisioningConfiguration) ProvisioningConfiguration(org.wso2.carbon.identity.api.server.application.management.v1.ProvisioningConfiguration) OutboundProvisioningConfiguration(org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration)

Example 4 with OutboundProvisioningConfiguration

use of org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration in project identity-api-server by wso2.

the class UpdateProvisioningConfiguration method apply.

@Override
public void apply(ServiceProvider application, ProvisioningConfiguration provisioningConfigApiModel) {
    if (provisioningConfigApiModel != null) {
        InboundSCIMProvisioningConfiguration inboundProvisioningModel = provisioningConfigApiModel.getInboundProvisioning();
        if (inboundProvisioningModel != null) {
            InboundProvisioningConfig inboundProvisioningConfig = getInboundProvisioningConfig(application);
            setIfNotNull(inboundProvisioningModel.getProxyMode(), inboundProvisioningConfig::setDumbMode);
            setIfNotNull(inboundProvisioningModel.getProvisioningUserstoreDomain(), inboundProvisioningConfig::setProvisioningUserStore);
            application.setInboundProvisioningConfig(inboundProvisioningConfig);
        }
        List<OutboundProvisioningConfiguration> outboundProvisioningIdps = provisioningConfigApiModel.getOutboundProvisioningIdps();
        if (outboundProvisioningIdps != null) {
            OutboundProvisioningConfig outboundProvisioningConfig = getOutboundProvisionConfig(application);
            IdentityProvider[] identityProviders = getProvisioningIdps(outboundProvisioningIdps);
            outboundProvisioningConfig.setProvisioningIdentityProviders(identityProviders);
            application.setOutboundProvisioningConfig(outboundProvisioningConfig);
        }
    }
}
Also used : InboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.InboundProvisioningConfig) InboundSCIMProvisioningConfiguration(org.wso2.carbon.identity.api.server.application.management.v1.InboundSCIMProvisioningConfiguration) IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) OutboundProvisioningConfiguration(org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig)

Example 5 with OutboundProvisioningConfiguration

use of org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration 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;
}
Also used : JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig) IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)

Aggregations

OutboundProvisioningConfiguration (org.wso2.carbon.identity.api.server.application.management.v1.OutboundProvisioningConfiguration)3 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)3 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)3 InboundSCIMProvisioningConfiguration (org.wso2.carbon.identity.api.server.application.management.v1.InboundSCIMProvisioningConfiguration)2 JustInTimeProvisioningConfig (org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig)2 OutboundProvisioningConfig (org.wso2.carbon.identity.application.common.model.OutboundProvisioningConfig)2 HashMap (java.util.HashMap)1 ProvisioningConfiguration (org.wso2.carbon.identity.api.server.application.management.v1.ProvisioningConfiguration)1 InboundProvisioningConfig (org.wso2.carbon.identity.application.common.model.InboundProvisioningConfig)1 ServiceProviderProvisioningConnectorCacheEntry (org.wso2.carbon.identity.provisioning.cache.ServiceProviderProvisioningConnectorCacheEntry)1 ServiceProviderProvisioningConnectorCacheKey (org.wso2.carbon.identity.provisioning.cache.ServiceProviderProvisioningConnectorCacheKey)1 IdentityProviderManagementException (org.wso2.carbon.idp.mgt.IdentityProviderManagementException)1