Search in sources :

Example 1 with SAMLSSOConfigServiceClient

use of org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient in project product-is by wso2.

the class ApplicationAuthzTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_ADMIN);
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
    applicationManagementServiceClient = new ApplicationManagementServiceClient(sessionCookie, backendURL, configContext);
    ssoConfigServiceClient = new SAMLSSOConfigServiceClient(backendURL, sessionCookie);
    remoteUSMServiceClient = new RemoteUserStoreManagerServiceClient(backendURL, sessionCookie);
    entitlementPolicyClient = new EntitlementPolicyServiceClient(backendURL, sessionCookie);
    httpClientAzUser = HttpClientBuilder.create().setDefaultCookieStore(new BasicCookieStore()).build();
    httpClientNonAzUser = HttpClientBuilder.create().setDefaultCookieStore(new BasicCookieStore()).build();
    createRole(AZ_TEST_ROLE);
    createUser(AZ_TEST_USER, AZ_TEST_USER_PW, new String[] { AZ_TEST_ROLE });
    userId = UserUtil.getUserId(MultitenantUtils.getTenantAwareUsername(AZ_TEST_USER), isServer.getContextTenant());
    createUser(NON_AZ_TEST_USER, NON_AZ_TEST_USER_PW, new String[0]);
    createApplication(APPLICATION_NAME);
    createSAMLApp(APPLICATION_NAME, true, true, true);
    setupXACMLPolicy(POLICY_ID, POLICY);
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) BasicCookieStore(org.apache.http.impl.client.BasicCookieStore) ApplicationManagementServiceClient(org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient) SAMLSSOConfigServiceClient(org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient) RemoteUserStoreManagerServiceClient(org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient) EntitlementPolicyServiceClient(org.wso2.identity.integration.common.clients.entitlement.EntitlementPolicyServiceClient) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with SAMLSSOConfigServiceClient

use of org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient in project product-is by wso2.

the class AbstractIdentityFederationTestCase method createServiceClients.

public void createServiceClients(int portOffset, String sessionCookie, IdentityConstants.ServiceClientType[] adminClients) throws Exception {
    if (adminClients == null) {
        return;
    }
    String serviceUrl = getSecureServiceUrl(portOffset, automationContextMap.get(portOffset).getContextUrls().getSecureServiceUrl());
    if (sessionCookie == null) {
        AuthenticatorClient authenticatorClient = new AuthenticatorClient(serviceUrl);
        sessionCookie = authenticatorClient.login(automationContextMap.get(portOffset).getSuperTenant().getTenantAdmin().getUserName(), automationContextMap.get(portOffset).getSuperTenant().getTenantAdmin().getPassword(), automationContextMap.get(portOffset).getDefaultInstance().getHosts().get("default"));
    }
    if (sessionCookie != null) {
        ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
        for (IdentityConstants.ServiceClientType clientType : adminClients) {
            if (IdentityConstants.ServiceClientType.APPLICATION_MANAGEMENT.equals(clientType)) {
                applicationManagementServiceClients.put(portOffset, new ApplicationManagementServiceClient(sessionCookie, serviceUrl, configContext));
            } else if (IdentityConstants.ServiceClientType.IDENTITY_PROVIDER_MGT.equals(clientType)) {
                identityProviderMgtServiceClients.put(portOffset, new IdentityProviderMgtServiceClient(sessionCookie, serviceUrl));
            } else if (IdentityConstants.ServiceClientType.SAML_SSO_CONFIG.equals(clientType)) {
                samlSSOConfigServiceClients.put(portOffset, new SAMLSSOConfigServiceClient(serviceUrl, sessionCookie));
            } else if (IdentityConstants.ServiceClientType.OAUTH_ADMIN.equals(clientType)) {
                oauthAdminClients.put(portOffset, new OauthAdminClient(serviceUrl, sessionCookie));
            }
        }
    }
}
Also used : OauthAdminClient(org.wso2.identity.integration.common.clients.oauth.OauthAdminClient) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) IdentityConstants(org.wso2.identity.integration.test.utils.IdentityConstants) AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) ApplicationManagementServiceClient(org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient) SAMLSSOConfigServiceClient(org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient) IdentityProviderMgtServiceClient(org.wso2.identity.integration.common.clients.Idp.IdentityProviderMgtServiceClient)

Example 3 with SAMLSSOConfigServiceClient

use of org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient in project product-is by wso2.

the class CrossProtocolLogoutTestCase method init.

protected void init() throws Exception {
    super.init();
    adminClient = new OauthAdminClient(backendURL, sessionCookie);
    ssoConfigServiceClient = new SAMLSSOConfigServiceClient(backendURL, sessionCookie);
    applicationManagementServiceClient = new ApplicationManagementServiceClient(sessionCookie, backendURL, null);
}
Also used : OauthAdminClient(org.wso2.identity.integration.common.clients.oauth.OauthAdminClient) SAMLSSOConfigServiceClient(org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient) ApplicationManagementServiceClient(org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient)

Example 4 with SAMLSSOConfigServiceClient

use of org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient in project product-is by wso2.

the class OAuth2ServiceSAML2BearerGrantTestCase method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init(TestUserMode.SUPER_TENANT_USER);
    ssoConfigServiceClient = new SAMLSSOConfigServiceClient(backendURL, sessionCookie);
    OAuthConsumerAppDTO oauthApp = createDefaultOAuthApplication();
    createDefaultSAMLApplication();
    consumerKey = oauthApp.getOauthConsumerKey();
    consumerSecret = oauthApp.getOauthConsumerSecret();
    client = HttpClientBuilder.create().build();
    log.info(String.format("Oauth app initialized with key: %s, secret: %s.", consumerKey, consumerSecret));
}
Also used : SAMLSSOConfigServiceClient(org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient) OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO) BeforeClass(org.testng.annotations.BeforeClass)

Example 5 with SAMLSSOConfigServiceClient

use of org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient 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);
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) InboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ApplicationManagementServiceClient(org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient) SAMLSSOConfigServiceClient(org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) RequestPathAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig) Property(org.wso2.carbon.identity.application.common.model.xsd.Property) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

SAMLSSOConfigServiceClient (org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient)20 ApplicationManagementServiceClient (org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient)17 BeforeClass (org.testng.annotations.BeforeClass)15 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)11 RemoteUserStoreManagerServiceClient (org.wso2.identity.integration.common.clients.usermgt.remote.RemoteUserStoreManagerServiceClient)7 AuthenticatorClient (org.wso2.carbon.integration.common.admin.client.AuthenticatorClient)6 BasicCookieStore (org.apache.http.impl.client.BasicCookieStore)5 IdentityProviderMgtServiceClient (org.wso2.identity.integration.common.clients.Idp.IdentityProviderMgtServiceClient)5 InboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig)2 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig)2 Property (org.wso2.carbon.identity.application.common.model.xsd.Property)2 RequestPathAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig)2 ServiceProvider (org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider)2 ServerConfigurationManager (org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager)2 TenantManagementServiceClient (org.wso2.identity.integration.common.clients.TenantManagementServiceClient)2 EntitlementPolicyServiceClient (org.wso2.identity.integration.common.clients.entitlement.EntitlementPolicyServiceClient)2 OauthAdminClient (org.wso2.identity.integration.common.clients.oauth.OauthAdminClient)2 File (java.io.File)1 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)1 AutomationContext (org.wso2.carbon.automation.engine.context.AutomationContext)1