use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class AbstractAdaptiveAuthenticationTestCase method createServiceProvider.
protected ServiceProvider createServiceProvider(String appName, ApplicationManagementServiceClient applicationManagementServiceClient, OauthAdminClient oauthAdminClient, String script) throws Exception {
OAuthConsumerAppDTO[] appDtos = oauthAdminClient.getAllOAuthApplicationData();
for (OAuthConsumerAppDTO appDto : appDtos) {
if (appDto.getApplicationName().equals(appName)) {
consumerKey = appDto.getOauthConsumerKey();
consumerSecret = appDto.getOauthConsumerSecret();
}
}
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(appName);
serviceProvider.setDescription("This is a test Service Provider for conditional authentication flow test.");
applicationManagementServiceClient.createApplication(serviceProvider);
serviceProvider = applicationManagementServiceClient.getApplication(appName);
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthKey(consumerKey);
requestConfig.setInboundAuthType("oauth2");
if (StringUtils.isNotBlank(consumerSecret)) {
Property property = new Property();
property.setName("oauthConsumerSecret");
property.setValue(consumerSecret);
Property[] properties = { property };
requestConfig.setProperties(properties);
}
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
LocalAndOutboundAuthenticationConfig outboundAuthConfig = createLocalAndOutboundAuthenticationConfig();
outboundAuthConfig.setEnableAuthorization(false);
AuthenticationScriptConfig config = new AuthenticationScriptConfig();
config.setContent(script);
config.setEnabled(true);
outboundAuthConfig.setAuthenticationScriptConfig(config);
serviceProvider.setLocalAndOutBoundAuthenticationConfig(outboundAuthConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
return serviceProvider;
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class CrossProtocolLogoutTestCase method createServiceProvider.
private ServiceProvider createServiceProvider() throws Exception {
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(OIDC_APP_NAME);
applicationManagementServiceClient.createApplication(serviceProvider);
serviceProvider = applicationManagementServiceClient.getApplication(OIDC_APP_NAME);
serviceProvider.getApplicationID();
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthKey(oidcAppClientId);
requestConfig.setInboundAuthType("oauth2");
if (StringUtils.isNotBlank(oidcAppClientSecret)) {
Property property = new Property();
property.setName("oauthConsumerSecret");
property.setValue(oidcAppClientSecret);
Property[] properties = { property };
requestConfig.setProperties(properties);
}
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
applicationManagementServiceClient.updateApplicationData(serviceProvider);
return serviceProvider;
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class AbstractAnalyticsLoginTestCase 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.getApp().getArtifact());
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 OAuth2ServiceSAML2BearerGrantTestCase method createDefaultSAMLApplication.
/**
* Create and attach the SAML application to a service provider for testing.
*
* @throws Exception
*/
private void createDefaultSAMLApplication() throws Exception {
ServiceProvider serviceProvider = appMgtclient.getApplication(SERVICE_PROVIDER_NAME);
InboundAuthenticationRequestConfig inboundAuthenticationRequestConfig = new InboundAuthenticationRequestConfig();
inboundAuthenticationRequestConfig.setInboundAuthType("samlsso");
inboundAuthenticationRequestConfig.setInboundAuthKey("travelocity.com");
InboundAuthenticationRequestConfig[] inboundAuthenticationRequestConfigs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
List<InboundAuthenticationRequestConfig> inboundAuthenticationRequestConfigsList = new ArrayList<>(Arrays.asList(inboundAuthenticationRequestConfigs));
inboundAuthenticationRequestConfigsList.add(inboundAuthenticationRequestConfig);
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(inboundAuthenticationRequestConfigsList.toArray(new InboundAuthenticationRequestConfig[0]));
serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
SAMLSSOServiceProviderDTO samlssoServiceProviderDTO = createDefaultSSOServiceProviderDTO();
boolean isCreated = ssoConfigServiceClient.addServiceProvider(samlssoServiceProviderDTO);
if (!isCreated) {
throw new Exception("App creation failed.");
}
appMgtclient.updateApplicationData(serviceProvider);
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project product-is by wso2.
the class RequestPathBasicAuthenticationSSOTest 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(createSAMLServiceProviderDTO(ISSUER_TRAVELOCITY_COM));
ssoConfigServiceClient.addServiceProvider(createSAMLServiceProviderDTO(ISSUER_AVIS_COM));
serviceProviderTravelocity = new ServiceProvider();
serviceProviderTravelocity.setApplicationName(SERVICE_PROVIDER_NAME_TRAVELOCITY);
serviceProviderTravelocity.setDescription(SERVICE_PROVIDER_DESC);
appMgtclient.createApplication(serviceProviderTravelocity);
serviceProviderTravelocity = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_TRAVELOCITY);
InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthKey(ISSUER_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 });
serviceProviderTravelocity.setInboundAuthenticationConfig(inboundAuthenticationConfig);
RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
requestPathAuthenticatorConfig.setName("BasicAuthRequestPathAuthenticator");
serviceProviderTravelocity.setRequestPathAuthenticatorConfigs(new RequestPathAuthenticatorConfig[] { requestPathAuthenticatorConfig });
appMgtclient.updateApplicationData(serviceProviderTravelocity);
serviceProviderTravelocity = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_TRAVELOCITY);
serviceProviderAvis = new ServiceProvider();
serviceProviderAvis.setApplicationName(SERVICE_PROVIDER_NAME_AVIS);
serviceProviderAvis.setDescription(SERVICE_PROVIDER_DESC);
appMgtclient.createApplication(serviceProviderAvis);
serviceProviderAvis = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_AVIS);
inboundAuthenticationConfig = new InboundAuthenticationConfig();
requestConfig = new InboundAuthenticationRequestConfig();
requestConfig.setInboundAuthKey(ISSUER_AVIS_COM);
requestConfig.setInboundAuthType("samlsso");
attributeConsumerServiceIndexProp = new Property();
attributeConsumerServiceIndexProp.setName("attrConsumServiceIndex");
attributeConsumerServiceIndexProp.setValue("1239245949");
requestConfig.setProperties(new Property[] { attributeConsumerServiceIndexProp });
inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
serviceProviderAvis.setInboundAuthenticationConfig(inboundAuthenticationConfig);
appMgtclient.updateApplicationData(serviceProviderAvis);
serviceProviderAvis = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_AVIS);
}
Aggregations