Skip to content

Commit

Permalink
Use new method to revoke tokens.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpmadhavig committed Sep 22, 2023
1 parent a966ff2 commit 0e2473c
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,19 +318,23 @@ private void revokeAccessTokensOfSharedApp(String rootOrganizationId, String roo
throw handleServerException(ERROR_CODE_ERROR_RESOLVING_TENANT_DOMAIN_FROM_ORGANIZATION_DOMAIN, null,
rootOrganizationId);
}
ServiceProvider rootApplication = getOrgApplication(rootApplicationId, rootTenantDomain);
ServiceProvider sharedApplication = resolveSharedApplicationByMainAppUUID(
rootApplication.getApplicationResourceId(), rootOrganizationId, sharedOrganizationId);

if (sharedApplication.getInboundAuthenticationConfig()
String sharedAppTenantDomain = getOrganizationManager().resolveTenantDomain(sharedOrganizationId);
if (StringUtils.isBlank(sharedAppTenantDomain)) {
throw handleServerException(ERROR_CODE_ERROR_RESOLVING_TENANT_DOMAIN_FROM_ORGANIZATION_DOMAIN, null,
sharedOrganizationId);
}

ServiceProvider rootApplication = getOrgApplication(rootApplicationId, rootTenantDomain);
if (rootApplication.getInboundAuthenticationConfig()
.getInboundAuthenticationRequestConfigs().length != 0) {
String consumerKey = sharedApplication.getInboundAuthenticationConfig()
String consumerKey = rootApplication.getInboundAuthenticationConfig()
.getInboundAuthenticationRequestConfigs()[0].getInboundAuthKey();
OAuthAppRevocationRequestDTO application = new OAuthAppRevocationRequestDTO();
application.setConsumerKey(consumerKey);
try {
OrgApplicationMgtDataHolder.getInstance().getOAuthAdminService()
.revokeIssuedTokensByApplication(application);
.revokeIssuedTokensByApplication(application, sharedAppTenantDomain);
} catch (IdentityOAuthAdminException e) {
throw new OrganizationManagementException("Error while revoking issued tokens for application: " +
application.getConsumerKey(), e.getErrorCode());
Expand Down

0 comments on commit 0e2473c

Please sign in to comment.