Skip to content

Add Native Auth V2 email sign-up E2E coverage - #2601

Closed
Disha Janardhan (djanardhan98) wants to merge 8 commits into
AzureAD:devfrom
djanardhan98:djanardhan/native-auth-v2-signup-e2e
Closed

Disha Janardhan (djanardhan98) wants to merge 8 commits into
AzureAD:devfrom
djanardhan98:djanardhan/native-auth-v2-signup-e2e

Conversation

@djanardhan98

@djanardhan98 Disha Janardhan (djanardhan98) commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add 20 enabled Mail.tm-backed Native Auth V2 E2E scenarios: 15 email sign-up scenarios and 5 self-service password reset (SSPR) scenarios.
  • Cover email + OTP and email + password sign-up, supplied and deferred passwords, invalid-code recovery, resend/state reuse, and city/country attributes supplied upfront or after email verification.
  • Add three disabled duplicate-account parity tests that preserve the expected user-already-exists behavior while a known server bug returns code-required.
  • Verify explicit sign-in after sign-up or password reset returns an account and tokens; verify sign-up alone does not create a cached account or issue tokens.
  • Use disposable accounts for password reset so the tests do not change shared lab credentials.
  • Keep OTP comparison failures sanitized: assert that codes differ without including either code in the failure message.

Scope

This is an incremental, passing subset of V2 E2E coverage, not an exhaustive parity suite. The overlapping iOS V2 scenarios have matching expected outcomes; Android additionally checks selected state-reuse, required-attribute metadata, and request/token behavior.

No production code, dependency, Common pointer, pipeline, or existing disabled V2 sign-in suite changes. Multi-screen/partial attributes, invalid-attribute retries, username-based sign-up, optional attributes, MFA, and JIT are outside this PR.

Scenario coverage

Suite Scenarios Count
Email + OTP sign-up Basic sign-up and explicit sign-in; invalid-then-valid OTP on the original state; resend with the returned state; original OTP/original state after resend; invalid-then-valid OTP on the resent state; no automatic sign-in; city/country upfront and deferred 8
Email + password sign-up Supplied password with explicit sign-in or stopping before sign-in; deferred password; deferred-password resend with invalid-code recovery; city/country upfront and deferred; supplied-password resend using the returned state 7
SSPR Reset and explicit sign-in; invalid-then-valid OTP; password-complexity rejection; resend reaching new-password-required; unregistered email returning user-not-found 5

Validation

Recorded live run: September 28, 2026

The local JUnit reports contain:

  • Email + OTP sign-up: 8/8 passed.
  • Email + password sign-up: 7/7 passed.
  • SSPR: 5/5 passed.
  • Total live E2E scenarios: 20/20 passed, with zero failures, errors, or skips.
  • Request recorder unit tests: 4/4 passed.

The subsequent merge from dev did not change these V2 test sources, their fixture/build configuration, relevant production sources, or the Common pointer.

OTP-diagnostic follow-up: September 30, 2026

  • Kotlin test compilation passed.
  • Request recorder unit tests: 4/4 passed.
  • Synthetic equal/different-code checks verified that all five changed OTP comparisons still reject equal codes and omit OTP values from their failure messages.
  • The live E2E suite was not rerun for this assertion-diagnostic-only follow-up; the expected flow outcomes and code-inequality conditions are unchanged.

Disabled duplicate-account parity follow-up: October 8, 2026

  • Added three disabled V1-parity executable specifications: OTP sign-up against an existing OTP account, OTP sign-up against an existing password account, and password sign-up against an existing password account.
  • Each test asserts the expected V2 user-already-exists result and is annotated as disabled because the known server bug currently returns code-required.
  • Kotlin test compilation passed.
  • The three tests were discovered and skipped with zero failures or errors.
  • Request recorder unit tests: 4/4 passed.
  • The enabled live E2E suite was not rerun for this disabled-test-only follow-up; the enabled scenario total remains 20.

Notes

  • The request recorder retains only sanitized endpoint categories, not request URLs, query strings, payloads, or continuation tokens.
  • OTP comparison failures contain a fixed message rather than plaintext codes.
  • Attribute tests verify service-accepted flow completion; directory attribute persistence is not independently queried through Graph.
  • iOS source comparison is not a claim that the iOS tests were executed as part of this validation.

Add Mail.tm-backed coverage for hero scenarios 1a through 1f, including invalid OTP retries, resend state behavior, sign-in-after-sign-up token validation, and proof that sign-up does not sign in implicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add four Mail.tm-backed email and password sign-up scenarios and extract shared V2 sign-up E2E helpers while preserving the six email OTP scenarios.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@djanardhan98 Disha Janardhan (djanardhan98) changed the title Add Native Auth V2 email OTP sign-up E2E coverage Add Native Auth V2 email sign-up E2E coverage Sep 28, 2026
Cover city and country attributes supplied up front or after email verification for both email OTP and email password Native Auth V2 sign-up flows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add five enabled iOS-parity password-reset scenarios using disposable accounts and a supplied-password resend scenario. Preserve existing sign-up coverage and leave disabled V2 sign-in suites unchanged.

Validation: 20 live E2E tests and 4 request-recorder tests passed locally with zero failures or skips. Exclude parity scenarios that exposed unresolved SDK/service or V2 contract differences.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve resend code inequality checks without including OTP values in assertion diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the expected user-already-exists behavior for OTP and password sign-up while the known service bug returns code-required.

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

Copilot-Session: d187a056-8b83-4c74-a4c5-2c2cc043facc

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.

🟢 Approval recommended

The test-only changes provide coherent coverage, sanitize diagnostics, and introduce no unresolved correctness issues.

0 open findings

What changed in this PR

Adds Native Auth V2 end-to-end coverage for email sign-up and password reset flows.

Changes:

  • Adds 20 enabled sign-up and SSPR scenarios plus three disabled parity specifications.
  • Verifies explicit sign-in, token issuance, state reuse, attributes, resend, and error recovery.
  • Adds sanitized request recording and unit tests.
File Description
NativeAuthRequestRecorderTest.kt Tests sanitized request categorization.
NativeAuthRequestRecorder.kt Records endpoint categories without sensitive data.
SSPRV2Test.kt Adds five password-reset scenarios.
SignUpV2EmailPasswordTest.kt Adds password-based sign-up coverage.
SignUpV2EmailOTPTest.kt Adds OTP-based sign-up coverage.
SignUpV2EmailAbstractTest.kt Provides shared sign-up helpers and assertions.
NativeAuthPublicClientApplicationAbstractTest.kt Supports request interceptors in test PCA setup.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@djanardhan98

Copy link
Copy Markdown
Contributor Author

Closing this PR to reopen the same branch and code as a fresh pull request, linked to October work item #3752312.

Silviu Petrescu (spetrescu84) pushed a commit that referenced this pull request Oct 19, 2026
…2618)

## Summary

Unify Native Auth V2 terminal errors under `NativeAuthErrorV2`, matching
AzureAD/microsoft-authentication-library-for-js#8900.

- Remove the operation-specific V2 error classes without deprecated
compatibility wrappers.
- Expose stable classifiers on the shared error, distinguishing rejected
credentials from new-password policy failures and invalid input.
- Preserve service diagnostics, correlation, exceptions, and recoverable
attribute-validation state.
- Keep Native Auth V1 behavior unchanged.

**Breaking V2 API change:** replace operation-specific error type checks
with `NativeAuthErrorV2` and its classifiers.

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

## Dependencies

Requires the paired Common unified-error diagnostics PR:
AzureAD/microsoft-authentication-library-common-for-android#3307.
The Common gitlink points to `3265533f27d8c4054fc5b020ec0228bb872b8344`.
Scopes/claims and OTP-service-validation changes are intentionally
excluded.

## Validation

Errors-only snapshot: **651 selected unit tests passed** (215 MSAL, 346
Common4j, 90 Common Android), with zero failures, errors, or skips in
the final XML reports.
The gate includes shared classifiers, wrong-password versus
invalid-input mappings, diagnostic propagation, and standalone V1
regression coverage.
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.
Live validation was executed against the final stacked errors plus
scopes/claims sources, not the standalone errors snapshot.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
Disha Janardhan (djanardhan98) added a commit that referenced this pull request Oct 21, 2026
## 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](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/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.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
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