Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify client ID tenant unification tests to handle new default behavior of tenant qualified URLs #16872

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public class OAuthAppsWithSameClientIdTestCase extends OAuth2ServiceAbstractInte
private SCIM2RestClient scim2RestClientTenant2;
private HttpClient client;

private boolean configurationsRestored = false;
private String tenant1UserId = null;
private String tenant2UserId = null;
private String sessionDataKey;
Expand All @@ -121,10 +120,6 @@ private void testInit() throws Exception {

super.init();
serverConfigurationManager = new ServerConfigurationManager(isServer);

// Enable tenant qualified urls/ tenanted sessions and restart the server.
changeISConfigurations();

tenantMgtRestClient = new TenantMgtRestClient(serverURL, tenantInfo);

// Create the test tenants.
Expand Down Expand Up @@ -159,7 +154,7 @@ private void testInit() throws Exception {
@AfterClass(alwaysRun = true)
public void testClear() throws IOException, AutomationUtilException {

restoreISConfigurations();
serverConfigurationManager.restoreToLastConfiguration(true);
tenantMgtRestClient.closeHttpClient();
oAuth2RestClientTenant1.closeHttpClient();
oAuth2RestClientTenant2.closeHttpClient();
Expand Down Expand Up @@ -388,8 +383,8 @@ public void testOAuthApplicationLoginIncorrectTenant() throws Exception {
dependsOnMethods = "testOAuthApplicationLoginIncorrectTenant")
public void testOAuthApplicationLoginWhenTenantQualifiedUrlsDisabled() throws Exception {

// Restore the server back to the initial state (tenant qualified urls disabled).
restoreISConfigurations();
// Disable tenant qualified urls/ tenanted sessions and restart the server.
changeISConfigurations();

// Create oauth app and add user.
ApplicationResponseModel tenant1App = createApplication(TENANT_1_DOMAIN);
Expand All @@ -411,22 +406,8 @@ private void changeISConfigurations() throws AutomationUtilException, IOExceptio
File defaultTomlFile = getDeploymentTomlFile(carbonHome);
File modifiedConfigFile = new File(getISResourceLocation()
+ File.separator + "tenant.qualified" + File.separator
+ "tenant_qualified_url_tenanted_sessions_enabled.toml");
serverConfigurationManager.applyConfiguration(modifiedConfigFile, defaultTomlFile, true, true);
}

private void restoreISConfigurations() throws AutomationUtilException, IOException {

if (configurationsRestored) {
return;
}
String carbonHome = Utils.getResidentCarbonHome();
File defaultTomlFile = getDeploymentTomlFile(carbonHome);
File modifiedConfigFile = new File(getISResourceLocation()
+ File.separator + "tenant.qualified" + File.separator
+ "tenant_qualified_url_tenanted_sessions_default.toml");
+ "tenant_qualified_url_tenanted_sessions_disabled.toml");
serverConfigurationManager.applyConfiguration(modifiedConfigFile, defaultTomlFile, true, true);
configurationsRestored = true;
}

private void addTenant(String tenantDomain, String adminUsername, String adminPassword,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ hash = "66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262"
app_password = "dashboard"

[tenant_context]
enable_tenant_qualified_urls = true
enable_tenanted_sessions = true
enable_tenant_qualified_urls = false
enable_tenanted_sessions = false