Skip to content

Commit

Permalink
KeyManager Restriction in KeyType call
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirishikesan committed Oct 20, 2023
1 parent 879bd66 commit f8d34ac
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1026,11 +1026,12 @@ public Response applicationsApplicationIdKeysKeyTypePut(String applicationId, St
String username = RestApiCommonUtil.getLoggedInUsername();
try {
APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username);
Application application = apiConsumer.getApplicationByUUID(applicationId);
if (!(apiConsumer.isKeyManagerAllowedForUser(body.getKeyManager(), username))) {
if (!(apiConsumer.isKeyManagerByNameAllowedForUser(body.getKeyManager(),
MultitenantUtils.getTenantDomain(username), username))) {
throw new APIManagementException("Key Manager is permission restricted",
ExceptionCodes.KEY_MANAGER_RESTRICTED_FOR_USER);
}
Application application = apiConsumer.getApplicationByUUID(applicationId);
if (application != null) {
if (RestAPIStoreUtils.isUserOwnerOfApplication(application)) {
String grantTypes = StringUtils.join(body.getSupportedGrantTypes(), ',');
Expand Down

0 comments on commit f8d34ac

Please sign in to comment.