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;
}
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());
}
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;
}
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);
}
}
}
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;
}
Aggregations