Skip to content

Add preferences API resource with POST method#8150

Open
raviendalpatadu wants to merge 16 commits into
wso2:masterfrom
raviendalpatadu:configs/preferences_endpoint
Open

Add preferences API resource with POST method#8150
raviendalpatadu wants to merge 16 commits into
wso2:masterfrom
raviendalpatadu:configs/preferences_endpoint

Conversation

@raviendalpatadu

@raviendalpatadu raviendalpatadu commented Jun 11, 2026

Copy link
Copy Markdown

This pull request introduces a new secured API resource for managing user preferences via a POST request. The change ensures that access to this endpoint is restricted to users with the internal_login scope.

Access control update:

  • Added a new resource definition in resource-access-control-v2.xml.j2 to secure the POST method for the /api/server/v1/configs/preferences endpoint, requiring the internal_login scope.

Related Issues

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces a ResourceIdentifier-based default configuration resolver framework that allows components to provide default configurations for resource types. The framework registers and retrieves resolvers through OSGi dynamic references and thread-safe storage. A new access control rule protects the server preferences endpoint, and push device management configuration limits and email templates are added to feature defaults.

Changes

Server Preferences Endpoint Protection

Layer / File(s) Summary
Server preferences endpoint access control
features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/resource-access-control-v2.xml.j2
A new Resource entry for POST /api/server/v1/configs/preferences is added with secured="true" and internal_login scope requirement.

Default Configuration Resolver Framework

Layer / File(s) Summary
ResourceIdentifier model and DefaultConfigResolver interface
components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/model/ResourceIdentifier.java, components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/DefaultConfigResolver.java
ResourceIdentifier stores resourceType and resourceName with value-based equality. DefaultConfigResolver interface declares getResourceIdentifier() to identify the resolver and getDefaultConfigs(String resourceTypeName, String resourceName) to retrieve default configuration resources.
ConfigurationManager interface and resolver registry
components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManager.java, components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/internal/ConfigurationManagerComponentDataHolder.java
ConfigurationManager declares getDefaultResource(String resourceTypeName, String resourceName) contract. ConfigurationManagerComponentDataHolder maintains thread-safe ConcurrentHashMap<ResourceIdentifier, DefaultConfigResolver> storage and exposes public API to add, remove, and retrieve resolvers by resource type/name lookup.
OSGi component wiring
components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/internal/ConfigurationManagerComponent.java
ConfigurationManagerComponent declares a dynamic OSGi @Reference for DefaultConfigResolver with MULTIPLE cardinality. Setter and unsetter methods manage resolver registration/unregistration in the data holder.
ConfigurationManagerImpl default resource implementation
components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java
ConfigurationManagerImpl.getDefaultResource() constructs a ResourceIdentifier from input parameters, looks up the resolver in the data holder, and returns its default configs. Supporting formatting updates reflow Javadocs and adjust method signature indentation in inherited resource retrieval methods.
Default resolver behavior test coverage
components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/test/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerTest.java
Four new test methods validate resolver registration/unregistration in the data holder, resolver lookup by resource type/name, and exception throwing when no matching resolver is found.

Push Device Management Configuration

Layer / File(s) Summary
Push device management configuration and email template
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
identity.xml.j2 adds PushDeviceManagement configuration block under PushAuthenticator with MaxDeviceLimitUpperBound templated from feature defaults. Feature defaults JSON adds push_device_management.max_device_limit_upper_bound setting (value "10") and a Push Device Registration email template entry to the console templates list.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete against the required template, missing most sections including Purpose (issue links), Goals, Approach, User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests, Security checks, Samples, and related items. Complete the PR description by filling in all required template sections, particularly Purpose with issue resolution, Goals, Approach, Release notes, Documentation links, and Security checks (secure coding standards, FindSecurityBugs verification, secrets confirmation).
Docstring Coverage ⚠️ Warning Docstring coverage is 45.95% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a new secured API resource for the preferences endpoint with POST method support.
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

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

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.45455% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.91%. Comparing base (c97c4ea) to head (bdd31dc).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...ernal/ConfigurationManagerComponentDataHolder.java 47.36% 8 Missing and 2 partials ⚠️
...t/core/internal/ConfigurationManagerComponent.java 0.00% 8 Missing ⚠️
...nfiguration/mgt/core/model/ResourceIdentifier.java 45.45% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #8150      +/-   ##
============================================
+ Coverage     52.60%   52.91%   +0.30%     
+ Complexity    21135    20999     -136     
============================================
  Files          2197     2198       +1     
  Lines        130930   129703    -1227     
  Branches      19453    19337     -116     
============================================
- Hits          68875    68631     -244     
+ Misses        53635    52694     -941     
+ Partials       8420     8378      -42     
Flag Coverage Δ
unit 38.22% <45.45%> (+0.01%) ⬆️

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

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

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

Comment on lines +612 to +614
@Override
public Resource getDefaultResource(String resourceType, String resourceName)
throws ConfigurationManagementException {

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.

Log Improvement Suggestion No: 1

Suggested change
@Override
public Resource getDefaultResource(String resourceType, String resourceName)
throws ConfigurationManagementException {
@Override
public Resource getDefaultResource(String resourceType, String resourceName)
throws ConfigurationManagementException {
log.info("Retrieving default resource for type: " + resourceType + ", name: " + resourceName);

Comment on lines +622 to +625
}
return resolver.getDefaultConfigs(resourceType, resourceName);
}
}

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.

Log Improvement Suggestion No: 2

Suggested change
}
return resolver.getDefaultConfigs(resourceType, resourceName);
}
}
}
return resolver.getDefaultConfigs(resourceType, resourceName);
}
}
log.warn("No resolver found to handle resource type: " + resourceType + ", name: " + resourceName);

Comment on lines +201 to +206
protected void setDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) {

if (log.isDebugEnabled()) {
log.debug("DefaultConfigResolver registered: " + defaultConfigResolver.getClass().getName());
}
ConfigurationManagerComponentDataHolder.getInstance().addDefaultConfigResolver(defaultConfigResolver);

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.

Log Improvement Suggestion No: 3

Suggested change
protected void setDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) {
if (log.isDebugEnabled()) {
log.debug("DefaultConfigResolver registered: " + defaultConfigResolver.getClass().getName());
}
ConfigurationManagerComponentDataHolder.getInstance().addDefaultConfigResolver(defaultConfigResolver);
protected void setDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) {
if (log.isDebugEnabled()) {
log.debug("DefaultConfigResolver registered: " + defaultConfigResolver.getClass().getName());
}
log.info("Registering DefaultConfigResolver: " + defaultConfigResolver.getClass().getSimpleName());
ConfigurationManagerComponentDataHolder.getInstance().addDefaultConfigResolver(defaultConfigResolver);

Comment on lines +209 to +214
protected void unsetDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) {

if (log.isDebugEnabled()) {
log.debug("DefaultConfigResolver unregistered: " + defaultConfigResolver.getClass().getName());
}
ConfigurationManagerComponentDataHolder.getInstance().removeDefaultConfigResolver(defaultConfigResolver);

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.

Log Improvement Suggestion No: 4

Suggested change
protected void unsetDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) {
if (log.isDebugEnabled()) {
log.debug("DefaultConfigResolver unregistered: " + defaultConfigResolver.getClass().getName());
}
ConfigurationManagerComponentDataHolder.getInstance().removeDefaultConfigResolver(defaultConfigResolver);
protected void unsetDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) {
if (log.isDebugEnabled()) {
log.debug("DefaultConfigResolver unregistered: " + defaultConfigResolver.getClass().getName());
}
log.info("Unregistering DefaultConfigResolver: " + defaultConfigResolver.getClass().getSimpleName());
ConfigurationManagerComponentDataHolder.getInstance().removeDefaultConfigResolver(defaultConfigResolver);

Comment on lines +132 to +136
*/
public void addDefaultConfigResolver(DefaultConfigResolver resolver) {

defaultConfigResolvers.add(resolver);
}

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.

Log Improvement Suggestion No: 5

Suggested change
*/
public void addDefaultConfigResolver(DefaultConfigResolver resolver) {
defaultConfigResolvers.add(resolver);
}
public void addDefaultConfigResolver(DefaultConfigResolver resolver) {
defaultConfigResolvers.add(resolver);
log.debug("DefaultConfigResolver added: " + resolver.getClass().getName());
}

Comment on lines +144 to 148
public void removeDefaultConfigResolver(DefaultConfigResolver resolver) {

defaultConfigResolvers.remove(resolver);
}
}

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.

Log Improvement Suggestion No: 6

Suggested change
public void removeDefaultConfigResolver(DefaultConfigResolver resolver) {
defaultConfigResolvers.remove(resolver);
}
}
public void removeDefaultConfigResolver(DefaultConfigResolver resolver) {
defaultConfigResolvers.remove(resolver);
log.debug("DefaultConfigResolver removed: " + resolver.getClass().getName());
}

@wso2-engineering wso2-engineering 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.

AI Agent Log Improvement Checklist

⚠️ Warning: AI-Generated Review Comments

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

✅ Before merging this pull request:

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

@coderabbitai coderabbitai Bot requested a review from DilshanSenarath June 15, 2026 10:09
@raviendalpatadu raviendalpatadu force-pushed the configs/preferences_endpoint branch from d5107d2 to e7a1a5b Compare June 15, 2026 10:11

@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 (1)
components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java (1)

626-626: ⚡ Quick win

Add a log at the no-resolver error return boundary.

Line 626 throws a handled client error without a corresponding diagnostic log in this new critical resolution path. Add a guarded DEBUG/WARN log (not ERROR) before throwing to improve traceability.

As per coding guidelines, Java changes should log meaningful decision/error-return points and avoid ERROR for client-driven failures.

🤖 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/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java`
at line 626, Line 626 in the ConfigurationManagerImpl.java file throws a handled
client exception for a non-existent resource without a corresponding diagnostic
log. Add a guarded DEBUG or WARN level log statement before the throw statement
that documents the resolution failure, including the resourceName and any
relevant context to improve traceability. Use a guarded log (e.g., if
(log.isDebugEnabled())) to ensure this DEBUG/WARN level logging aligns with
coding guidelines and does not inappropriately treat client-driven errors as
ERROR level issues.

Source: Coding guidelines

🤖 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/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java`:
- Around line 613-627: The getDefaultResource method does not validate the
resourceType and resourceName parameters before using them in resolver dispatch,
which can lead to inconsistent errors or null pointer exceptions. Add input
validation at the beginning of the getDefaultResource method to check that both
resourceType and resourceName are not null and not empty strings, throwing an
appropriate ConfigurationManagementException with a standard error code if
validation fails. This ensures consistent error handling aligned with the
standard invalid-request flow used elsewhere in the codebase.

In
`@components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/internal/ConfigurationManagerComponentDataHolder.java`:
- Around line 123-126: The getDefaultConfigResolvers() method in
ConfigurationManagerComponentDataHolder exposes the internal mutable list
directly, allowing callers to modify the resolver registry outside the DS
bind/unbind flow. Return an immutable/unmodifiable copy of the
defaultConfigResolvers list instead of the raw list by wrapping it with
Collections.unmodifiableList() or similar immutability wrapper to prevent
unauthorized modifications to the resolver registry.

In
`@components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/test/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerTest.java`:
- Around line 962-966: The testGetDefaultResourceThrowsWhenNoResolversRegistered
test is flaky because it depends on shared singleton state (an empty resolver
registry) that may be polluted by other tests. To fix this, add a `@BeforeMethod`
setup method in the ConfigurationManagerTest class that explicitly clears all
resolver registrations before each test runs, ensuring this test always starts
with a clean state. Alternatively, add a `@AfterMethod` teardown method to enforce
cleanup of resolver registrations after each test completes, preventing state
leakage to subsequent tests.

---

Nitpick comments:
In
`@components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java`:
- Line 626: Line 626 in the ConfigurationManagerImpl.java file throws a handled
client exception for a non-existent resource without a corresponding diagnostic
log. Add a guarded DEBUG or WARN level log statement before the throw statement
that documents the resolution failure, including the resourceName and any
relevant context to improve traceability. Use a guarded log (e.g., if
(log.isDebugEnabled())) to ensure this DEBUG/WARN level logging aligns with
coding guidelines and does not inappropriately treat client-driven errors as
ERROR level issues.
🪄 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: 06cb3072-099d-4f1c-96be-7fbe4a65f7ac

📥 Commits

Reviewing files that changed from the base of the PR and between eeca5f9 and d5107d2.

📒 Files selected for processing (7)
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManager.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/DefaultConfigResolver.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/internal/ConfigurationManagerComponent.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/internal/ConfigurationManagerComponentDataHolder.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/test/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerTest.java
  • features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/resource-access-control-v2.xml.j2
🚧 Files skipped from review as they are similar to previous changes (1)
  • features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/resource-access-control-v2.xml.j2

Comment on lines +962 to +966
@Test(priority = 47, expectedExceptions = ConfigurationManagementException.class)
public void testGetDefaultResourceThrowsWhenNoResolversRegistered() throws Exception {

configurationManager.getDefaultResource("anyType", "anyName");
}

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Make the “no resolvers registered” test isolated from shared singleton state.

This test assumes an empty global resolver registry. If another test leaves a resolver behind, Line 965 can become flaky. Clear resolver registrations in @BeforeMethod (or enforce cleanup in @AfterMethod) to guarantee isolation.

🤖 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/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/test/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerTest.java`
around lines 962 - 966, The
testGetDefaultResourceThrowsWhenNoResolversRegistered test is flaky because it
depends on shared singleton state (an empty resolver registry) that may be
polluted by other tests. To fix this, add a `@BeforeMethod` setup method in the
ConfigurationManagerTest class that explicitly clears all resolver registrations
before each test runs, ensuring this test always starts with a clean state.
Alternatively, add a `@AfterMethod` teardown method to enforce cleanup of resolver
registrations after each test completes, preventing state leakage to subsequent
tests.

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

🤖 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/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManager.java`:
- Line 397: The getDefaultResource method declaration at line 397 is missing the
throws ConfigurationManagementException clause from its signature. Add the
throws ConfigurationManagementException declaration to the getDefaultResource
method signature to restore the checked-exception contract and maintain
consistency with the interface's API contract for standardized error propagation
from implementations.

In
`@components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java`:
- Around line 613-619: The getDefaultResource method in ConfigurationManagerImpl
has a potential NullPointerException on line 618 where
resolver.getDefaultConfigs is called. The getDefaultConfigResolver call can
return null when no resolver is registered for the given resourceType and
resourceName combination, but there is no null check before dereferencing the
resolver variable. Add an explicit null check immediately after obtaining the
resolver from
ConfigurationManagerComponentDataHolder.getInstance().getDefaultConfigResolver(resourceType,
resourceName), and throw a ConfigurationManagementException with an appropriate
error message if the resolver is null, rather than allowing the code to proceed
and cause a NullPointerException.

In
`@components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/internal/ConfigurationManagerComponentDataHolder.java`:
- Around line 124-127: The addDefaultConfigResolver method does not validate
whether the resolver's getResourceIdentifier() returns null before using it as a
key in the ConcurrentHashMap, which will throw a NullPointerException at runtime
since ConcurrentHashMap rejects null keys. Add a null check after calling
resolver.getResourceIdentifier() to guard against null identifiers and either
skip the operation with appropriate logging or throw a meaningful exception.
Apply the same null-checking guard to the corresponding unbind/remove method
that handles DefaultConfigResolver removal (referenced at lines 135-138) to
ensure consistency across both operations.

In
`@components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/model/ResourceIdentifier.java`:
- Around line 25-52: The ResourceIdentifier class is mutable due to the presence
of setter methods setResourceType and setResourceName, which allows the object's
internal state to be modified after instantiation. Since ResourceIdentifier is
used as a key in ConcurrentHashMap in ConfigurationManagerComponentDataHolder,
this violates the requirement that map keys must remain immutable, as mutations
after insertion can cause hash code changes and lead to lookup/removal failures.
Remove the setResourceType and setResourceName methods from the
ResourceIdentifier class to make it immutable, ensuring objects can only be
initialized through the constructor and cannot be modified afterward.

In
`@features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json`:
- Around line 1324-1325: Fix the typo in the description field for the Push
Device Registration email template configuration. The word "reigistered" in the
description string is misspelled and should be corrected to "registered". Locate
the description property that contains "This email is sent to the user to inform
when a new device has been reigistered for push authentication." and correct the
misspelled word to ensure proper user-facing documentation.
- Line 1326: The push device registration ID `UHVzaERldmljZVJlZ2lzdHJhdGlvbg==`
contains base64 padding characters (`==`) at the end, which is inconsistent with
all other 67 template IDs in the file that use unpadded base64 format. Remove
the padding from this ID to match the existing convention and prevent backend
lookup failures due to exact string matching. Change the ID from its current
padded form to the unpadded equivalent.
🪄 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: e4c9c261-b4cb-4306-9ac5-9d45c4e51f80

📥 Commits

Reviewing files that changed from the base of the PR and between a07fd22 and ca3e0eb.

📒 Files selected for processing (7)
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManager.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/ConfigurationManagerImpl.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/DefaultConfigResolver.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/internal/ConfigurationManagerComponentDataHolder.java
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/model/ResourceIdentifier.java
  • 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
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/DefaultConfigResolver.java

@raviendalpatadu raviendalpatadu force-pushed the configs/preferences_endpoint branch from ad69cfa to de33c82 Compare June 23, 2026 09:58
@@ -16,22 +16,34 @@

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

update license headers on changed files. check on all other places

if (!(o instanceof ResourceIdentifier that)) {
return false;
}
return Objects.equals(resourceType, that.resourceType) &&

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

check on this "That"

}

@Override
public int hashCode() {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

check on this

('08fbc096-56c5-4ae6-9edc-54198a07e0dc', 'ISSUER_USAGE_SCOPE', 'A resource type to store issuer usage scope for organizations.'),
('12c78d11-65cd-4b6e-b482-98538ecd7a5c', 'FAPI_CONFIGURATION', 'A resource type to keep the FAPI configurations.')
('12c78d11-65cd-4b6e-b482-98538ecd7a5c', 'FAPI_CONFIGURATION', 'A resource type to keep the FAPI configurations.'),
('4fed2813-cfa8-40b1-83e6-4ab85d7fcb16', 'DEVICE_MANAGEMENT', 'A resource type to keep tenant level configurations for push authentication')

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Suggested change
('4fed2813-cfa8-40b1-83e6-4ab85d7fcb16', 'DEVICE_MANAGEMENT', 'A resource type to keep tenant level configurations for push authentication')
('4fed2813-cfa8-40b1-83e6-4ab85d7fcb16', 'DEVICE_MANAGEMENT', 'A resource type to keep tenant level configurations for user device management')

('08fbc096-56c5-4ae6-9edc-54198a07e0dc', 'ISSUER_USAGE_SCOPE', 'A resource type to store issuer usage scope for organizations.'),
('12c78d11-65cd-4b6e-b482-98538ecd7a5c', 'FAPI_CONFIGURATION', 'A resource type to keep the FAPI configurations.');
('12c78d11-65cd-4b6e-b482-98538ecd7a5c', 'FAPI_CONFIGURATION', 'A resource type to keep the FAPI configurations.'),
('4fed2813-cfa8-40b1-83e6-4ab85d7fcb16', 'DEVICE_MANAGEMENT', 'A resource type to keep tenant level configurations for push authentication');

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

setup other dbs as well

</PushAuthenticator>

<PushDeviceManagement>
<MaxDeviceLimitUpperBound>{{push_device_management.max_device_limit_upper_bound}}</MaxDeviceLimitUpperBound>

@raviendalpatadu raviendalpatadu Jun 23, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Suggested change
<MaxDeviceLimitUpperBound>{{push_device_management.max_device_limit_upper_bound}}</MaxDeviceLimitUpperBound>
<MaxDeviceLimitPerUser>{{push_device_management.max_device_limit_per_user}}</MaxDeviceLimitPerUser>

<Resource context="(.*)/api/server/v1/configs/home-realm-identifiers" secured="true" http-method="GET">
<Scopes>internal_login</Scopes>
</Resource>
<Resource context="(.*)/api/server/v1/configs/preferences" secured="true" http-method="POST">

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

verify with org user

@raviendalpatadu raviendalpatadu force-pushed the configs/preferences_endpoint branch from 638cf5a to 5d5436d Compare June 24, 2026 08:06
@raviendalpatadu raviendalpatadu force-pushed the configs/preferences_endpoint branch from 5d5436d to bdd31dc Compare June 24, 2026 08:25
@sonarqubecloud

Copy link
Copy Markdown

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