Skip to content

Conversation

@SujanSanjula96
Copy link
Contributor

Proposed changes in this pull request

This PR adds the support to build tenant perspective org urls.

Copilot AI review requested due to automatic review settings October 20, 2025 05:44
Comment on lines +161 to +162
String accessingOrganization =
PrivilegedCarbonContext.getThreadLocalCarbonContext().getApplicationResidentOrganizationId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 1

Suggested change
String accessingOrganization =
PrivilegedCarbonContext.getThreadLocalCarbonContext().getApplicationResidentOrganizationId();
String accessingOrganization =
PrivilegedCarbonContext.getThreadLocalCarbonContext().getApplicationResidentOrganizationId();
if (log.isDebugEnabled()) {
log.debug("Accessing organization ID: " + (StringUtils.isNotBlank(accessingOrganization) ? accessingOrganization : "None"));
}

Comment on lines +548 to +550
} else if (StringUtils.isNotBlank(accessingOrganization)) {
resolvedUrlStringBuilder.append("/t/").append(tenantDomain).append("/o/").append(accessingOrganization);
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 2

Suggested change
} else if (StringUtils.isNotBlank(accessingOrganization)) {
resolvedUrlStringBuilder.append("/t/").append(tenantDomain).append("/o/").append(accessingOrganization);
return;
} else if (StringUtils.isNotBlank(accessingOrganization)) {
resolvedUrlStringBuilder.append("/t/").append(tenantDomain).append("/o/").append(accessingOrganization);
if (log.isDebugEnabled()) {
log.debug("Building tenant and organization qualified URL for tenant: " + tenantDomain + " and organization: " + accessingOrganization);
}
return;

Copy link
Contributor

@wso2-engineering wso2-engineering bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Agent Log Improvement Checklist

⚠️ Warning: AI-Generated Review Comments

  • The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
  • Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.

✅ Before merging this pull request:

  • Review all AI-generated comments for accuracy and relevance.
  • Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
Comment Accepted (Y/N) Reason
#### Log Improvement Suggestion No: 1
#### Log Improvement Suggestion No: 2

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the service URL builder to support tenant perspective organization URLs by incorporating the accessing organization ID from the thread local context when constructing URLs.

Key Changes

  • Added logic to retrieve the accessing organization ID from PrivilegedCarbonContext
  • Updated URL construction to include organization qualifier when an accessing organization is present
  • Modified the setURL method signature to accept the accessing organization parameter

}

private void setURL(StringBuilder resolvedUrlStringBuilder, String tenantDomain) {
private void setURL(StringBuilder resolvedUrlStringBuilder, String tenantDomain, String accessingOrganization) {
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method signature has been updated to include a new parameter 'accessingOrganization', but the method lacks a docstring explaining the purpose and usage of this parameter. Add a JavaDoc comment documenting all parameters, especially the newly added 'accessingOrganization' parameter.

Copilot generated this review using guidance from repository custom instructions.
@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.87%. Comparing base (b6259f1) to head (1dcbf72).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
...carbon/identity/core/DefaultServiceURLBuilder.java 28.57% 2 Missing and 3 partials ⚠️

❌ Your patch check has failed because the patch coverage (28.57%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7565      +/-   ##
============================================
+ Coverage     50.85%   50.87%   +0.02%     
+ Complexity    19001    18999       -2     
============================================
  Files          2099     2099              
  Lines        121819   121952     +133     
  Branches      25296    25351      +55     
============================================
+ Hits          61952    62047      +95     
- Misses        51867    51894      +27     
- Partials       8000     8011      +11     
Flag Coverage Δ
unit 35.23% <28.57%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SujanSanjula96 SujanSanjula96 marked this pull request as draft October 20, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant