Skip to content

Phase 2 - Add DeviceRegistrationClientApplication in Common For OneAuth, Fixes AB#3450073#3073

Merged
mohitc1 merged 3 commits intodevfrom
mchand/device-reg-common-2
Apr 10, 2026
Merged

Phase 2 - Add DeviceRegistrationClientApplication in Common For OneAuth, Fixes AB#3450073#3073
mohitc1 merged 3 commits intodevfrom
mchand/device-reg-common-2

Conversation

@mohitc1
Copy link
Copy Markdown
Contributor

@mohitc1 mohitc1 commented Apr 8, 2026

Summary

Introduce DeviceRegistrationClientApplication as a public API for OneAuth consumers to perform device registration operations via IPC. Add DeviceState and DiscoveryEndpoint enums in common4j.

Changes

common4j

  • DeviceState enum — DEVICE_VALID, DEVICE_NOT_FOUND, DEVICE_DISABLED, UNKNOWN with fromString() factory
  • DiscoveryEndpoint enum — PROD, PPE, INT with fromString() factory
  • AbstractDeviceRegistrationProtocolParameters — removed no-arg constructor, added (UUID correlationId) constructor. All V0 param subclasses updated with explicit (correlationId, ...fields) constructors, @AllArgsConstructor removed.
  • TestHappyPathV0Parameters (testFixtures) — updated constructor for correlationId

common (Android)

  • DeviceRegistrationClientApplication — new public API with two constructors:
    • Simple: (Context) — creates defaults for OneAuth consumers
    • Full: (Context, IPlatformComponents, IBrokerDiscoveryClient, DeviceRegistrationIpcStrategiesProvider) — for broker/testing
  • All methods require mandatory correlationId: UUID for IPC request tracing
  • correlationId passed to V0 protocol parameters via constructor

Tests

  • DeviceRegistrationClientApplicationTest (7 tests) — getPreProvisionedBlob, getRegistrationState (valid + unknown), getDeviceRegistrationRecord (found + null), getAllEntries, correlationId propagation
  • Updated serializer and packer tests for new constructor signatures

Companion PR

Broker: https://github.com/identity-authnz-teams/ad-accounts-for-android/pull/144

Fixes AB#3450073

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

❌ Work item link check failed. Description does not contain AB#{ID}.

Click here to Learn more.

@mohitc1 mohitc1 force-pushed the mchand/device-reg-common-2 branch from 6298134 to 27a2b3a Compare April 8, 2026 02:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

✅ Work item link check complete. Description contains link AB#3450073 to an Azure Boards work item.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

❌ Work item link check failed. Description contains AB#3450073 but the Bot could not link it to an Azure Boards work item.

Click here to learn more.

@mohitc1 mohitc1 marked this pull request as ready for review April 8, 2026 03:11
@mohitc1 mohitc1 requested review from a team as code owners April 8, 2026 03:11
Copilot AI review requested due to automatic review settings April 8, 2026 03:11
@mohitc1 mohitc1 changed the title feat: Phase 2 - Add DeviceRegistrationClientApplication, DeviceState,… Phase 2 - Add DeviceRegistrationClientApplication in Common For OneAuth Apr 8, 2026
@github-actions github-actions Bot changed the title Phase 2 - Add DeviceRegistrationClientApplication in Common For OneAuth Phase 2 - Add DeviceRegistrationClientApplication in Common For OneAuth, Fixes AB#3450073 Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new public Android API (DeviceRegistrationClientApplication) to let OneAuth consumers perform device registration operations via broker IPC, and updates the common4j device-registration V0 protocol parameter model to require an explicit correlationId for tracing.

Changes:

  • Added DeviceRegistrationClientApplication (Android) with correlationId-required methods and default dependency wiring for OneAuth consumers.
  • Introduced device registration enums in common4j (DeviceState, discovery-endpoint enum) with fromString() helpers.
  • Refactored common4j device-registration V0 parameter classes to extend a base class with an explicit UUID correlationId constructor; updated impacted tests/fixtures accordingly.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
common4j/src/testFixtures/java/com/microsoft/identity/deviceregistration/testprotocols/TestHappyPathV0Parameters.java Replaced Lombok all-args ctor with explicit ctor that supplies correlationId to base parameters.
common4j/src/test/com/microsoft/identity/deviceregistration/java/packer/DeviceRegistrationProtocolSerializerParameterizedTest.java Updated test fixture construction to include correlationId.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/UnregisterDeviceV0Parameters.java Added explicit ctor with correlationId and base-class chaining.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/ProvisionResourceAccountV0Parameters.java Added explicit ctor with correlationId and base-class chaining.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/PreProvisionedBlobV0Parameters.java Added explicit ctor with correlationId and base-class chaining.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/InstallCertificateSilentlyV0Parameters.java Added explicit ctor with correlationId and base-class chaining.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/GetRegistrationStateV0Parameters.java Added explicit ctor with correlationId and base-class chaining.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/GetInstallWpjCertificateIntentRequestV0Parameters.java Added explicit ctor with correlationId and base-class chaining.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/GetDeviceTokenV0Parameters.java Converted to extend the abstract base parameters and added explicit ctor with correlationId.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/GetDeviceRegistrationRecordV0Parameters.java Added explicit ctor with correlationId and base-class chaining.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/GetDeviceRegistrationRecordsV0Parameters.java Removed no-arg construction path and introduced correlationId ctor (but currently leaves duplicate/unused imports).
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/DeviceRegistrationWithTokensV0Parameters.java Added explicit ctor taking correlationId + registration inputs (discovery endpoint name passed through).
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/DeviceRegistrationPreAuthorizedV0Parameters.java Added explicit ctor taking correlationId + preauthorized inputs.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/AbstractDeviceRegistrationProtocolParameters.java Introduced required correlationId constructor and removed random UUID defaulting.
common4j/src/main/com/microsoft/identity/deviceregistration/java/DrsDiscoveryEndpoint.kt Added discovery-endpoint enum with fromString() normalization behavior.
common4j/src/main/com/microsoft/identity/deviceregistration/java/DeviceState.kt Added device-state enum with fromString() mapping for protocol response values.
common/src/test/java/com/microsoft/identity/deviceregistration/DeviceRegistrationClientApplicationTest.kt Added DRCA unit tests covering several operations + attempted correlationId propagation check.
common/src/test/java/com/microsoft/identity/deviceregistration/AndroidDeviceRegistrationProtocolPackerTest.java Updated test protocol fixture construction to include correlationId.
common/src/test/java/com/microsoft/identity/deviceregistration/AndroidDeviceRegistrationClientControllerTest.kt Updated test fixture construction to include correlationId.
common/src/main/java/com/microsoft/identity/deviceregistration/DeviceRegistrationClientApplication.kt New public API surface for device registration via IPC, requiring correlationId per call.
changelog.txt Added vNext entry for DRCA + enums.

@mohitc1 mohitc1 added the Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR label Apr 8, 2026
… DiscoveryEndpoint

- Create DeviceRegistrationClientApplication in common (public API for OneAuth)
  - All methods take mandatory correlationId: UUID for IPC tracing
  - correlationId passed to V0 protocol parameters via constructor
  - Two constructors: simple (Context) and full (Context, components, discoveryClient, provider)
- Add DeviceState enum in common4j (DEVICE_VALID, DEVICE_NOT_FOUND, DEVICE_DISABLED, UNKNOWN)
- Add DiscoveryEndpoint enum in common4j (PROD, PPE, INT)
- Update AbstractDeviceRegistrationProtocolParameters: remove no-arg constructor,
  add (UUID correlationId) constructor. Remove @AllArgsConstructor from V0 params,
  add explicit constructors with correlationId as first param.
- Add DeviceRegistrationClientApplicationTest (7 tests)
- Update serializer and packer tests for new constructor signatures

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mohitc1 mohitc1 force-pushed the mchand/device-reg-common-2 branch from 27a2b3a to ae4387c Compare April 8, 2026 05:57
@mohitc1 mohitc1 merged commit 4539cfa into dev Apr 10, 2026
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants