Skip to content

Update identity provider listeners in IDP manager#8208

Open
ashanthamara wants to merge 1 commit into
wso2:masterfrom
ashanthamara:feature/idp-sharing-listener
Open

Update identity provider listeners in IDP manager#8208
ashanthamara wants to merge 1 commit into
wso2:masterfrom
ashanthamara:feature/idp-sharing-listener

Conversation

@ashanthamara

Copy link
Copy Markdown
Contributor

Proposed changes in this pull request

$subject

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Shared identity providers now expose shared-state detection and support resolution-aware retrieval through manager APIs and post-get listeners. Updates use raw provider data, new management error codes are defined, and connection-sharing configuration adds a PRIMARY provisioning user-store fallback.

Shared Identity Provider Resolution

Layer / File(s) Summary
Shared provider contracts and listener hooks
components/application-mgt/.../IdentityProvider.java, components/idp-mgt/.../IdpManager.java, components/idp-mgt/.../listener/IdentityProviderMgtListener.java
Adds shared-state detection and resolution-aware manager and listener method signatures.
Resolution-aware retrieval flow
components/idp-mgt/.../IdentityProviderManager.java
Routes list and individual provider retrieval through post-get listeners with resolution types, while update lookups use the raw provider view.
Shared provider management controls
components/idp-mgt/.../IdpManager.java, components/idp-mgt/.../IdentityProviderManager.java, components/idp-mgt/.../util/IdPManagementConstants.java
Adds force-delete support and error codes for restricted shared-provider operations.
Connection-sharing provisioning defaults
features/identity-core/.../identity.xml, features/identity-core/.../identity.xml.j2, features/identity-core/.../org.wso2.carbon.identity.core.server.feature.default.json
Configures PRIMARY as the fallback provisioning user store for connection sharing.

Suggested reviewers: yasasr1, sujansanjula96

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is a placeholder and misses the required sections for purpose, goals, approach, testing, and release details. Fill in the template sections with purpose, goals, approach, user stories, release note, docs, tests, security checks, and any applicable links.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is relevant to the main IDP manager listener changes, though it omits the shared IdP resolution and configuration updates.
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 requested review from SujanSanjula96 and Yasasr1 July 16, 2026 08:16

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/IdentityProvider.java`:
- Around line 996-1008: Add Javadoc to the public isShared() method describing
its return value, and make the property-name comparison null-safe by invoking
equals on the constant "isShared" rather than on idpProperty.getName(). Preserve
the existing false fallback behavior.
- Around line 996-1008: Add Javadoc to the public isShared() method, and make
the property-name comparison null-safe by invoking equals on the constant
"isShared" rather than on idpProperty.getName().
🪄 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: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 211b3fb2-b84a-4c37-83f0-445ccb201e45

📥 Commits

Reviewing files that changed from the base of the PR and between de88dd0 and c87bef2.

📒 Files selected for processing (8)
  • components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/IdentityProvider.java
  • components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java
  • components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdpManager.java
  • components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/listener/IdentityProviderMgtListener.java
  • components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementConstants.java
  • features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml
  • features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2
  • features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json

Comment on lines +996 to +1008
public boolean isShared() {

IdentityProviderProperty[] idpProperties = getIdpProperties();
if (idpProperties == null) {
return false;
}
for (IdentityProviderProperty idpProperty : idpProperties) {
if (idpProperty.getName().equals("isShared")) {
return Boolean.parseBoolean(idpProperty.getValue());
}
}
return false;
}

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Prevent NullPointerException and add missing Javadoc.

As per coding guidelines, all public methods should have a docstring. Additionally, swapping the string comparison prevents a potential NullPointerException if idpProperty.getName() evaluates to null.

♻️ Proposed fix
+    /**
+     * Checks if the identity provider is shared.
+     *
+     * `@return` True if the identity provider is shared, false otherwise.
+     */
     public boolean isShared() {
 
         IdentityProviderProperty[] idpProperties = getIdpProperties();
         if (idpProperties == null) {
             return false;
         }
         for (IdentityProviderProperty idpProperty : idpProperties) {
-            if (idpProperty.getName().equals("isShared")) {
+            if ("isShared".equals(idpProperty.getName())) {
                 return Boolean.parseBoolean(idpProperty.getValue());
             }
         }
         return false;
     }
📝 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
public boolean isShared() {
IdentityProviderProperty[] idpProperties = getIdpProperties();
if (idpProperties == null) {
return false;
}
for (IdentityProviderProperty idpProperty : idpProperties) {
if (idpProperty.getName().equals("isShared")) {
return Boolean.parseBoolean(idpProperty.getValue());
}
}
return false;
}
/**
* Checks if the identity provider is shared.
*
* `@return` True if the identity provider is shared, false otherwise.
*/
public boolean isShared() {
IdentityProviderProperty[] idpProperties = getIdpProperties();
if (idpProperties == null) {
return false;
}
for (IdentityProviderProperty idpProperty : idpProperties) {
if ("isShared".equals(idpProperty.getName())) {
return Boolean.parseBoolean(idpProperty.getValue());
}
}
return false;
}
🤖 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/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/IdentityProvider.java`
around lines 996 - 1008, Add Javadoc to the public isShared() method describing
its return value, and make the property-name comparison null-safe by invoking
equals on the constant "isShared" rather than on idpProperty.getName(). Preserve
the existing false fallback behavior.

Source: Coding guidelines


📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Prevent NullPointerException and add missing Javadoc.

As per coding guidelines, all public methods should have a docstring. Additionally, swapping the string comparison prevents a potential NullPointerException if idpProperty.getName() evaluates to null.

♻️ Proposed fix
+    /**
+     * Checks if the identity provider is shared.
+     *
+     * `@return` True if the identity provider is shared, false otherwise.
+     */
     public boolean isShared() {
 
         IdentityProviderProperty[] idpProperties = getIdpProperties();
         if (idpProperties == null) {
             return false;
         }
         for (IdentityProviderProperty idpProperty : idpProperties) {
-            if (idpProperty.getName().equals("isShared")) {
+            if ("isShared".equals(idpProperty.getName())) {
                 return Boolean.parseBoolean(idpProperty.getValue());
             }
         }
         return false;
     }
📝 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
public boolean isShared() {
IdentityProviderProperty[] idpProperties = getIdpProperties();
if (idpProperties == null) {
return false;
}
for (IdentityProviderProperty idpProperty : idpProperties) {
if (idpProperty.getName().equals("isShared")) {
return Boolean.parseBoolean(idpProperty.getValue());
}
}
return false;
}
/**
* Checks if the identity provider is shared.
*
* `@return` True if the identity provider is shared, false otherwise.
*/
public boolean isShared() {
IdentityProviderProperty[] idpProperties = getIdpProperties();
if (idpProperties == null) {
return false;
}
for (IdentityProviderProperty idpProperty : idpProperties) {
if ("isShared".equals(idpProperty.getName())) {
return Boolean.parseBoolean(idpProperty.getValue());
}
}
return false;
}
🤖 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/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/IdentityProvider.java`
around lines 996 - 1008, Add Javadoc to the public isShared() method, and make
the property-name comparison null-safe by invoking equals on the constant
"isShared" rather than on idpProperty.getName().

Source: Coding guidelines

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