Skip to content

Support Native Auth V2 SMS and email JIT enrollment in prototype sample - #63

Merged
Silviu Petrescu (spetrescu84) merged 7 commits into
Azure-Samples:spetrescu/sample-app-v2from
djanardhan98:djanardhan/native-auth-v2-jit-enrollment
Oct 28, 2026
Merged

Silviu Petrescu (spetrescu84) merged 7 commits into
Azure-Samples:spetrescu/sample-app-v2from
djanardhan98:djanardhan/native-auth-v2-jit-enrollment

Conversation

@djanardhan98

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

Copy link
Copy Markdown
Contributor

Summary

Update the SSPR V2 prototype to exercise Android Native Auth V2 SMS/email JIT
enrollment and activation.

  • Reuse the contact screen for V2 and pass the explicitly entered email/phone.
  • Route activation successors back into sign-in, sign-up, reset, MFA, and attribute/
    password collection rather than assuming activation completes sign-in.
  • Hide unsupported JIT resend while preserving real MFA resend.
  • Preserve retry states and use lifecycle-owned coroutines for the touched flows.
  • Replace obsolete operation-specific V2 error references with the unified error API
    already required by the SDK stack.
  • Preserve V1 contact fallback and existing tenant/client configuration.

Dependencies

Base: djanardhan/sspr-v2-prototype.
This is a prototype-only stacked draft, not a release dependency update.
It requires the feature branch djanardhan/native-auth-v2-jit-enrollment in both:

These build on
AzureAD/microsoft-authentication-library-common-for-android#3308 and
AzureAD/microsoft-authentication-library-for-android#2619.
Do not test this against an unrelated released Maven artifact.

Build and manual testing

Use the integrated android-complete build with these feature checkouts.
If they occupy the normal common and msal directories, run from that root:

.\gradlew.bat --configure-on-demand :NativeAuthSample:assembleLocalDebug
adb install -r nativeauthsample\app\build\outputs\apk\local\debug\NativeAuthSample-local-debug.apk

For separate worktrees, use a local uncommitted init script mapping root projects
:common, :common4j, :testutils, :keyvault, :labapi,
:uiautomationutilities, and :LabApiUtilities to the paired Common checkout,
and :msal to the paired MSAL checkout's msal directory.
Keep feed credentials and machine-specific paths outside source control.

Manual device checks:

  1. Sign-in requiring email/SMS registration: choose a method and enter a contact
    different from the username; confirm delivery targets the explicit contact.
  2. Submit a blank contact, correct it, then enroll without restarting.
  3. Submit wrong activation codes, then the correct code on the same screen.
  4. Confirm JIT resend is absent and normal MFA resend still works.
  5. Exercise sign-up continuation into attributes/password recollection and reset
    continuation into new-password entry or explicit sign-in-after-reset.
  6. Confirm chained MFA/registration steps use the returned state and do not prematurely
    report completion.

The service/tenant must actually request enrollment and the desired successors.
No live backend or device validation is claimed by this PR.

Collect explicit email/SMS contacts, route enrollment activation successors, preserve retry states, and migrate prototype unified-error call sites.

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

Copilot-Session: 2d80cc03-5b60-4a9b-a8e7-002370b86465
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2d80cc03-5b60-4a9b-a8e7-002370b86465
Forward optional claims for sign-in, sign-up, and password reset. Request c4 from both email authentication screens and password reset, add claims regression coverage, and retain the current sample authentication configuration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 082bda23-63e7-4de3-a519-20d880daef90
@djanardhan98
Disha Janardhan (djanardhan98) changed the base branch from djanardhan/sspr-v2-prototype to spetrescu/sample-app-v2 October 23, 2026 17:01
@djanardhan98 Disha Janardhan (djanardhan98) changed the title Support Native Auth V2 SMS and email JIT enrollment in prototype sample Support Native Auth V2 SMS and email JIT enrollment in prototype sample, Fixes AB#3729407 Oct 23, 2026
@djanardhan98 Disha Janardhan (djanardhan98) changed the title Support Native Auth V2 SMS and email JIT enrollment in prototype sample, Fixes AB#3729407 Support Native Auth V2 SMS and email JIT enrollment in prototype sample Oct 23, 2026
Resolve overlap with spetrescu/sample-app-v2 by keeping its shared ViewModel and removing the superseded fragment routing. Retain c4 claims and configuration, explicit V2 registration contacts, unsupported JIT-resend handling, and continuation-state retention. Preserve existing scopes and stale-flow guards with regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 082bda23-63e7-4de3-a519-20d880daef90
@djanardhan98
Disha Janardhan (djanardhan98) marked this pull request as ready for review October 23, 2026 19:13
Disha Janardhan (djanardhan98) added a commit to AzureAD/microsoft-authentication-library-common-for-android that referenced this pull request Oct 27, 2026
)

## Summary

Add Android Native Auth V2 SMS/email JIT enrollment and activation.

- Parse server-offered enrollment methods and explicit activation
actions.
- Send channel-specific enrollment payloads and follow the exact server
links with
  the latest continuation token.
- Preserve sign-in, sign-up, and password-reset continuation context,
including
  original sign-up attributes and reset password-update stage.
- Require explicit nonblank contacts, bound automatic SMS risk
verification to one
  hop, and preserve service-owned OTP validation.
- Support JIT OTP resend through the existing resend command/transport,
preserving
the refreshed activation or registration result and originating flow
context.
- Preserve typed attribute-validation and existing-account outcomes when
retained
sign-up attributes are automatically submitted after email verification.
  Rejected attributes retain diagnostics and the current retry state.
- Keep contacts, OTPs, tokens, and URLs out of new log representations.
- Preserve Native Auth V1 behavior; no new capability requirement is
added.

## Cross-platform scope and activation metadata

Enrollment/activation follows the flow in
AzureAD/microsoft-authentication-library-for-objc#3128. JIT OTP resend
is an
intentional addition inspired by
AzureAD/microsoft-authentication-library-for-js#8927;
the referenced iOS implementation does not expose JIT resend.

Android requires a positive integer activation code length and
substitutes `""`
for an absent hint. Unlike the referenced JS implementation, Android
accepts
activation without a resend link; calling resend in that state fails
explicitly
without an HTTP request. Sign-up/password-reset completion still
requires
explicit sign-in; this PR does not add JS-style automatic token
completion.

## Dependencies and merge order

This PR targets `dev`. Merge it before the paired MSAL PR, which pins
the Common
implementation explicitly.

Companion changes:
- MSAL: AzureAD/microsoft-authentication-library-for-android#2623,
  branch `djanardhan/native-auth-v2-jit-enrollment`.
- Sample: Azure-Samples/ms-identity-ciam-native-auth-android-sample#63,
  fork branch `djanardhan98:djanardhan/native-auth-v2-jit-enrollment`.

## Validation

- Latest paired review-fix validation: 38 Common tests passed across
`NativeAuthV2SignUpFlowControllerTest`,
`NativeAuthV2SignUpEnrollmentResumeTest`,
and `NativeAuthV2JitResendTest`; 105 paired MSAL sign-in/sign-up tests
passed.
- New chained regressions cover enrollment -> activation -> email
verification ->
retained attribute submission -> typed rejection, including preserved
diagnostics,
retry using the current attributes token/link, and corrected submission
without
resubmitting the original email. Existing-account classification is also
covered.
- Earlier validation recorded 623 common4j native-auth tests and 108
Common V2
tests passing; those broader selections were not rerun for this review
fix.
- Coverage includes enrollment payloads/HAL contracts, unsupported
methods, contact
validation, current-token/link use, bounded risk verification,
serialization,
original-flow continuation, reset-stage gating, and interrupted sign-up
resumption.
- Full V1 mock-service suites could not run without the existing mock
service.
  Focused passing tests are not a claim of complete live/V1 coverage.


[AB#3797291](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3797291)

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Silviu Petrescu <spetrescu@microsoft.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: 2d80cc03-5b60-4a9b-a8e7-002370b86465
Copilot-Session: 8c889a16-3eb2-4b89-a3b5-0e18a4f28f63
Copilot-Session: f7aefb0c-6e6d-45b0-bbb2-8d819c2e6ef9
Copilot-Session: e11f4730-f731-417d-a0ad-19367f39090c
Enable the existing Resend action for strong-auth verification and forward it to the SDK while retaining refreshed continuation state and stale-flow guards. Update regressions for resend availability, SDK errors and refreshed contact/state handling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 082bda23-63e7-4de3-a519-20d880daef90
Match the compact MFA dialog layout for shared sign-in, sign-up and password-reset code entry. Wrap the dialog content, remove the Cancel bottom anchor and preserve bottom padding. Add rendered-layout coverage for ordinary and MFA/JIT code screens at two viewport heights.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 082bda23-63e7-4de3-a519-20d880daef90
Disha Janardhan (djanardhan98) added a commit to AzureAD/microsoft-authentication-library-for-android that referenced this pull request Oct 27, 2026
…2629)

## Summary

Implement the existing Native Auth V2 strong-auth registration and
verification
states for SMS/email JIT enrollment.

- Wire explicit method/contact enrollment and OTP activation through
Common commands.
- Surface registration from each affected entry and continuation
operation.
- Resume the originating sign-in, sign-up, or password-reset flow after
activation.
- Preserve offered methods, channel, and opaque continuation through
parceling;
  retain existing callback/cancellation and typed-error conventions.
- Support callback and coroutine `resendChallenge()` for JIT OTP resend.
Use the
returned state for subsequent operations, including refreshed method
selection
  when the service returns registration instead of activation.
- Preserve typed attribute-validation and existing-account errors when
sign-up
resumes retained attribute submission after email verification,
including
  diagnostics and the corrected-attribute retry state.
- Keep OTP validation service-side and pin the paired Common
implementation.

## Cross-platform scope and activation metadata

Enrollment/activation follows the flow in
AzureAD/microsoft-authentication-library-for-objc#3128. JIT OTP resend
is an
intentional addition inspired by
AzureAD/microsoft-authentication-library-for-js#8927;
the referenced iOS implementation does not expose JIT resend.

Android requires a positive integer activation code length and
substitutes `""`
for an absent hint. Unlike the referenced JS implementation, Android
accepts
activation without a resend link; calling resend in that state fails
explicitly
without an HTTP request. Every successful transition uses the current
service
links and continuation token. Sign-up/password-reset completion still
requires
explicit sign-in; this PR does not add JS-style automatic token
completion.

## Dependencies and merge order

This PR targets `dev`. Merge the paired Common JIT changes before this
PR.

Common dependency:
AzureAD/microsoft-authentication-library-common-for-android#3315,
branch `djanardhan/native-auth-v2-jit-enrollment`,
commit `9bdaa78729f48dd7229127bacabc0dd2ea9619d5`.

Sample companion:
Azure-Samples/ms-identity-ciam-native-auth-android-sample#63,
fork branch `djanardhan98:djanardhan/native-auth-v2-jit-enrollment`.

## Validation

- Latest paired review-fix validation: 105 MSAL tests passed in
`NativeAuthV2SignInTest` and `NativeAuthV2SignUpTest`; 38 Common tests
passed
across sign-up controller, enrollment resumption, and JIT resend suites.
- New regressions cover resend-to-registration for
sign-in/sign-up/password-reset,
refreshed method selection, retained-attribute rejection/retry, and
existing-account
  classification with preserved service diagnostics.
- Earlier validation recorded 166 MSAL V2 tests and a combined selection
of
205 passes/4 existing skips, plus a sample build. Those were earlier
revisions,
not a claim that the sample or those wider selections were rerun at this
head.
- Wider V1 flow suites require the existing unavailable mock API
service.

The existing shared configuration/runtime rehydration limitation after
process death
is unchanged; this PR does not claim independently executable restored
states without
runtime rehydration.


[AB#3797292](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3797292)

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: 2d80cc03-5b60-4a9b-a8e7-002370b86465
Copilot-Session: 8c889a16-3eb2-4b89-a3b5-0e18a4f28f63
Copilot-Session: f7aefb0c-6e6d-45b0-bbb2-8d819c2e6ef9
Copilot-Session: e11f4730-f731-417d-a0ad-19367f39090c
Route existing-account code and password results through the existing sign-in screens, retain continuation states for submit and resend, and cover retries and stale results. Remove the tenant-specific custom API scope while preserving authentication-context claims.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 082bda23-63e7-4de3-a519-20d880daef90
@spetrescu84
Silviu Petrescu (spetrescu84) merged commit 2fb6837 into Azure-Samples:spetrescu/sample-app-v2 Oct 28, 2026
1 check 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.

2 participants