Skip to content

Add REST API for connection sharing management#1112

Open
BimsaraBodaragama wants to merge 1 commit into
wso2:masterfrom
BimsaraBodaragama:feature/idp-sharing-api-1
Open

Add REST API for connection sharing management#1112
BimsaraBodaragama wants to merge 1 commit into
wso2:masterfrom
BimsaraBodaragama:feature/idp-sharing-api-1

Conversation

@BimsaraBodaragama

Copy link
Copy Markdown
Member

Purpose

Expose the connection sharing service layer as a REST API, enabling organization administrators to share, unshare, and query federated IDP connections across child organizations via HTTP.

Goals

  • Implement the Connection Sharing API v1 following the existing user sharing API patterns
  • Wire the OSGi-provided ConnectionSharingPolicyHandlerService into the API layer using the standard WSO2 CXF factory pattern
  • Register the new API component in the root POM dependency management

Approach

  • Add a new two-module Maven component (common + v1) under org.wso2.carbon.identity.api.server.organization.connection.sharing.management
  • Define the OpenAPI spec at connection-sharing-v1.yaml with five endpoints: POST /connections/share, POST /connections/share-with-all, POST /connections/unshare, POST /connections/unshare-with-all, GET /connections/{connectionId}/share
  • Implement ConnectionSharingMgtServiceHolder using the OSGi static inner class lazy-lookup pattern (consistent with UserSharingMgtServiceHolder)
  • Implement ConnectionsApiServiceCoreFactory to fail fast at startup if the OSGi service is unavailable
  • Implement ConnectionsApiServiceCore with full request mapping, cursor-based pagination, and structured error responses
  • Add org.wso2.carbon.identity.organization.management.organization.connection.sharing to the root POM's dependencyManagement with version ${org.wso2.carbon.identity.organization.management.version}

Related Issue

  • issue

@BimsaraBodaragama BimsaraBodaragama self-assigned this Apr 30, 2026
@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@BimsaraBodaragama has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 46 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 76992885-b574-4a41-8893-60d12d4d533e

📥 Commits

Reviewing files that changed from the base of the PR and between c3be1a5 and 136018d.

⛔ Files ignored due to path filters (15)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/ConnectionsApi.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/ConnectionsApiService.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/factories/ConnectionsApiServiceFactory.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionCriteria.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionOrgShareConfig.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionShareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionShareWithAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharedOrganization.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharedOrganizationsResponse.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharingMode.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionUnshareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionUnshareWithAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/Error.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/Link.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ProcessSuccessResponse.java is excluded by !**/gen/**
📒 Files selected for processing (10)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/ConnectionSharingMgtServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/constants/ConnectionSharingMgtConstants.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/core/ConnectionsApiServiceCore.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/factories/ConnectionsApiServiceCoreFactory.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/impl/ConnectionsApiServiceImpl.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/resources/connection-sharing-v1.yaml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/pom.xml
  • pom.xml
📝 Walkthrough

Walkthrough

This pull request adds a new organization connection sharing management API to the Identity Server. It introduces a parent aggregator module plus two submodules: common (service holder and constants) and v1 (OpenAPI spec, JAX-RS service, core logic, and factory). The v1 module implements endpoints for share/unshare operations and listing shared organizations, delegates to a ConnectionSharingPolicyHandlerService resolved via OSGi, and wires modules into the Maven build (property and module updates).

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant API as ConnectionsApiServiceImpl
    participant Factory as ConnectionsApiServiceCoreFactory
    participant Core as ConnectionsApiServiceCore
    participant ServiceHolder as ConnectionSharingMgtServiceHolder
    participant Handler as ConnectionSharingPolicyHandlerService
    participant Response as Response Builder

    Client->>API: shareConnectionsWithSelected(RequestBody)
    API->>Factory: getConnectionsApiServiceCore()
    Factory->>ServiceHolder: getConnectionSharingPolicyHandlerService()
    ServiceHolder-->>Factory: Handler Instance
    Factory-->>API: Core Instance
    API->>Core: shareConnectionsWithSelected(RequestBody)
    Core->>Core: Validate & build DTOs
    Core->>Handler: Execute share operation
    Handler-->>Core: Result
    Core->>Response: Build 202 Accepted
    Core-->>API: Response
    API-->>Client: 202 Accepted

    Note over Client,Core: Error path
    Client->>API: shareConnectionsWithSelected(null)
    API->>Core: shareConnectionsWithSelected(null)
    Core->>Core: Validation fails
    Core->>Response: Build 400 Bad Request
    Core-->>API: 400 Response
    API-->>Client: 400 Bad Request
Loading
sequenceDiagram
    participant Client as Client
    participant API as ConnectionsApiServiceImpl
    participant Core as ConnectionsApiServiceCore
    participant Handler as ConnectionSharingPolicyHandlerService
    participant Response as Response Builder

    Client->>API: getConnectionSharedOrganizations(connectionId, params)
    API->>Core: getConnectionSharedOrganizations(...)
    Core->>Core: Validate connectionId & params
    Core->>Core: Decode cursors (Base64)
    Core->>Handler: Retrieve shared organizations (with pagination)
    Handler-->>Core: Shared org results
    Core->>Core: Map results to API model
    Core->>Response: Build pagination links
    Core-->>API: 200 Response with list + links
    API-->>Client: 200 OK
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description covers Purpose, Goals, and Approach sections with substantial detail about implementation patterns and API endpoints. However, several required template sections are missing or incomplete. Add missing sections: User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests details (unit/integration with coverage), Security checks (with specific yes/no answers), Samples, Migrations, and Test environment. Include specific metrics and verification details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main objective: adding a REST API for connection sharing management. It is concise and directly reflects the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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
Review rate limit: 0/1 reviews remaining, refill in 3 minutes and 46 seconds.

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

@wso2-engineering wso2-engineering Bot left a comment

Copy link
Copy Markdown

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 N #1112 (comment)
#### Log Improvement Suggestion No: 2 N #1112 (comment)
#### Log Improvement Suggestion No: 3 N #1112 (comment)
#### Log Improvement Suggestion No: 4 N #1112 (comment)
#### Log Improvement Suggestion No: 5 N #1112 (comment)
#### Log Improvement Suggestion No: 6 N #1112 (comment)
#### Log Improvement Suggestion No: 7 N #1112 (comment)

@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: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/pom.xml`:
- Around line 21-25: Update the parent version declaration in the POM so it
matches the root parent used in this branch: change the <parent> block's
<version> value from 1.5.33-SNAPSHOT to 1.6.8-SNAPSHOT (the same version as the
root parent) so Maven can correctly resolve ../pom.xml for the artifact
identified by groupId org.wso2.carbon.identity.server.api and artifactId
org.wso2.carbon.identity.api.server.organization.connection.sharing.management.

In
`@components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/pom.xml`:
- Around line 21-25: Update the parent <parent> version in this module's POM so
it matches the new root parent version; specifically change the <version> value
under the <parent> element (currently "1.5.33-SNAPSHOT") to the root's
"1.6.8-SNAPSHOT" so Maven can resolve the local parent for artifactId
org.wso2.carbon.identity.api.server.organization.connection.sharing.management.

In
`@components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/core/ConnectionsApiServiceCore.java`:
- Around line 273-279: After decoding cursors in ConnectionsApiServiceCore
(afterCursor = decodeCursor(after); beforeCursor = decodeCursor(before);), add
an explicit non-negative bounds check: if either afterCursor or beforeCursor is
negative, return
Response.status(BAD_REQUEST).entity(buildErrorResponse(makeRequestError(ERROR_INVALID_CURSOR))).build();
this ensures negative decoded values are rejected the same way as decoding
errors and prevents forwarding invalid cursor values to the service.

In
`@components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/impl/ConnectionsApiServiceImpl.java`:
- Around line 48-50: The initialization catch block in ConnectionsApiServiceImpl
currently logs only e.getMessage(), losing stack trace; update the LOG.error
call in the constructor/initializer catch (IllegalStateException e) to log the
exception object (e.g., pass e as the throwable param) so the full stack trace
is preserved when throwing the RuntimeException with
ERROR_INITIATING_CONNECTIONS_API_SERVICE.

In
`@components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/resources/connection-sharing-v1.yaml`:
- Around line 798-809: The OpenAPI Error schema's example code uses the outdated
"CS-00000" format; update the Error object's code example (property 'code'
within the Error schema) to use the new "CSM-00000" prefix so it matches the
PR's API constants and real response codes (replace the example value "CS-00000"
with "CSM-00000").
- Around line 398-405: The description for the query parameter "limit" currently
implies an unbounded result set; update the OpenAPI parameter definition for
limit in connection-sharing-v1.yaml to enforce a safe default and cap by adding
schema properties "default": 50 and "maximum": 1000 (or other team-agreed
values) and revise the description text to state the default page size and the
maximum allowed (e.g., "Default 50; maximum 1000; omit to use default page
size") and mention that cursor-based pagination should be used to fetch
subsequent pages; ensure the parameter name "limit" and its schema are the only
changed symbols.
- Around line 547-590: Update the OpenAPI schemas so clients/validators cannot
send empty selections: for ConnectionCriteria add an anyOf (or oneOf) clause
that requires either connectionIds or connectionNames to be present and
non-empty by referencing connectionIds with properties.connectionIds.minItems: 1
(and similarly for connectionNames with minItems: 1); for
ConnectionShareSelectedRequestBody and any schema with organizations or orgIds
(e.g., ConnectionOrgShareConfig) add minItems: 1 on the organizations/orgIds
array properties (and/or mark them non-empty via required + minItems in the
enclosing schema) so generated validators will reject empty arrays. Ensure you
modify the ConnectionCriteria, ConnectionShareSelectedRequestBody, and
ConnectionOrgShareConfig schema entries to include these anyOf/required+minItems
changes.
- Around line 532-537: The OAuth2 flow in connection-sharing-v1.yaml currently
hardcodes localhost:9443 in the authorizationUrl and tokenUrl under OAuth2 ->
flows -> authorizationCode; change these to be deployment-aware by referencing
the OpenAPI servers URL (or a server variable) instead of a literal host so the
URLs resolve to the deployed host (e.g., build authorizationUrl and tokenUrl
from the servers.url/server variable or use relative paths based on the servers
entry). Update the authorizationUrl and tokenUrl entries to use that server
reference so Swagger consumers point to the correct deployed authorization/token
endpoints.

In
`@components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/pom.xml`:
- Around line 20-24: Update the Maven parent version in the module POM so it
matches the root reactor version: change the <version> value under the <parent>
element for groupId "org.wso2.carbon.identity.server.api" and artifactId
"identity-api-server" from 1.5.33-SNAPSHOT to 1.6.8-SNAPSHOT so Maven can
resolve the parent when this module is wired into the reactor.
🪄 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

Run ID: b38a6f49-c1bc-42a7-9e15-3358b30cdfdb

📥 Commits

Reviewing files that changed from the base of the PR and between 070e10b and dc99f02.

⛔ Files ignored due to path filters (15)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/ConnectionsApi.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/ConnectionsApiService.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/factories/ConnectionsApiServiceFactory.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionCriteria.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionOrgShareConfig.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionShareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionShareWithAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharedOrganization.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharedOrganizationsResponse.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharingMode.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionUnshareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionUnshareWithAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/Error.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/Link.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ProcessSuccessResponse.java is excluded by !**/gen/**
📒 Files selected for processing (10)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/ConnectionSharingMgtServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/constants/ConnectionSharingMgtConstants.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/core/ConnectionsApiServiceCore.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/factories/ConnectionsApiServiceCoreFactory.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/impl/ConnectionsApiServiceImpl.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/resources/connection-sharing-v1.yaml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/pom.xml
  • pom.xml

@BimsaraBodaragama
BimsaraBodaragama force-pushed the feature/idp-sharing-api-1 branch 2 times, most recently from dacf576 to c3be1a5 Compare April 30, 2026 23:00

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/core/ConnectionsApiServiceCore.java`:
- Around line 420-430: The toApiConnectionSharedOrganization method currently
maps only a subset of fields; update it to map all fields defined in the API
model by copying missing properties from ResponseConnectionOrgDetailsDTO into
ConnectionSharedOrganization (e.g., map refs, hierarchy/parent/child metadata
and any other contract fields) rather than omitting them; locate
toApiConnectionSharedOrganization and the DTO class
ResponseConnectionOrgDetailsDTO and add calls to the corresponding setters on
ConnectionSharedOrganization (e.g., setRefs, setHierarchyMetadata,
setParentOrgId, setChildren or equivalent setters matching the API model) so the
response matches the API contract, or alternatively remove those fields from the
API schema if they are intentionally unsupported.
- Around line 301-303: getConnectionSharedOrganizations incorrectly maps all
ConnectionSharingMgtClientException to 400; implement a helper like
mapClientErrorToStatus(ConnectionSharingMgtClientException e) that inspects the
exception's error code/message and returns Response.Status.NOT_FOUND for
"connection not found" error codes and Response.Status.BAD_REQUEST for
validation/format errors, then replace the current catch that returns
Response.Status.BAD_REQUEST with logic that calls mapClientErrorToStatus(e) and
uses that status when building the Response (keep buildErrorResponse(e) as the
entity).
🪄 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

Run ID: cbfcc11c-0ea7-4ab4-a8dd-5faf1b7ba3f9

📥 Commits

Reviewing files that changed from the base of the PR and between dc99f02 and c3be1a5.

⛔ Files ignored due to path filters (15)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/ConnectionsApi.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/ConnectionsApiService.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/factories/ConnectionsApiServiceFactory.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionCriteria.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionOrgShareConfig.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionShareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionShareWithAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharedOrganization.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharedOrganizationsResponse.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionSharingMode.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionUnshareSelectedRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ConnectionUnshareWithAllRequestBody.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/Error.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/Link.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/model/ProcessSuccessResponse.java is excluded by !**/gen/**
📒 Files selected for processing (10)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/ConnectionSharingMgtServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/constants/ConnectionSharingMgtConstants.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/core/ConnectionsApiServiceCore.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/factories/ConnectionsApiServiceCoreFactory.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/impl/ConnectionsApiServiceImpl.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/resources/connection-sharing-v1.yaml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/pom.xml
  • pom.xml
✅ Files skipped from review due to trivial changes (4)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/pom.xml
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/constants/ConnectionSharingMgtConstants.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/pom.xml
🚧 Files skipped from review as they are similar to previous changes (3)
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.common/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/common/ConnectionSharingMgtServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.organization.connection.sharing.management/org.wso2.carbon.identity.api.server.organization.connection.sharing.management.v1/src/main/java/org/wso2/carbon/identity/api/server/organization/connection/sharing/management/v1/factories/ConnectionsApiServiceCoreFactory.java
  • pom.xml

@BimsaraBodaragama
BimsaraBodaragama force-pushed the feature/idp-sharing-api-1 branch from c3be1a5 to d0b018e Compare April 30, 2026 23:44
@BimsaraBodaragama
BimsaraBodaragama force-pushed the feature/idp-sharing-api-1 branch from d0b018e to 136018d Compare April 30, 2026 23:56
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