Skip to content

[Feature] Support IDP sharing and IDP retrieval via REST API - #1149

Open
ashanthamara wants to merge 10 commits into
wso2:masterfrom
ashanthamara:feature/idp-share
Open

[Feature] Support IDP sharing and IDP retrieval via REST API#1149
ashanthamara wants to merge 10 commits into
wso2:masterfrom
ashanthamara:feature/idp-share

Conversation

@ashanthamara

Copy link
Copy Markdown
Contributor

Purpose

$subject

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary

  • Added REST APIs to share and unshare identity providers with selected or all organizations.
  • Added an endpoint to retrieve organizations that share a specific identity provider, with pagination, filtering, and attribute controls.
  • Added sharing request and response models, asynchronous operation responses, validation, and error handling.
  • Updated identity provider and authenticator retrieval to resolve shared connections and expose the read-only isShared property.
  • Added organization connection-sharing dependencies, service integration, constants, and error definitions.
  • Updated OpenAPI definitions and organization management dependency versions.

Walkthrough

This change adds identity provider sharing and unsharing APIs, shared-organization retrieval with cursor pagination, and asynchronous success and error responses. Identity provider and authenticator retrieval now resolve shared connections and expose a read-only isShared property. New service wiring connects the API implementation to the connection-sharing handler. Maven dependencies, constants, error codes, OpenAPI schemas, and endpoint definitions are updated accordingly.

Suggested reviewers: udeshathukorala, rovinkyk

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only an incomplete Purpose section and omits the required goals, approach, testing, security, release, documentation, and other sections. Complete the required pull request template, including purpose, goals, approach, tests, security checks, release note, documentation, and migration details where applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: REST API support for IDP sharing and retrieval.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java (1)

400-416: 📐 Maintainability & Code Quality | 🔵 Trivial

Consider unit tests for the policy-validation branching.

getPolicyEnum and the "share with all" policy restriction (ALL_EXISTING_ORGS_ONLY/ALL_EXISTING_AND_FUTURE_ORGS only) are new business rules without accompanying tests in the provided scope. Test coverage would help lock in this validation behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java`
around lines 400 - 416, Add unit tests covering getPolicyEnum for null, each
supported PolicyEnum value, and unsupported policies producing the expected
bad-request error; also test the share-with-all restriction to ensure only
ALL_EXISTING_ORGS_ONLY and ALL_EXISTING_AND_FUTURE_ORGS are accepted while other
policies are rejected.
components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpManagementService.java (1)

2439-2460: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

resolveIsSharedConnection is duplicated verbatim across two service classes. Both ServerIdpManagementService and ServerAuthenticatorManagementService add the identical 11-line helper that scans IdentityProviderProperty[] for IdPManagementConstants.IS_SHARED_IDP_PROPERTY. Extracting this into a shared utility (e.g., a static helper in org.wso2.carbon.identity.api.server.idp.common, if that module is already a shared dependency of both API modules, or otherwise a small shared utility) would avoid keeping two copies in sync.

  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpManagementService.java#L2439-L2460: keep as the canonical implementation, or delegate to a new shared utility method.
  • components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/src/main/java/org/wso2/carbon/identity/api/server/authenticators/v1/core/ServerAuthenticatorManagementService.java#L539-L560: remove this copy and call the shared utility instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpManagementService.java`
around lines 2439 - 2460, The resolveIsSharedConnection helper is duplicated
across both service classes. In ServerIdpManagementService.java lines 2439-2460,
retain the implementation or delegate it to a shared utility; in
ServerAuthenticatorManagementService.java lines 539-560, remove the duplicate
method and call that shared utility instead, preserving the existing property
lookup and null behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java`:
- Around line 353-379: Update buildPaginationQueryParams to track whether a
query parameter has already been appended, so the first present parameter
follows “?” and subsequent parameters use “&”. Ensure links with limit == 0 and
any other parameter no longer begin with “?&”, while preserving the existing
parameter values and encoding behavior.

In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/resources/idp.yaml`:
- Around line 3846-3857: Update the SharingMode.policy description in the
idp.yaml schema to include ALL_EXISTING_ORGS_ONLY in the documented possible
values, while preserving the existing policy entries.
- Around line 3926-3941: Update the policy description in
IdentityProviderShareAllRequestBody to document only ALL_EXISTING_ORGS_ONLY and
ALL_EXISTING_AND_FUTURE_ORGS, matching the values accepted by
ServerIdpSharingService#shareIdentityProviderWithAll; remove the SELECTED_ORG_*
entries.

---

Nitpick comments:
In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpManagementService.java`:
- Around line 2439-2460: The resolveIsSharedConnection helper is duplicated
across both service classes. In ServerIdpManagementService.java lines 2439-2460,
retain the implementation or delegate it to a shared utility; in
ServerAuthenticatorManagementService.java lines 539-560, remove the duplicate
method and call that shared utility instead, preserving the existing property
lookup and null behavior.

In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java`:
- Around line 400-416: Add unit tests covering getPolicyEnum for null, each
supported PolicyEnum value, and unsupported policies producing the expected
bad-request error; also test the share-with-all restriction to ensure only
ALL_EXISTING_ORGS_ONLY and ALL_EXISTING_AND_FUTURE_ORGS are accepted while other
policies are rejected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e2441f7-e5e6-427b-961f-e8ac174d4c2c

📥 Commits

Reviewing files that changed from the base of the PR and between 9e144a5 and 8bb2c78.

⛔ Files ignored due to path filters (13)
  • components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/src/gen/java/org/wso2/carbon/identity/api/server/authenticators/v1/model/Authenticator.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/IdentityProvidersApi.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/IdentityProvidersApiService.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/BasicOrganizationResponse.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/IdentityProviderResponse.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/IdentityProviderShareAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/IdentityProviderShareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/IdentityProviderUnshareAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/IdentityProviderUnshareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/OrgShareConfig.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/ProcessSuccessResponse.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/SharedOrganizationsResponse.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/SharingMode.java is excluded by !**/gen/**
📒 Files selected for processing (12)
  • components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/src/main/java/org/wso2/carbon/identity/api/server/authenticators/v1/core/ServerAuthenticatorManagementService.java
  • components/org.wso2.carbon.identity.api.server.authenticators/org.wso2.carbon.identity.api.server.authenticators.v1/src/main/resources/authenticators.yaml
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.common/pom.xml
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.common/src/main/java/org/wso2/carbon/identity/api/server/idp/common/Constants.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.common/src/main/java/org/wso2/carbon/identity/api/server/idp/common/IdentityProviderServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/pom.xml
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpManagementService.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/factories/ServerIdpSharingServiceFactory.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/impl/IdentityProvidersApiServiceImpl.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/resources/idp.yaml
  • pom.xml

Comment on lines +353 to +379
private String buildPaginationQueryParams(String filter, int limit, Boolean recursive, String excludedAttributes,
String attributes) {

StringBuilder urlStringBuilder = new StringBuilder("?");
if (limit != 0) {
urlStringBuilder.append(LIMIT_PARAM).append("=").append(limit);
}
if (recursive != null) {
urlStringBuilder.append("&").append(RECURSIVE_PARAM).append("=").append(recursive);
}
if (StringUtils.isNotBlank(filter)) {
try {
urlStringBuilder.append("&").append(FILTER_PARAM).append("=")
.append(URLEncoder.encode(filter, StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
throw handleException(Response.Status.INTERNAL_SERVER_ERROR,
Constants.ErrorMessage.ERROR_CODE_BUILDING_LINKS, e.getMessage());
}
}
if (StringUtils.isNotBlank(excludedAttributes)) {
urlStringBuilder.append("&").append(EXCLUDED_ATTRIBUTES_PARAM).append("=").append(excludedAttributes);
}
if (StringUtils.isNotBlank(attributes)) {
urlStringBuilder.append("&").append(INCLUDED_ATTRIBUTES_PARAM).append("=").append(attributes);
}
return urlStringBuilder.toString();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Pagination query string can start with a malformed ?& when limit is omitted.

Only the limit branch appends without a leading &. If limit == 0 (the default when the caller doesn't pass one) but recursive, filter, excludedAttributes, or attributes is present, the built string starts with "?&", producing an empty leading query parameter in the generated next/previous links.

🔧 Suggested fix
     private String buildPaginationQueryParams(String filter, int limit, Boolean recursive, String excludedAttributes,
                                               String attributes) {

-        StringBuilder urlStringBuilder = new StringBuilder("?");
-        if (limit != 0) {
-            urlStringBuilder.append(LIMIT_PARAM).append("=").append(limit);
-        }
-        if (recursive != null) {
-            urlStringBuilder.append("&").append(RECURSIVE_PARAM).append("=").append(recursive);
-        }
-        if (StringUtils.isNotBlank(filter)) {
+        StringBuilder urlStringBuilder = new StringBuilder("?");
+        List<String> params = new ArrayList<>();
+        if (limit != 0) {
+            params.add(LIMIT_PARAM + "=" + limit);
+        }
+        if (recursive != null) {
+            params.add(RECURSIVE_PARAM + "=" + recursive);
+        }
+        if (StringUtils.isNotBlank(filter)) {
             try {
-                urlStringBuilder.append("&").append(FILTER_PARAM).append("=")
-                        .append(URLEncoder.encode(filter, StandardCharsets.UTF_8.name()));
+                params.add(FILTER_PARAM + "=" + URLEncoder.encode(filter, StandardCharsets.UTF_8.name()));
             } catch (UnsupportedEncodingException e) {
                 throw handleException(Response.Status.INTERNAL_SERVER_ERROR,
                         Constants.ErrorMessage.ERROR_CODE_BUILDING_LINKS, e.getMessage());
             }
         }
-        if (StringUtils.isNotBlank(excludedAttributes)) {
-            urlStringBuilder.append("&").append(EXCLUDED_ATTRIBUTES_PARAM).append("=").append(excludedAttributes);
-        }
-        if (StringUtils.isNotBlank(attributes)) {
-            urlStringBuilder.append("&").append(INCLUDED_ATTRIBUTES_PARAM).append("=").append(attributes);
-        }
-        return urlStringBuilder.toString();
+        if (StringUtils.isNotBlank(excludedAttributes)) {
+            params.add(EXCLUDED_ATTRIBUTES_PARAM + "=" + excludedAttributes);
+        }
+        if (StringUtils.isNotBlank(attributes)) {
+            params.add(INCLUDED_ATTRIBUTES_PARAM + "=" + attributes);
+        }
+        return urlStringBuilder.append(String.join("&", params)).toString();
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private String buildPaginationQueryParams(String filter, int limit, Boolean recursive, String excludedAttributes,
String attributes) {
StringBuilder urlStringBuilder = new StringBuilder("?");
if (limit != 0) {
urlStringBuilder.append(LIMIT_PARAM).append("=").append(limit);
}
if (recursive != null) {
urlStringBuilder.append("&").append(RECURSIVE_PARAM).append("=").append(recursive);
}
if (StringUtils.isNotBlank(filter)) {
try {
urlStringBuilder.append("&").append(FILTER_PARAM).append("=")
.append(URLEncoder.encode(filter, StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
throw handleException(Response.Status.INTERNAL_SERVER_ERROR,
Constants.ErrorMessage.ERROR_CODE_BUILDING_LINKS, e.getMessage());
}
}
if (StringUtils.isNotBlank(excludedAttributes)) {
urlStringBuilder.append("&").append(EXCLUDED_ATTRIBUTES_PARAM).append("=").append(excludedAttributes);
}
if (StringUtils.isNotBlank(attributes)) {
urlStringBuilder.append("&").append(INCLUDED_ATTRIBUTES_PARAM).append("=").append(attributes);
}
return urlStringBuilder.toString();
}
private String buildPaginationQueryParams(String filter, int limit, Boolean recursive, String excludedAttributes,
String attributes) {
StringBuilder urlStringBuilder = new StringBuilder("?");
List<String> params = new ArrayList<>();
if (limit != 0) {
params.add(LIMIT_PARAM + "=" + limit);
}
if (recursive != null) {
params.add(RECURSIVE_PARAM + "=" + recursive);
}
if (StringUtils.isNotBlank(filter)) {
try {
params.add(FILTER_PARAM + "=" + URLEncoder.encode(filter, StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
throw handleException(Response.Status.INTERNAL_SERVER_ERROR,
Constants.ErrorMessage.ERROR_CODE_BUILDING_LINKS, e.getMessage());
}
}
if (StringUtils.isNotBlank(excludedAttributes)) {
params.add(EXCLUDED_ATTRIBUTES_PARAM + "=" + excludedAttributes);
}
if (StringUtils.isNotBlank(attributes)) {
params.add(INCLUDED_ATTRIBUTES_PARAM + "=" + attributes);
}
return urlStringBuilder.append(String.join("&", params)).toString();
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java`
around lines 353 - 379, Update buildPaginationQueryParams to track whether a
query parameter has already been appended, so the first present parameter
follows “?” and subsequent parameters use “&”. Ensure links with limit == 0 and
any other parameter no longer begin with “?&”, while preserving the existing
parameter values and encoding behavior.

Comment on lines +3846 to +3857
SharingMode:
type: object
properties:
policy:
type: string
description: |-
Sharing scope for this organization.

Possible values:
- `SELECTED_ORG_ONLY`
- `SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN`
- `ALL_EXISTING_AND_FUTURE_ORGS`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

SharingMode.policy description omits ALL_EXISTING_ORGS_ONLY, a value the response can legitimately report.

Since PolicyEnum includes ALL_EXISTING_ORGS_ONLY (used by the "share with all" flow), this response field's documented value list should include it as well for completeness.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/resources/idp.yaml`
around lines 3846 - 3857, Update the SharingMode.policy description in the
idp.yaml schema to include ALL_EXISTING_ORGS_ONLY in the documented possible
values, while preserving the existing policy entries.

Comment on lines +3926 to +3941
IdentityProviderShareAllRequestBody:
type: object
required: [ identityProviderId, policy ]
properties:
identityProviderId:
type: string
example: 'c75e27f9-98c7-4518-a968-c6cd59f0ac6b'
policy:
type: string
description: |-
Sharing scope for this organization.

Possible values:
- `SELECTED_ORG_ONLY`
- `SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN`
- `ALL_EXISTING_AND_FUTURE_ORGS`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

IdentityProviderShareAllRequestBody.policy documents the wrong set of values for this endpoint.

The description lists SELECTED_ORG_ONLY, SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN, ALL_EXISTING_AND_FUTURE_ORGS, but ServerIdpSharingService#shareIdentityProviderWithAll only accepts ALL_EXISTING_ORGS_ONLY or ALL_EXISTING_AND_FUTURE_ORGS (any other value, including the two SELECTED_ORG_* values listed here, is rejected with ERROR_CODE_UNSUPPORTED_SHARE_POLICY). The documented list appears to be copy-pasted from OrgShareConfig.policy and is misleading for this "share with all" endpoint.

📝 Suggested fix
     IdentityProviderShareAllRequestBody:
       type: object
       required: [ identityProviderId, policy ]
       properties:
         identityProviderId:
           type: string
           example: 'c75e27f9-98c7-4518-a968-c6cd59f0ac6b'
         policy:
           type: string
           description: |-
             Sharing scope for this organization.

             Possible values:
-            - `SELECTED_ORG_ONLY`
-            - `SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN`
+            - `ALL_EXISTING_ORGS_ONLY`
             - `ALL_EXISTING_AND_FUTURE_ORGS`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
IdentityProviderShareAllRequestBody:
type: object
required: [ identityProviderId, policy ]
properties:
identityProviderId:
type: string
example: 'c75e27f9-98c7-4518-a968-c6cd59f0ac6b'
policy:
type: string
description: |-
Sharing scope for this organization.
Possible values:
- `SELECTED_ORG_ONLY`
- `SELECTED_ORG_WITH_ALL_EXISTING_AND_FUTURE_CHILDREN`
- `ALL_EXISTING_AND_FUTURE_ORGS`
IdentityProviderShareAllRequestBody:
type: object
required: [ identityProviderId, policy ]
properties:
identityProviderId:
type: string
example: 'c75e27f9-98c7-4518-a968-c6cd59f0ac6b'
policy:
type: string
description: |-
Sharing scope for this organization.
Possible values:
- `ALL_EXISTING_ORGS_ONLY`
- `ALL_EXISTING_AND_FUTURE_ORGS`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/resources/idp.yaml`
around lines 3926 - 3941, Update the policy description in
IdentityProviderShareAllRequestBody to document only ALL_EXISTING_ORGS_ONLY and
ALL_EXISTING_AND_FUTURE_ORGS, matching the values accepted by
ServerIdpSharingService#shareIdentityProviderWithAll; remove the SELECTED_ORG_*
entries.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pom.xml`:
- Around line 1160-1161: Update the
org.wso2.carbon.identity.organization.management.version property from the
unavailable 2.5.15-SNAPSHOT to the released 2.5.14 version, keeping the build
free of snapshot repository requirements.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 163c8cae-796d-4d8e-ad33-b9bfca2bc93f

📥 Commits

Reviewing files that changed from the base of the PR and between 8bb2c78 and ff0f5f9.

⛔ Files ignored due to path filters (1)
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/IdentityProviderListItem.java is excluded by !**/gen/**
📒 Files selected for processing (6)
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.common/src/main/java/org/wso2/carbon/identity/api/server/idp/common/IdentityProviderServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpManagementService.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/factories/ServerIdpSharingServiceFactory.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/resources/idp.yaml
  • pom.xml
🚧 Files skipped from review as they are similar to previous changes (4)
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/factories/ServerIdpSharingServiceFactory.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.common/src/main/java/org/wso2/carbon/identity/api/server/idp/common/IdentityProviderServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/resources/idp.yaml
  • components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/main/java/org/wso2/carbon/identity/api/server/idp/v1/core/ServerIdpSharingService.java

Comment thread pom.xml
Comment on lines +1160 to 1161
<org.wso2.carbon.identity.organization.management.version>2.5.15-SNAPSHOT
</org.wso2.carbon.identity.organization.management.version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 4 \
  'org.wso2.carbon.identity.organization.management.version|organization.connection.sharing|<snapshots>|<repository>' \
  --glob 'pom.xml'

Repository: wso2/identity-api-server

Length of output: 162


🏁 Script executed:

set -euo pipefail

echo '--- matching files ---'
git ls-files | rg '(^|/)pom\.xml$|(^|/)(settings|repository|maven).*\.(xml|ya?ml)$' || true

echo '--- dependency version and repository configuration ---'
rg -n -C 6 \
  'org\.wso2\.carbon\.identity\.organization\.management\.version|organization\.connection\.sharing|<snapshots>|<repository>|distributionManagement|maven' \
  --glob 'pom.xml' --glob 'settings*.xml' --glob '*.yaml' --glob '*.yml' . || true

echo '--- root pom context ---'
pom=$(git ls-files | awk '$0=="pom.xml"{print; exit}')
if [ -n "${pom:-}" ]; then
  sed -n '1135,1180p' "$pom"
fi

Repository: wso2/identity-api-server

Length of output: 50381


🏁 Script executed:

set -euo pipefail

root_pom=pom.xml

echo '--- version property occurrences ---'
rg -n -C 5 \
  'org\.wso2\.carbon\.identity\.organization\.management\.version' \
  --glob 'pom.xml' .

echo '--- root POM repository and profile sections ---'
rg -n -C 8 \
  '<(repositories|repository|snapshots|releases|profiles|profile|distributionManagement|id|url)>' \
  "$root_pom" | head -n 300

echo '--- CI and release references to Maven repositories or snapshots ---'
rg -n -C 4 \
  'maven|repository|snapshot|SNAPSHOT|settings\.xml|server-id' \
  .github .ci 2>/dev/null | head -n 300 || true

echo '--- relevant root POM lines ---'
sed -n '1145,1175p' "$root_pom"

Repository: wso2/identity-api-server

Length of output: 15337


🌐 Web query:

"org.wso2.carbon.identity.organization.management" "2.5.15-SNAPSHOT"

💡 Result:

The identifier org.wso2.carbon.identity.organization.management 2.5.15-SNAPSHOT refers to a development-version snapshot of the Organization Management feature suite within the WSO2 Carbon ecosystem. This suite is a core component of the WSO2 Identity Server, providing capabilities for managing organizational hierarchies, resources, and access control [1][2][3]. Key technical context: - Versioning: While version 2.5.14 is the latest stable release of the organization management artifacts in Maven repositories [4][5], the 2.5.15-SNAPSHOT version exists as the current development iteration on the project's main branch [6]. - Source Repository: The source code for these modules is hosted in the official WSO2 GitHub repositories, specifically within the identity-organization-management extensions and core repositories [6][7][2]. - Usage: Artifacts under the org.wso2.carbon.identity.organization.management group ID are used to implement organization-based multitenancy and hierarchical resource management in WSO2 products [5][3]. Developers typically reference these artifacts when building extensions or customizing the identity server's organization management features [8][9]. Users looking for stable binaries should generally use the latest released version (e.g., 2.5.14) rather than the -SNAPSHOT version, as snapshot versions are subject to change and may contain unstable code [4][5].

Citations:


🌐 Web query:

"org.wso2.carbon.identity.organization.management" Maven Central releases

💡 Result:

The artifacts under the Maven group ID org.wso2.carbon.identity.organization.management are actively published to Maven Central [1][2]. As of August 2026, the latest major version for most artifacts in this group is 2.5.14 [2]. These artifacts are part of the WSO2 Identity Server extension ecosystem, specifically related to organization management [3][2]. A summary of the group's presence in Maven Central includes: - Group ID: org.wso2.carbon.identity.organization.management [4][2] - Total Artifacts: Approximately 18 distinct modules, including core services, authorization services, role management, and configuration services [2]. - Latest Version: 2.5.14 is the most current release for the majority of these artifacts [2]. - Repository: Artifacts are hosted on the Maven Central Repository [1][2]. For project integration, you can include dependencies using the standard Maven format. For example, to include the role management service: org.wso2.carbon.identity.organization.management org.wso2.carbon.identity.organization.management.role.management.service 2.5.14 You can verify the full list of available artifacts and their specific version histories via standard repository search tools like MVNRepository or the Sonatype Central Repository [4][1][2].

Citations:


🏁 Script executed:

set -euo pipefail

echo '--- change in the root POM ---'
git diff --unified=5 -- pom.xml | sed -n '1,120p'

echo '--- workflow files ---'
git ls-files '.github/workflows/*' | sort

echo '--- repository configuration in tracked build files ---'
rg -n \
  '<(repositories|pluginRepositories|repository|snapshots|releases|distributionManagement)>|https?://[^<]+' \
  pom.xml .github --glob '*.xml' --glob '*.yml' --glob '*.yaml' || true

echo '--- Maven Central metadata ---'
curl -fsSL -o /tmp/central-metadata.xml -w 'central status=%{http_code}\n' \
  'https://repo1.maven.org/maven2/org/wso2/carbon/identity/organization/management/org.wso2.carbon.identity.organization.management.role.management.service/maven-metadata.xml' || true
if [ -s /tmp/central-metadata.xml ]; then
  rg -n '2\.5\.14|2\.5\.15|snapshot|<latest>|<release>' /tmp/central-metadata.xml || true
fi

echo '--- WSO2 snapshot metadata ---'
for base in \
  'https://maven.wso2.org/nexus/content/repositories/snapshots' \
  'https://maven.wso2.org/nexus/content/repositories/releases'
do
  url="$base/org/wso2/carbon/identity/organization/management/org.wso2.carbon.identity.organization.management.role.management.service/maven-metadata.xml"
  status=$(curl -sS -o /tmp/wso2-metadata.xml -w '%{http_code}' "$url" || true)
  echo "$base status=$status"
  if [ "$status" = 200 ]; then
    rg -n '2\.5\.14|2\.5\.15|snapshot|<latest>|<release>' /tmp/wso2-metadata.xml || true
  fi
done

Repository: wso2/identity-api-server

Length of output: 1587


Use a released organization management version.

The CI build has no snapshot repository configuration, and Maven Central provides 2.5.14 but not 2.5.15-SNAPSHOT. Pin this property to 2.5.14, or configure an approved snapshot repository for every CI and release build.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pom.xml` around lines 1160 - 1161, Update the
org.wso2.carbon.identity.organization.management.version property from the
unavailable 2.5.15-SNAPSHOT to the released 2.5.14 version, keeping the build
free of snapshot repository requirements.

urlStringBuilder.append(LIMIT_PARAM).append("=").append(limit);
}
if (recursive != null) {
urlStringBuilder.append("&").append(RECURSIVE_PARAM).append("=").append(recursive);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if a request comes without limit param, pagination url will have ?&

application/json:
schema:
$ref: '#/components/schemas/Error'
'/identity-providers/{identity-provider-id}/share':

@Yasasr1 Yasasr1 Aug 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We are having a verb on a get endpoint here. Hope you discussed this approach.
Alternative name shared-organizations

getConnectionSharedOrgsDTO.setFilter(filter);
getConnectionSharedOrgsDTO.setLimit(limitValue);
getConnectionSharedOrgsDTO.setRecursive(recursiveFlag);
getConnectionSharedOrgsDTO.setAttributes(resolveAttributeList(attributes));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems excludedAttributes are not passed to the DTO

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.

2 participants