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