use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project identity-inbound-auth-oauth by wso2-extensions.
the class DCRMService method updateServiceProviderWithOAuthAppDetails.
private void updateServiceProviderWithOAuthAppDetails(ServiceProvider serviceProvider, OAuthConsumerAppDTO createdApp, String applicationOwner, String tenantDomain) throws DCRMException {
// Update created service provider, InboundAuthenticationConfig with OAuth application info.
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
List<InboundAuthenticationRequestConfig> inboundAuthenticationRequestConfigs = new ArrayList<>();
InboundAuthenticationRequestConfig inboundAuthenticationRequestConfig = new InboundAuthenticationRequestConfig();
inboundAuthenticationRequestConfig.setInboundAuthKey(createdApp.getOauthConsumerKey());
inboundAuthenticationRequestConfig.setInboundAuthType(AUTH_TYPE_OAUTH_2);
inboundAuthenticationRequestConfigs.add(inboundAuthenticationRequestConfig);
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(inboundAuthenticationRequestConfigs.toArray(new InboundAuthenticationRequestConfig[inboundAuthenticationRequestConfigs.size()]));
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
// Set SaaS app option
serviceProvider.setSaasApp(false);
// Update the Service Provider app to add OAuthApp as an Inbound Authentication Config
updateServiceProvider(serviceProvider, tenantDomain, applicationOwner);
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class SAMLWithRequestPathAuthenticationTest method testInit.
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
super.init();
logManger = new AuthenticatorClient(backendURL);
adminUsername = userInfo.getUserName();
adminPassword = userInfo.getPassword();
logManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
appMgtclient = new ApplicationManagementServiceClient(sessionCookie, backendURL, null);
ssoConfigServiceClient = new SAMLSSOConfigServiceClient(backendURL, sessionCookie);
client = HttpClientBuilder.create().build();
isURL = backendURL.substring(0, backendURL.indexOf("services/"));
ssoConfigServiceClient.addServiceProvider(createSsoServiceProviderDTO());
serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(SERVICE_PROVIDER_NAME);
serviceProvider.setDescription(SERVICE_PROVIDER_Desc);
appMgtclient.createApplication(serviceProvider);
serviceProvider = appMgtclient.getApplication(SERVICE_PROVIDER_NAME);
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthKey("travelocity.com");
requestConfig.setInboundAuthType("samlsso");
Property attributeConsumerServiceIndexProp = new Property();
attributeConsumerServiceIndexProp.setName("attrConsumServiceIndex");
attributeConsumerServiceIndexProp.setValue("1239245949");
requestConfig.setProperties(new Property[] { attributeConsumerServiceIndexProp });
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
requestPathAuthenticatorConfig.setName("BasicAuthRequestPathAuthenticator");
serviceProvider.setRequestPathAuthenticatorConfigs(new RequestPathAuthenticatorConfig[] { requestPathAuthenticatorConfig });
appMgtclient.updateApplicationData(serviceProvider);
serviceProvider = appMgtclient.getApplication(SERVICE_PROVIDER_NAME);
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class SAMLFederationDynamicQueryParametersTestCase method testCreateServiceProviderWithSAMLConfigsAndSAMLFedIdp.
@Test(groups = "wso2.is", description = "Test Service Provider creation with SAML Federated IDP Authentication", dependsOnMethods = { "testIdpWithDynamicQueryParams" })
public void testCreateServiceProviderWithSAMLConfigsAndSAMLFedIdp() throws Exception {
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(SERVICE_PROVIDER);
appMgtclient.createApplication(serviceProvider);
serviceProvider = appMgtclient.getApplication(SERVICE_PROVIDER);
Assert.assertNotNull(serviceProvider, "Service Provider creation has failed.");
// Set SAML Inbound for the service provider.
ssoConfigServiceClient.addServiceProvider(createSsoServiceProviderDTOForTravelocityApp());
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthKey(INBOUND_AUTH_KEY);
requestConfig.setInboundAuthType(INBOUND_AUTH_TYPE);
org.wso2.carbon.identity.application.common.model.xsd.Property attributeConsumerServiceIndexProp = new org.wso2.carbon.identity.application.common.model.xsd.Property();
attributeConsumerServiceIndexProp.setName("attrConsumServiceIndex");
attributeConsumerServiceIndexProp.setValue("1239245949");
requestConfig.setProperties(new org.wso2.carbon.identity.application.common.model.xsd.Property[] { attributeConsumerServiceIndexProp });
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
// Add SAML IDP as authentication step.
AuthenticationStep authStep = new AuthenticationStep();
org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider idP = new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider();
idP.setIdentityProviderName(IDENTITY_PROVIDER_NAME);
org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig saml2SSOAuthnConfig = new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig();
saml2SSOAuthnConfig.setName("SAMLSSOAuthenticator");
saml2SSOAuthnConfig.setDisplayName("samlsso");
idP.setFederatedAuthenticatorConfigs(new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig[] { saml2SSOAuthnConfig });
authStep.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { idP });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationSteps(new AuthenticationStep[] { authStep });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationType(FEDERATED_AUTHENTICATION_TYPE);
appMgtclient.updateApplicationData(serviceProvider);
serviceProvider = appMgtclient.getApplication(SERVICE_PROVIDER);
Assert.assertNotNull(serviceProvider);
Assert.assertNotNull(serviceProvider.getInboundAuthenticationConfig());
InboundAuthenticationRequestConfig[] inboundAuthenticationRequestConfigs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
Assert.assertNotNull(inboundAuthenticationRequestConfigs);
boolean inboundAuthUpdateSuccess = false;
for (InboundAuthenticationRequestConfig config : inboundAuthenticationRequestConfigs) {
if (INBOUND_AUTH_KEY.equals(config.getInboundAuthKey()) && INBOUND_AUTH_TYPE.equals(config.getInboundAuthType())) {
inboundAuthUpdateSuccess = true;
break;
}
}
Assert.assertTrue(inboundAuthUpdateSuccess, "Failed to update service provider with SAML inbound configs.");
Assert.assertNotNull(serviceProvider.getLocalAndOutBoundAuthenticationConfig());
Assert.assertEquals(serviceProvider.getLocalAndOutBoundAuthenticationConfig().getAuthenticationType(), FEDERATED_AUTHENTICATION_TYPE);
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class SAMLInvalidIssuerTestCase method createApplication.
public void createApplication(SAMLConfig config, String appName) throws Exception {
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(appName);
serviceProvider.setDescription("This is a test Service Provider");
applicationManagementServiceClient.createApplication(serviceProvider);
serviceProvider = applicationManagementServiceClient.getApplication(appName);
serviceProvider.getClaimConfig().setClaimMappings(getClaimMappings());
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthType(INBOUND_AUTH_TYPE);
requestConfig.setInboundAuthKey(ISSUER_NAME);
Property attributeConsumerServiceIndexProp = new Property();
attributeConsumerServiceIndexProp.setName(ATTRIBUTE_CS_INDEX_NAME);
attributeConsumerServiceIndexProp.setValue(ATTRIBUTE_CS_INDEX_VALUE);
requestConfig.setProperties(new Property[] { attributeConsumerServiceIndexProp });
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class SAMLLocalAndOutboundAuthenticatorsTestCase method createApplication.
private void createApplication() throws Exception {
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(APPLICATION_NAME);
serviceProvider.setDescription("This is a test Service Provider");
applicationManagementServiceClient.createApplication(serviceProvider);
serviceProvider = applicationManagementServiceClient.getApplication(APPLICATION_NAME);
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthType(INBOUND_AUTH_TYPE);
requestConfig.setInboundAuthKey(config.getApplication().getArtifact());
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
serviceProvider.setLocalAndOutBoundAuthenticationConfig(config.getAuthenticator().getLocalAndOutboundAuthenticationConfig());
applicationManagementServiceClient.updateApplicationData(serviceProvider);
}
Aggregations