Skip to content

Add Native Auth V2 authorize scopes and claims, Fixes AB#3784690 - #2624

Merged
Disha Janardhan (djanardhan98) merged 15 commits into
devfrom
djanardhan/native-auth-v2-authorize-inputs
Oct 21, 2026
Merged

Disha Janardhan (djanardhan98) merged 15 commits into
devfrom
djanardhan/native-auth-v2-authorize-inputs

Conversation

@djanardhan98

@djanardhan98 Disha Janardhan (djanardhan98) commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Port Android Native Auth V2 authorize-request inputs and related OTP parity from AzureAD/microsoft-authentication-library-for-js#8898.

  • Accept optional scopes and typed claims for sign-up and password reset, and propagate inputs for all three V2 entry points.
  • Snapshot callback inputs and preserve existing cancellation, callback delivery, and password clearing.
  • Preserve entry scopes when continuation scopes are absent; allow explicitly empty continuation scopes to select default OIDC scopes.
  • Submit empty/short first-factor and MFA OTPs to the service for validation rather than reject them locally.
  • Preserve Native Auth V1 behavior and existing password-to-email fallback.

Approved wire policy: send scopes and optional claims on the initial authorize-challenge; send scopes but no claims on token exchange. Intermediate requests send neither. This intentionally follows JS behavior rather than the work item's literal entry-only scope wording.

Fixes AB#3784690

Dependencies

Stacked on the separate MSAL unified-errors PR: #2618. Its base is the errors branch so this diff contains only the scopes/claims workstream.
Requires the paired Common authorize-inputs PR: AzureAD/microsoft-authentication-library-common-for-android#3308.
The Common gitlink points to b41473a29fd7e519108b0630526e652996e38f9f.
Merge the errors dependencies first, then retarget this PR to dev.

Validation

Scopes/claims snapshot: 661 selected unit tests passed (218 MSAL, 349 Common4j, 94 Common Android), with zero failures, errors, or skips in the final XML reports.
Coverage includes all three initial entries, callback input snapshots, continuation scope retention/override, canonical OIDC defaults on entry and token requests, empty/short OTP service submission, and standalone V1 regressions.
Final integrated-stack PR2601 validation: 20 live signup/reset E2E tests and 4 recorder tests passed, with 3 known duplicate-account service-test skips. One Mail.tm /accounts HTTP 429 attempt passed on the existing automatic retry; no assertions or retry configuration were changed.

The live fixture overlay comes from #2601 and is not included in this feature PR.

Fixes AB#3784695

Remove operation-specific V2 error classes without deprecated wrappers. Preserve recoverable states and raw diagnostics; distinguish credentials from new-password policy. Pair with the Common diagnostic-propagation commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784695

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784690

Thread typed entry claims and scopes through public APIs and adapters, snapshot callback inputs, and retain null-versus-empty continuation semantics. Include JS8898 empty/short OTP service-validation parity. Token retains scope and omits claims; V1 is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784695

Rejected credentials are invalid credentials; empty password input is invalid input. Use independently validated Common diagnostic-forwarding repair.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784695

Rejected credentials are invalid credentials; empty password input is invalid input. Use independently validated Common diagnostic-forwarding repair.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
(cherry picked from commit 7ac5b2d)
Fixes AB#3784690

Use the Common scope-canonicalization fix validated with MSAL/Common focused suites; retain carried unified-error repair and existing scopes/claims wire policy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784690

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Preserve service trace IDs, timestamps, and numeric codes across V2 public error mappings. Keep password-policy classification independent of credential classification, correct sign-up documentation, and pair the updated Common commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
Resolve the Common submodule conflict with the paired authorize-inputs merge, retaining scopes, claims, and current unified-error diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
@djanardhan98 Disha Janardhan (djanardhan98) added the changelog:none No changelog entry or version increment is required. label Oct 19, 2026
@djanardhan98
Disha Janardhan (djanardhan98) marked this pull request as ready for review October 19, 2026 20:10
@djanardhan98
Disha Janardhan (djanardhan98) changed the base branch from djanardhan/native-auth-v2-unified-errors to dev October 20, 2026 16:30
Preserve Native Auth V2 scopes, claims, and service-side OTP validation while resolving conflicts with dev. Update Common to 0bf4510df6fd0257fb359267635223640ce31dcb.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 15870531-a0a1-4433-91b7-7cde867b4083
Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:32

Copilot AI 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.

🟡 Changes recommended

Claims snapshot failures can bypass callback delivery and leave owned password copies uncleared.

1 open issue
What changed in this PR

Adds scopes and typed claims support to Native Auth V2 entry flows, alongside the paired Common changes, while preserving V1 behavior.

Changes:

  • Propagates authorize inputs and snapshots mutable callback parameters.
  • Delegates empty OTP validation to the service.
  • Adds regression coverage and documents continuation scope behavior.
File Description
msal/​src/​test/​java/​com/​microsoft/​identity/​nativeauth/​v2/​NativeAuthV2SignUpTest.kt Tests scope and claims snapshots.
msal/​src/​test/​java/​com/​microsoft/​identity/​nativeauth/​v2/​NativeAuthV2SignInTest.kt Tests snapshots and MFA OTP submission.
msal/​src/​test/​java/​com/​microsoft/​identity/​nativeauth/​v2/​NativeAuthV2InterfaceKotlinTest.kt Tests input propagation, V1 compatibility, and OTP submission.
msal/​src/​main/​java/​com/​microsoft/​identity/​nativeauth/​statemachine/​states/​MFAVerificationRequiredStateV2.kt Removes local empty-challenge rejection.
msal/​src/​main/​java/​com/​microsoft/​identity/​nativeauth/​statemachine/​states/​CodeRequiredStateV2.kt Removes local empty-code rejection.
msal/​src/​main/​java/​com/​microsoft/​identity/​nativeauth/​parameters/​NativeAuthSignUpParameters.kt Adds optional scopes and claims.
msal/​src/​main/​java/​com/​microsoft/​identity/​nativeauth/​parameters/​NativeAuthSignInContinuationParameters.kt Documents continuation input semantics.
msal/​src/​main/​java/​com/​microsoft/​identity/​nativeauth/​parameters/​NativeAuthResetPasswordParameters.kt Adds optional scopes and claims.
msal/​src/​main/​java/​com/​microsoft/​identity/​nativeauth/​NativeAuthPublicClientApplication.kt Propagates and snapshots entry inputs.
msal/​src/​main/​java/​com/​microsoft/​identity/​client/​internal/​CommandParametersAdapter.java Adds scopes-and-claims adapter overloads.
changelog Documents V2 authorize-input behavior.

Review effort: Balanced

Return CLIENT_EXCEPTION results on the PCA scope when synchronous input snapshots fail. Clear owned password copies immediately on snapshot failure or cancellation without modifying caller buffers, and preserve callback exception routing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 15870531-a0a1-4433-91b7-7cde867b4083
@djanardhan98
Disha Janardhan (djanardhan98) merged commit 7182c97 into dev Oct 21, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:none No changelog entry or version increment is required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants