use of org.wso2.identity.scenarios.commons.SSOCommonClient in project product-is by wso2.
the class OIDCSSOTestCase method testInit.
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
httpCommonClient = new HTTPCommonClient();
oAuth2CommonClient = new OAuth2CommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
ssoCommonClient = new SSOCommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
// Register OAuth2 application 1.
HttpResponse response = oAuth2CommonClient.createOAuth2Application(dcrRequestFile1, appCreatorUsername, appCreatorPassword);
assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_CREATED, "OAuth2 Application creation failed. Request File: " + dcrRequestFile1);
JSONObject responseJSON = httpCommonClient.getJSONFromResponse(response);
// Validate application creation.
oAuth2CommonClient.validateApplicationCreationResponse(dcrRequestFile1, responseJSON);
clientId1 = responseJSON.get(CLIENT_ID).toString();
clientSecret1 = responseJSON.get(CLIENT_SECRET).toString();
redirectUri1 = ((JSONArray) responseJSON.get(REDIRECT_URIS)).get(0).toString();
httpCommonClient.consume(response);
// Register OAuth2 application 2.
response = oAuth2CommonClient.createOAuth2Application(dcrRequestFile2, appCreatorUsername, appCreatorPassword);
assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_CREATED, "OAuth2 Application creation failed. Request File: " + dcrRequestFile2);
responseJSON = httpCommonClient.getJSONFromResponse(response);
// Validate application creation.
oAuth2CommonClient.validateApplicationCreationResponse(dcrRequestFile2, responseJSON);
clientId2 = responseJSON.get(CLIENT_ID).toString();
clientSecret2 = responseJSON.get(CLIENT_SECRET).toString();
redirectUri2 = ((JSONArray) responseJSON.get(REDIRECT_URIS)).get(0).toString();
httpCommonClient.consume(response);
}
use of org.wso2.identity.scenarios.commons.SSOCommonClient in project product-is by wso2.
the class OAuth2AuthorizationCodeGrantTest method testInit.
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
httpCommonClient = new HTTPCommonClient();
oAuth2CommonClient = new OAuth2CommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
ssoCommonClient = new SSOCommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
// Register OAuth2 application.
HttpResponse response = oAuth2CommonClient.createOAuth2Application(dcrRequestFile, appCreatorUsername, appCreatorPassword);
assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_CREATED, "OAuth2 Application creation failed. Request File: " + dcrRequestFile);
JSONObject responseJSON = httpCommonClient.getJSONFromResponse(response);
// Validate application creation.
oAuth2CommonClient.validateApplicationCreationResponse(dcrRequestFile, responseJSON);
clientId = responseJSON.get(CLIENT_ID).toString();
clientSecret = responseJSON.get(CLIENT_SECRET).toString();
redirectUri = ((JSONArray) responseJSON.get(REDIRECT_URIS)).get(0).toString();
Thread.sleep(5000);
}
use of org.wso2.identity.scenarios.commons.SSOCommonClient in project product-is by wso2.
the class OAuth2SelfContainedTokenImplicitGrantTest method testInit.
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
super.init();
loginAndObtainSessionCookie();
httpCommonClient = new HTTPCommonClient();
oAuth2CommonClient = new OAuth2CommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
ssoCommonClient = new SSOCommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain, sessionCookie, backendServiceURL, configContext);
oauthAdminClient = new OauthAdminClient(backendServiceURL, sessionCookie);
spName = ssoCommonClient.createServiceProvider(spConfigFile);
assertNotNull(spName, "Failed to create service provider from file: " + spConfigFile);
serviceProvider = ssoCommonClient.getServiceProvider(spName);
Assert.assertNotNull(serviceProvider, "Failed to load service provider : " + spName);
OAuthConsumerAppDTO oauthApp = oAuth2CommonClient.getOAuthConsumerApp(serviceProvider, oauthAdminClient);
clientId = oauthApp.getOauthConsumerKey();
redirectUri = oauthApp.getCallbackUrl();
Thread.sleep(5000);
}
use of org.wso2.identity.scenarios.commons.SSOCommonClient in project product-is by wso2.
the class OAuth2SelfContainedTokenPasswordGrantTest method testInit.
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
super.init();
loginAndObtainSessionCookie();
httpCommonClient = new HTTPCommonClient();
oAuth2CommonClient = new OAuth2CommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
ssoCommonClient = new SSOCommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain, sessionCookie, backendServiceURL, configContext);
oauthAdminClient = new OauthAdminClient(backendServiceURL, sessionCookie);
spName = ssoCommonClient.createServiceProvider(spConfigFile);
assertNotNull(spName, "Failed to create service provider from file: " + spConfigFile);
serviceProvider = ssoCommonClient.getServiceProvider(spName);
Assert.assertNotNull(serviceProvider, "Failed to load service provider : " + spName);
OAuthConsumerAppDTO oauthApp = oAuth2CommonClient.getOAuthConsumerApp(serviceProvider, oauthAdminClient);
clientId = oauthApp.getOauthConsumerKey();
clientSecret = oauthApp.getOauthConsumerSecret();
Thread.sleep(5000);
}
use of org.wso2.identity.scenarios.commons.SSOCommonClient in project product-is by wso2.
the class OAuth2AuthorizationCodeGrantWithPKCES256Test method testInit.
@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
httpCommonClient = new HTTPCommonClient();
oAuth2CommonClient = new OAuth2CommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
ssoCommonClient = new SSOCommonClient(httpCommonClient, getDeploymentProperty(IS_HTTPS_URL), tenantDomain);
// Register OAuth2 application.
HttpResponse response = oAuth2CommonClient.createOAuth2Application(dcrRequestFile, appCreatorUsername, appCreatorPassword);
assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_CREATED, "OAuth2 Application creation failed. Request File: " + dcrRequestFile);
JSONObject responseJSON = httpCommonClient.getJSONFromResponse(response);
// Validate application creation.
oAuth2CommonClient.validateApplicationCreationResponse(dcrRequestFile, responseJSON);
clientId = responseJSON.get(CLIENT_ID).toString();
clientSecret = responseJSON.get(CLIENT_SECRET).toString();
redirectUri = ((JSONArray) responseJSON.get(REDIRECT_URIS)).get(0).toString();
Thread.sleep(5000);
}
Aggregations