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

shared application api key revocation test case #13303

Merged
merged 3 commits into from
Dec 13, 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 @@ -30,6 +30,8 @@
import org.wso2.am.integration.clients.store.api.ApiException;
import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationDTO;
import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationInfoDTO;
import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationKeyGenerateRequestDTO;
import org.wso2.am.integration.clients.store.api.v1.dto.APIKeyDTO;
import org.wso2.am.integration.test.impl.RestAPIStoreImpl;
import org.wso2.am.integration.test.utils.UserManagementUtils;
import org.wso2.am.integration.test.utils.base.APIMIntegrationBaseTest;
Expand Down Expand Up @@ -79,8 +81,8 @@ public static Object[][] userModeDataProvider() {
public void setEnvironment() throws Exception {

super.init(userMode);
createUsersAndApplications();
groups.add(ORGANIZATION);
createUsersAndApplications();
}

@Test(groups = "wso2.am", description = "Remove user one's application and check if user two's application also " +
Expand Down Expand Up @@ -125,6 +127,23 @@ public void testEditApplicationByUserInApplicationGroup() throws ApiException {
Assert.assertEquals(serviceResponse.getResponseCode(), HttpStatus.SC_FORBIDDEN);
}

@Test(groups = "wso2.am", description = "Generate API key from user 1 and make sure that user 2 can revoke the key")
public void testAPIKeyRevocationBySharedUser()
throws ApiException {

//Check for application availability
List<ApplicationInfoDTO> user1AllAppsList = restAPIStoreClientUser1.getAllApps().getList();
ApplicationDTO applicationDTO = restAPIStoreClientUser1.getApplicationById(userOneSharedApplicationId);
Assert.assertNotNull(applicationDTO);
Assert.assertEquals(applicationDTO.getName(), SHARED_APPLICATION_NAME);

//Generate api key by user 1
APIKeyDTO key = restAPIStoreClientUser1.generateAPIKeys(userOneSharedApplicationId,
ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION.toString(), -1, null, null);
//Revoke api key by user 2
restAPIStoreClientUser2.revokeAPIKey(userOneSharedApplicationId, key.getApikey());
}

@AfterClass(alwaysRun = true)
public void destroy() throws Exception {
restAPIStoreClientUser2.removeApplicationById(userTwoApplicationId);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@
<carbon.apimgt.ui.version>9.0.476</carbon.apimgt.ui.version>

<!-- APIM Component Version -->
<carbon.apimgt.version>9.28.190</carbon.apimgt.version>
<carbon.apimgt.version>9.28.195</carbon.apimgt.version>

<carbon.apimgt.imp.pkg.version>[9.0.0, 10.0.0)</carbon.apimgt.imp.pkg.version>

Expand Down
Loading