Skip to content

Add push-device-mgt endpoints and preferences endpoint - #1138

Merged
ZiyamSanthosh merged 1 commit into
wso2:masterfrom
raviendalpatadu:preference/endpoint
Jul 17, 2026
Merged

Add push-device-mgt endpoints and preferences endpoint #1138
ZiyamSanthosh merged 1 commit into
wso2:masterfrom
raviendalpatadu:preference/endpoint

Conversation

@raviendalpatadu

@raviendalpatadu raviendalpatadu commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces new API endpoints and supporting infrastructure for managing push device management configurations and retrieving configuration preferences in the WSO2 Identity Server. It adds new dependencies, expands the service holder and constants, and defines new models and error codes to support these features.

Key changes include:

API Additions and Enhancements:

  • Added three new API endpoints to ConfigsApi for:
    • Retrieving configuration preferences via a POST to /configs/preferences
    • Retrieving push device management configurations via a GET to /configs/push-device-mgt
    • Updating push device management configurations via a PUT to /configs/push-device-mgt
  • Updated ConfigsApiService interface to include corresponding service methods for the new endpoints

Dependency Management:

  • Introduced dependencies for org.wso2.carbon.identity.notification.push.device.handler and org.wso2.carbon.identity.configuration.mgt.core in relevant pom.xml files to support device management and configuration management features

Service Holder and Constants:

  • Extended ConfigsServiceHolder to provide access to DeviceHandlerService and ConfigurationManager OSGi services, allowing the new endpoints to interact with push device and configuration management logic
  • Introduced ALLOWED_CONFIG_PREFERENCES in Constants.java to define a whitelist for configuration preferences that can be accessed via the new endpoint, specifically allowing certain push authentication device management attributes

Error Handling:

  • Added new error codes and messages in Constants.java for scenarios related to configuration preferences and push device management configuration retrieval and updates

Model Definitions:

  • Added a new model class ConfigAttribute to represent name-value pairs for configuration attributes, supporting the new API's data structures

These changes collectively enable secure and extensible management of push device configurations and configuration preferences through the API, with proper error handling and clear boundaries on what configurations can be accessed or modified.

Related Issues

@CLAassistant

CLAassistant commented Jun 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@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
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers purpose, goals, approach, and a related issue, but it omits most required template sections. Add the missing sections: user stories, developer checklist, release note, documentation, testing, security, samples, related PRs, migrations, test environment, and learning.
Docstring Coverage ⚠️ Warning Docstring coverage is 56.25% 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 clearly matches the main change: adding push-device-mgt and preferences endpoints.
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.

Comment on lines +261 to +264
*/
public static DeviceHandlerService getDeviceHandlerService() {

return DeviceHandlerServiceHolder.SERVICE;

Copy link
Copy Markdown

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
*/
public static DeviceHandlerService getDeviceHandlerService() {
return DeviceHandlerServiceHolder.SERVICE;
public static DeviceHandlerService getDeviceHandlerService() {
if (log.isDebugEnabled()) {
log.debug("Retrieving DeviceHandlerService from OSGi context");
}
return DeviceHandlerServiceHolder.SERVICE;
}

Comment on lines +271 to +274
*/
public static ConfigurationManager getConfigurationManager() {

return ConfigurationManagerHolder.SERVICE;

Copy link
Copy Markdown

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
*/
public static ConfigurationManager getConfigurationManager() {
return ConfigurationManagerHolder.SERVICE;
public static ConfigurationManager getConfigurationManager() {
if (log.isDebugEnabled()) {
log.debug("Retrieving ConfigurationManager from OSGi context");
}
return ConfigurationManagerHolder.SERVICE;
}

Comment on lines +49 to +59
static {
Map<String, Map<String, Set<String>>> allowed = new HashMap<>();

// Push authentication device management configuration.
Map<String, Set<String>> pushAuthResources = new HashMap<>();
pushAuthResources.put(RESOURCE_NAME,
new HashSet<>(Arrays.asList(ATTR_ENABLE_DEVICE_MANAGEMENT, ATTR_MAX_DEVICE_LIMIT)));
allowed.put(RESOURCE_TYPE, Collections.unmodifiableMap(pushAuthResources));

ALLOWED_CONFIG_PREFERENCES = Collections.unmodifiableMap(allowed);
}

Copy link
Copy Markdown

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
static {
Map<String, Map<String, Set<String>>> allowed = new HashMap<>();
// Push authentication device management configuration.
Map<String, Set<String>> pushAuthResources = new HashMap<>();
pushAuthResources.put(RESOURCE_NAME,
new HashSet<>(Arrays.asList(ATTR_ENABLE_DEVICE_MANAGEMENT, ATTR_MAX_DEVICE_LIMIT)));
allowed.put(RESOURCE_TYPE, Collections.unmodifiableMap(pushAuthResources));
ALLOWED_CONFIG_PREFERENCES = Collections.unmodifiableMap(allowed);
}
static {
Map<String, Map<String, Set<String>>> allowed = new HashMap<>();
// Push authentication device management configuration.
Map<String, Set<String>> pushAuthResources = new HashMap<>();
pushAuthResources.put(RESOURCE_NAME,
new HashSet<>(Arrays.asList(ATTR_ENABLE_DEVICE_MANAGEMENT, ATTR_MAX_DEVICE_LIMIT)));
allowed.put(RESOURCE_TYPE, Collections.unmodifiableMap(pushAuthResources));
ALLOWED_CONFIG_PREFERENCES = Collections.unmodifiableMap(allowed);
log.info("Initialized allowed config preferences for resource types: " + allowed.keySet());
}

Comment on lines +2596 to +2600
public List<ConfigPreferenceResp> getConfigPreferences(
List<ConfigPreferenceSearchAttribute> searchAttributes) {

ConfigurationManager configurationManager = ConfigsServiceHolder.getConfigurationManager();
List<ConfigPreferenceResp> responseList = new ArrayList<>();

Copy link
Copy Markdown

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
public List<ConfigPreferenceResp> getConfigPreferences(
List<ConfigPreferenceSearchAttribute> searchAttributes) {
ConfigurationManager configurationManager = ConfigsServiceHolder.getConfigurationManager();
List<ConfigPreferenceResp> responseList = new ArrayList<>();
public List<ConfigPreferenceResp> getConfigPreferences(
List<ConfigPreferenceSearchAttribute> searchAttributes) {
log.info("Retrieving config preferences for " + searchAttributes.size() + " search attribute(s)");
ConfigurationManager configurationManager = ConfigsServiceHolder.getConfigurationManager();

Comment on lines +2657 to +2660
+ ", name: " + resourceName);
}
resource = configurationManager.getResource(resourceType, resourceName);
} catch (ConfigurationManagementException e) {

Copy link
Copy Markdown

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
+ ", name: " + resourceName);
}
resource = configurationManager.getResource(resourceType, resourceName);
} catch (ConfigurationManagementException e) {
resource = configurationManager.getResource(resourceType, resourceName);
} catch (ConfigurationManagementException e) {
log.error("Error occurred while retrieving config preference for resource type: " + resourceType + ", message: " + e.getMessage());
throw handleException(Response.Status.INTERNAL_SERVER_ERROR,

ConfigsServiceHolder.getOAuth2OIDCConfigOrgUsageScopeMgtService();
CompatibilitySettingsService compatibilitySettingsService = ConfigsServiceHolder
.getIdentityCompatibilitySettingsService();
DeviceHandlerService deviceHandlerService = ConfigsServiceHolder.getDeviceHandlerService();

Copy link
Copy Markdown

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
DeviceHandlerService deviceHandlerService = ConfigsServiceHolder.getDeviceHandlerService();
DeviceHandlerService deviceHandlerService = ConfigsServiceHolder.getDeviceHandlerService();
log.debug("Retrieved DeviceHandlerService from ConfigsServiceHolder");

Comment on lines +94 to 96
compatibilitySettingsService,
deviceHandlerService
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 7

Suggested change
compatibilitySettingsService,
deviceHandlerService
);
compatibilitySettingsService,
deviceHandlerService
);
log.info("ServerConfigManagementService instance created successfully");

Comment on lines +359 to +363
@Override
public Response getPushDeviceMgtConfigs() {

return Response.ok().entity(configManagementService.getPushDeviceMgtConfigs()).build();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 8

Suggested change
@Override
public Response getPushDeviceMgtConfigs() {
return Response.ok().entity(configManagementService.getPushDeviceMgtConfigs()).build();
}
@Override
public Response getPushDeviceMgtConfigs() {
log.info("Retrieving push device management configurations");
return Response.ok().entity(configManagementService.getPushDeviceMgtConfigs()).build();
}

Comment on lines +365 to +369
@Override
public Response updatePushDeviceMgtConfigs(PushDeviceMgtConfig pushDeviceMgtConfig) {

return Response.ok().entity(configManagementService.updatePushDeviceMgtConfigs(pushDeviceMgtConfig)).build();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Log Improvement Suggestion No: 9

Suggested change
@Override
public Response updatePushDeviceMgtConfigs(PushDeviceMgtConfig pushDeviceMgtConfig) {
return Response.ok().entity(configManagementService.updatePushDeviceMgtConfigs(pushDeviceMgtConfig)).build();
}
@Override
public Response updatePushDeviceMgtConfigs(PushDeviceMgtConfig pushDeviceMgtConfig) {
log.info("Updating push device management configurations");
return Response.ok().entity(configManagementService.updatePushDeviceMgtConfigs(pushDeviceMgtConfig)).build();
}

@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
#### 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
#### Log Improvement Suggestion No: 7
#### Log Improvement Suggestion No: 8
#### Log Improvement Suggestion No: 9

@raviendalpatadu raviendalpatadu changed the title [Draft] Add push-device-mgt endpoints and preferences endpoint Add push-device-mgt endpoints and preferences endpoint Jun 16, 2026
@raviendalpatadu
raviendalpatadu marked this pull request as ready for review June 16, 2026 08:51

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/factories/ServerConfigManagementServiceFactory.java (1)

43-96: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing null check for pushDeviceHandlerService.

All other OSGi services in this factory have null checks that throw IllegalStateException to fail fast during initialization. The newly added pushDeviceHandlerService lacks this validation, which could result in a null reference being passed to the constructor and cause NPE when service methods are invoked.

Proposed fix
         DeviceHandlerService pushDeviceHandlerService = ConfigsServiceHolder.getPushDeviceHandlerService();

         if (applicationManagementService == null) {
             throw new IllegalStateException("ApplicationManagementService is not available from OSGi context.");
         }
         // ... existing null checks ...

         if (compatibilitySettingsService == null) {
             throw new IllegalStateException("CompatibilitySettingsService is not available from OSGi context.");
         }

+        if (pushDeviceHandlerService == null) {
+            throw new IllegalStateException("DeviceHandlerService is not available from OSGi context.");
+        }
+
         SERVICE = new ServerConfigManagementService(applicationManagementService, identityProviderManager,

Based on learnings: factory classes should use eager static initialization blocks to fail fast if required OSGi services are not available, ensuring consistency across API service factories.

🤖 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.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/factories/ServerConfigManagementServiceFactory.java`
around lines 43 - 96, The pushDeviceHandlerService variable obtained from
ConfigsServiceHolder.getPushDeviceHandlerService() is missing the null
validation that all other OSGi services in this factory have. Add a null check
for pushDeviceHandlerService after it is retrieved, and throw an
IllegalStateException with the message "PushDeviceHandlerService is not
available from OSGi context." if it is null, following the same pattern used for
applicationManagementService, identityProviderManager, corsManagementService,
and all other services in this initialization block.

Source: Learnings

🤖 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.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/Constants.java`:
- Around line 290-292: The constant
ERROR_CODE_CLIENT_ERROR_PUSH_DEVICE_MGT_CONFIG_UPDATE is currently assigned the
error code "60008", which is already in use by
ERROR_CODE_CLIENT_ERROR_ISSUER_USAGE_SCOPE_UPDATE, causing a code duplication
conflict. Replace the error code in
ERROR_CODE_CLIENT_ERROR_PUSH_DEVICE_MGT_CONFIG_UPDATE with a unique, unused
error code to ensure each error constant has a distinct identifier for proper
error contract handling.

---

Outside diff comments:
In
`@components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/factories/ServerConfigManagementServiceFactory.java`:
- Around line 43-96: The pushDeviceHandlerService variable obtained from
ConfigsServiceHolder.getPushDeviceHandlerService() is missing the null
validation that all other OSGi services in this factory have. Add a null check
for pushDeviceHandlerService after it is retrieved, and throw an
IllegalStateException with the message "PushDeviceHandlerService is not
available from OSGi context." if it is null, following the same pattern used for
applicationManagementService, identityProviderManager, corsManagementService,
and all other services in this initialization block.
🪄 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: 71547cbf-d5f0-4409-aca2-47f62b2ee346

📥 Commits

Reviewing files that changed from the base of the PR and between a1a5e23 and c61dca1.

⛔ Files ignored due to path filters (6)
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/ConfigsApi.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/ConfigsApiService.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/model/ConfigAttribute.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/model/ConfigPreferenceRequestDTO.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/model/ConfigPreferenceResponseDTO.java is excluded by !**/gen/**
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/model/PushDeviceMgtConfig.java is excluded by !**/gen/**
📒 Files selected for processing (10)
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/pom.xml
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/ConfigPreferencesAllowlist.java
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/ConfigsServiceHolder.java
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/Constants.java
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/pom.xml
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/core/ServerConfigManagementService.java
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/factories/ServerConfigManagementServiceFactory.java
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/impl/ConfigsApiServiceImpl.java
  • components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/resources/configs.yaml
  • pom.xml

@raviendalpatadu
raviendalpatadu force-pushed the preference/endpoint branch 4 times, most recently from 2af6691 to 5cbd827 Compare June 23, 2026 09:45
return entry.allowedAttributes.contains(attributeName);
}

private static AllowedConfigList findEntry(String resourceType, String resourceName) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

getAllowedConfigs

Resource resource = resolveConfigResource(configurationManager, resourceType, resourceName);

return new ConfigPreferenceResponseDTO()
.resourceType(resourceType)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

format

return result;
}

private static List<DeviceRegistrationNotificationChannel>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
private static List<DeviceRegistrationNotificationChannel>
private static List<DeviceRegistrationNotificationChannel> buildDeviceRegistrationNotificationChannel(
Set<DeviceRegistrationNotificationChannelEnum> channels) {

Add config preferences API and push device management configuration support, and refactor device registration notification channels to use an enum model.
@jenkins-is-staging

Copy link
Copy Markdown

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/29502659871

@jenkins-is-staging

Copy link
Copy Markdown

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/29502659871
Status: success

@jenkins-is-staging jenkins-is-staging 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.

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/29502659871

@ZiyamSanthosh
ZiyamSanthosh merged commit 43df8c6 into wso2:master Jul 17, 2026
3 checks passed
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.

4 participants