Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sadilchamishka committed Oct 17, 2023
1 parent c71a43a commit 4a89c46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void invoke(Request request, Response response) throws IOException, Servl

String requestURI = request.getRequestURI();
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
// The below check on organization qualified resource access should be removed.
if (!StringUtils.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, tenantDomain) &&
requestURI.startsWith(ORGANIZATION_PATH_PARAM) &&
org.wso2.carbon.identity.organization.management.service.util.Utils.useOrganizationRolesForValidation(
Expand All @@ -93,7 +94,7 @@ public void invoke(Request request, Response response) throws IOException, Servl
*/
Object scopeValidationEnabled = authenticationContext.getParameter(OAUTH2_VALIDATE_SCOPE);
if (scopeValidationEnabled != null && Boolean.parseBoolean(scopeValidationEnabled.toString())) {
if (!Utils.isUserAuthorizedOrganization(authenticationContext, request)) {
if (!Utils.isUserAuthorizedForOrganization(authenticationContext, request)) {
if (log.isDebugEnabled()) {
log.debug("Authorization to " + request.getRequestURI() +
" is denied because the used access token issued from a different tenant domain: " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static boolean isUserBelongsToRequestedTenant(AuthenticationContext authe
return tenantDomainFromURLMapping.equals(tenantDomain);
}

public static boolean isUserAuthorizedOrganization(AuthenticationContext authenticationContext, Request request) {
public static boolean isUserAuthorizedForOrganization(AuthenticationContext authenticationContext, Request request) {

User user = authenticationContext.getUser();
if (user == null) {
Expand Down

0 comments on commit 4a89c46

Please sign in to comment.