use of org.wso2.carbon.identity.application.common.model.xsd.InboundProvisioningConfig in project carbon-identity-framework by wso2.
the class ApplicationDAOImpl method updateInboundProvisioningConfiguration.
/**
* @param applicationId
* @param inBoundProvisioningConfig
* @param connection
* @throws SQLException
*/
private void updateInboundProvisioningConfiguration(int applicationId, InboundProvisioningConfig inBoundProvisioningConfig, Connection connection) throws SQLException {
if (inBoundProvisioningConfig == null) {
return;
}
int tenantID = CarbonContext.getThreadLocalCarbonContext().getTenantId();
PreparedStatement inboundProConfigPrepStmt = null;
try {
inboundProConfigPrepStmt = connection.prepareStatement(UPDATE_BASIC_APPINFO_WITH_PRO_PROPERTIES);
// PROVISIONING_USERSTORE_DOMAIN=?
inboundProConfigPrepStmt.setString(1, inBoundProvisioningConfig.getProvisioningUserStore());
inboundProConfigPrepStmt.setString(2, inBoundProvisioningConfig.isDumbMode() ? "1" : "0");
inboundProConfigPrepStmt.setInt(3, tenantID);
inboundProConfigPrepStmt.setInt(4, applicationId);
inboundProConfigPrepStmt.execute();
} finally {
IdentityApplicationManagementUtil.closeStatement(inboundProConfigPrepStmt);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundProvisioningConfig in project carbon-identity-framework by wso2.
the class ApplicationBean method updateLocalSp.
/**
* @param request
*/
public void updateLocalSp(HttpServletRequest request) {
// update basic info.
serviceProvider.setApplicationName(request.getParameter("spName"));
serviceProvider.setDescription(request.getParameter("sp-description"));
String provisioningUserStore = request.getParameter("scim-inbound-userstore");
InboundProvisioningConfig inBoundProConfig = new InboundProvisioningConfig();
inBoundProConfig.setProvisioningUserStore(provisioningUserStore);
inBoundProConfig.setDumbMode(Boolean.parseBoolean(request.getParameter(DUMB)));
serviceProvider.setInboundProvisioningConfig(inBoundProConfig);
String[] provisioningProviders = request.getParameterValues("provisioning_idp");
List<IdentityProvider> provisioningIdps = new ArrayList<IdentityProvider>();
if (serviceProvider.getOutboundProvisioningConfig() == null || provisioningProviders == null || provisioningProviders.length == 0) {
serviceProvider.setOutboundProvisioningConfig(new OutboundProvisioningConfig());
}
if (provisioningProviders != null && provisioningProviders.length > 0) {
for (String proProvider : provisioningProviders) {
String connector = request.getParameter("provisioning_con_idp_" + proProvider);
String jitEnabled = request.getParameter("provisioning_jit_" + proProvider);
String blocking = request.getParameter("blocking_prov_" + proProvider);
String rulesEnabled = request.getParameter("rules_enabled_" + proProvider);
JustInTimeProvisioningConfig jitpro = new JustInTimeProvisioningConfig();
if ("on".equals(jitEnabled)) {
jitpro.setProvisioningEnabled(true);
}
if (connector != null) {
IdentityProvider proIdp = new IdentityProvider();
proIdp.setIdentityProviderName(proProvider);
ProvisioningConnectorConfig proCon = new ProvisioningConnectorConfig();
if ("on".equals(blocking)) {
proCon.setBlocking(true);
}
if ("on".equals(rulesEnabled)) {
proCon.setRulesEnabled(true);
}
proCon.setName(connector);
proIdp.setJustInTimeProvisioningConfig(jitpro);
proIdp.setDefaultProvisioningConnectorConfig(proCon);
provisioningIdps.add(proIdp);
}
}
if (CollectionUtils.isNotEmpty(provisioningIdps)) {
OutboundProvisioningConfig outboundProConfig = new OutboundProvisioningConfig();
outboundProConfig.setProvisioningIdentityProviders(provisioningIdps.toArray(new IdentityProvider[provisioningIdps.size()]));
serviceProvider.setOutboundProvisioningConfig(outboundProConfig);
}
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundProvisioningConfig in project carbon-identity-framework by wso2.
the class ApplicationManagementServiceImplTest method addApplicationConfigurations.
private void addApplicationConfigurations(ServiceProvider serviceProvider) {
serviceProvider.setDescription("Created for testing");
serviceProvider.setSaasApp(TRUE);
// Inbound Authentication Configurations.
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
InboundAuthenticationRequestConfig authRequestConfig = new InboundAuthenticationRequestConfig();
authRequestConfig.setInboundAuthKey("auth key");
authRequestConfig.setInboundAuthType("oauth2");
InboundAuthenticationRequestConfig[] authRequests = new InboundAuthenticationRequestConfig[] { authRequestConfig };
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(authRequests);
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
// Inbound Provisioning Configurations.
InboundProvisioningConfig provisioningConfig = new InboundProvisioningConfig();
provisioningConfig.setProvisioningUserStore("UserStore");
serviceProvider.setInboundProvisioningConfig(provisioningConfig);
// OutBound Provisioning Configurations.
IdentityProvider provisioningIdP = new IdentityProvider();
provisioningIdP.setIdentityProviderName("Provisioning IdP");
OutboundProvisioningConfig outboundProvisioningConfig = new OutboundProvisioningConfig();
outboundProvisioningConfig.setProvisioningIdentityProviders(new IdentityProvider[] { provisioningIdP });
ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig();
provisioningConnectorConfig.setName("Provisioning connector");
provisioningIdP.setDefaultProvisioningConnectorConfig(provisioningConnectorConfig);
serviceProvider.setOutboundProvisioningConfig(outboundProvisioningConfig);
// Local And OutBound Authentication Configuration.
LocalAndOutboundAuthenticationConfig authenticationConfig = new LocalAndOutboundAuthenticationConfig();
AuthenticationStep authenticationStep = new AuthenticationStep();
IdentityProvider identityProvider = new IdentityProvider();
identityProvider.setIdentityProviderName(IDP_NAME_1);
FederatedAuthenticatorConfig federatedAuthenticatorConfig = new FederatedAuthenticatorConfig();
federatedAuthenticatorConfig.setName("Federated authenticator");
identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { federatedAuthenticatorConfig });
authenticationStep.setFederatedIdentityProviders(new IdentityProvider[] { identityProvider });
LocalAuthenticatorConfig localAuthenticatorConfig = new LocalAuthenticatorConfig();
localAuthenticatorConfig.setName("Local authenticator");
authenticationStep.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localAuthenticatorConfig });
authenticationConfig.setAuthenticationSteps(new AuthenticationStep[] { authenticationStep });
serviceProvider.setLocalAndOutBoundAuthenticationConfig(authenticationConfig);
// Request Path Authenticator Configuration.
RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
requestPathAuthenticatorConfig.setName("Request path authenticator");
serviceProvider.setRequestPathAuthenticatorConfigs(new RequestPathAuthenticatorConfig[] { requestPathAuthenticatorConfig });
// Claim Configurations.
ClaimConfig claimConfig = new ClaimConfig();
claimConfig.setRoleClaimURI("Role claim uri");
claimConfig.setSpClaimDialects(new String[] { "SP claim dialect" });
ClaimMapping claimMapping = new ClaimMapping();
Claim localClaim = new Claim();
localClaim.setClaimUri("Local claim uri");
Claim remoteClaim = new Claim();
remoteClaim.setClaimUri("Remote claim uri");
claimMapping.setLocalClaim(localClaim);
claimMapping.setRemoteClaim(remoteClaim);
claimConfig.setClaimMappings(new ClaimMapping[] { claimMapping });
serviceProvider.setClaimConfig(claimConfig);
// Permission Role Configurations.
PermissionsAndRoleConfig permissionsAndRoleConfig = new PermissionsAndRoleConfig();
RoleMapping roleMapping = new RoleMapping();
LocalRole localRole = new LocalRole("Local role");
roleMapping.setLocalRole(localRole);
roleMapping.setRemoteRole("Remote role");
RoleMapping[] roleMappings = new RoleMapping[] { roleMapping };
permissionsAndRoleConfig.setRoleMappings(roleMappings);
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundProvisioningConfig in project product-is by wso2.
the class ApplicationManagementTestCase method testUpdateInboundProvisioningData.
@Test(alwaysRun = true, description = "Testing update Inbound Provisioning Data")
public void testUpdateInboundProvisioningData() {
String applicationName = "TestServiceProvider";
try {
ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
String provisioningUserStore = "scim-inbound-userstore";
InboundProvisioningConfig inBoundProConfig = new InboundProvisioningConfig();
inBoundProConfig.setProvisioningUserStore(provisioningUserStore);
serviceProvider.setInboundProvisioningConfig(inBoundProConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
Assert.assertEquals(updatedServiceProvider.getInboundProvisioningConfig().getProvisioningUserStore(), "scim-inbound-userstore", "Failed update provisioning user store");
} catch (Exception e) {
Assert.fail("Error while trying to update inbound provisioning data", e);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundProvisioningConfig 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);
}
Aggregations