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

Update OAuthAppsWithSameClientIdTestCase #22193

Merged
merged 1 commit into from
Jan 16, 2025
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 @@ -48,7 +48,6 @@
import org.wso2.carbon.automation.engine.context.beans.Tenant;
import org.wso2.carbon.automation.engine.context.beans.User;
import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException;
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationListItem;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationListResponse;
import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationModel;
Expand All @@ -68,7 +67,6 @@
import org.wso2.identity.integration.test.utils.DataExtractUtil;
import org.wso2.identity.integration.test.utils.OAuth2Constant;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
Expand Down Expand Up @@ -100,7 +98,6 @@ public class OAuthAppsWithSameClientIdTestCase extends OAuth2ServiceAbstractInte
private static final String TENANT_2_USER_EMAIL = "[email protected]";
public final static String TENANT_1_AUTHORIZE_URL = "https://localhost:9853/t/tenant1.com/oauth2/authorize";

private ServerConfigurationManager serverConfigurationManager;
private TenantMgtRestClient tenantMgtRestClient;
private OAuth2RestClient oAuth2RestClientTenant1;
private OAuth2RestClient oAuth2RestClientTenant2;
Expand All @@ -119,10 +116,6 @@ public class OAuthAppsWithSameClientIdTestCase extends OAuth2ServiceAbstractInte
private void testInit() throws Exception {

super.init();
serverConfigurationManager = new ServerConfigurationManager(isServer);
// We have to restart the server, since the configs were restored from the previous test,
// but has not restarted the server after that.
serverConfigurationManager.restartGracefully();
tenantMgtRestClient = new TenantMgtRestClient(serverURL, tenantInfo);

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

serverConfigurationManager.restoreToLastConfiguration(false);
tenantMgtRestClient.closeHttpClient();
oAuth2RestClientTenant1.closeHttpClient();
oAuth2RestClientTenant2.closeHttpClient();
Expand Down Expand Up @@ -397,37 +389,6 @@ public void testOAuthApplicationLoginIncorrectTenant() throws Exception {
Assert.fail("Expected exception not received.");
}

// @Test(description = "Create an OAuth app in tenant 1 and try to login when tenant qualified urls are disabled.",
// dependsOnMethods = "testOAuthApplicationLoginIncorrectTenant")
// public void testOAuthApplicationLoginWhenTenantQualifiedUrlsDisabled() throws Exception {
//
// // Disable tenant qualified urls/ tenanted sessions and restart the server.
// changeISConfigurations();
//
// // Create oauth app and add user.
// ApplicationResponseModel tenant1App = createApplication(TENANT_1_DOMAIN);
// Assert.assertNotNull(tenant1App, "OAuth app creation failed for tenant 1.");
// tenant1UserId = createUser(TENANT_1_DOMAIN);
//
// // Authenticate.
// initiateAuthorizationRequest(false);
// authenticateUser(false, TENANT_1_USER_USERNAME + "@" + TENANT_1_DOMAIN, TENANT_1_USER_PASSWORD,
// TENANT_1_DOMAIN);
// performConsentApproval(false, TENANT_1_DOMAIN);
// generateAuthzCodeAccessToken(false, TENANT_1_DOMAIN);
// introspectActiveAccessToken(TENANT_1_DOMAIN, TENANT_1_ADMIN_USERNAME, TENANT_1_ADMIN_PASSWORD);
// }
//
// private void changeISConfigurations() throws AutomationUtilException, IOException {
//
// String carbonHome = Utils.getResidentCarbonHome();
// File defaultTomlFile = getDeploymentTomlFile(carbonHome);
// File modifiedConfigFile = new File(getISResourceLocation()
// + File.separator + "tenant.qualified" + File.separator
// + "tenant_qualified_url_tenanted_sessions_disabled.toml");
// serverConfigurationManager.applyConfiguration(modifiedConfigFile, defaultTomlFile, true, true);
// }

private void addTenant(String tenantDomain, String adminUsername, String adminPassword,
String adminTenantAwareUsername) throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<class name="org.wso2.identity.integration.test.recovery.PasswordRecoveryTestCase"/>
<class name="org.wso2.identity.integration.test.oidc.OIDCIdentityFederationTestCase"/>
<class name="org.wso2.identity.integration.test.auth.PasswordlessSMSOTPAuthTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuthAppsWithSameClientIdTestCase"/>
</classes>
</test>

Expand Down Expand Up @@ -425,7 +426,6 @@
<class name="org.wso2.identity.integration.test.rest.api.user.liteUserRegister.LiteUserRegisterTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuth2TokenScopeValidatorTestCase" />
<class name="org.wso2.identity.integration.test.saml.SAMLSSOForAdminLoginTestCase"/>
<class name="org.wso2.identity.integration.test.oauth2.OAuthAppsWithSameClientIdTestCase"/>
<class name="org.wso2.identity.integration.test.organizationDiscovery.OrganizationDiscoveryTestCase"/>
</classes>
</test>
Expand Down