Introduce Device Policy API - #1152
Draft
kaviska wants to merge 1 commit into
Draft
Conversation
Add a new Device Policy API component exposing device policy field
metadata for the devicePolicy rule flow, optionally filtered by platform.
- GET /device-policies/metadata?platform={android|ios|macos|windows}
returns the rule fields applicable to the given platform. Platform
applicability is resolved from the device field configuration; fields
with no platform restriction apply to all platforms.
- Invalid platform values are rejected with HTTP 400.
- Adds the component to the reactor and to dependency management.
Requires org.wso2.carbon.identity.device.policy from carbon-identity-framework.
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This PR introduces a new Device Policy REST API (
/api/server/v1/device-policies) to the Identity Server API Server layer. It exposes device policy rule field metadata over HTTP so that the console rule builder can be populated with the fields applicable to a given device platform. Rule field metadata for thedevicePolicyflow is served by the flow-agnosticRuleMetadataService, while platform applicability is device domain knowledge owned bycarbon-identity-framework; this component composes the two so thatrule-mgtnever has to learn about device platforms.Goals
Expose platform-aware device policy field metadata through a versioned (
v1) REST API:devicePolicyflow.android,ios,macos,windows) so that platform-irrelevant fields are not offered to the user.400rather than silently returning a partial list.Approach
A new Maven component
org.wso2.carbon.identity.api.server.device.policyis added with two modules, following the established API-server conventions:.common– sharedConstants(error codes with theDPM-prefix) andDevicePolicyMetadataServiceHolder, which resolves theRuleMetadataServiceandDeviceFieldMetadataServiceOSGi services from the Carbon context..v1– the versioned API:device-policy.yaml– the OpenAPI 3.0 contract; thesrc/geninterfaces and models are generated from it.DevicePoliciesApiServiceImpl– JAX-RS delegate; maps the core service result to a200response.DevicePolicyMetadataService(core) – resolves the tenant domain from context, retrieves theDEVICE_POLICYfield definitions fromRuleMetadataService, applies the platform filter, and translates the framework models into the API models.DevicePolicyMetadataServiceFactory– constructor-injects both OSGi services into the core service once at startup, failing fast if either is unavailable.DevicePolicyAPIErrorBuilder– centralizes error construction, mapping request validation failures to 400 and metadata retrieval failures to 500.The component is registered in the reactor and in
dependencyManagementin the rootpom.xml; no existing module is modified. The endpoint is guarded by theinternal_device_policy_viewscope.User stories
Developer Checklist (Mandatory)
product-isissue to track any behavioral change or migration impact.Release note
N/A
Documentation
N/A
Training
N/A
Certification
N/A
Marketing
N/A
Automation tests
N/A
Security checks
Samples
N/A
Related PRs
This PR depends on the new
org.wso2.carbon.identity.device.policycomponent incarbon-identity-framework, which is not yet published to the WSO2 Maven repository.Migrations (if applicable)
N/A – new API, no migration required.
Test environment
N/A
Learning
N/A