Skip to content

Migrate Native Auth test email provider to Mail.tm, Fixes AB#3720943 - #3219

Merged
Disha Janardhan (djanardhan98) merged 4 commits into
devfrom
djanardhan/mail-tm-native-auth-e2e-clean
Aug 24, 2026
Merged

Migrate Native Auth test email provider to Mail.tm, Fixes AB#3720943#3219
Disha Janardhan (djanardhan98) merged 4 commits into
devfrom
djanardhan/mail-tm-native-auth-e2e-clean

Conversation

@djanardhan98

@djanardhan98 Disha Janardhan (djanardhan98) commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace the Native Auth 1secmail inbox integration with authenticated Mail.tm mailboxes.
  • Pass the Mail.tm password through the existing Gradle BuildConfig/BuildValues pattern without committing credentials.
  • Add checkpoint-aware OTP polling, resend handling, MIME-aware OTP extraction, and bounded retries.
  • Force HTTP/1.1 for compatibility with the existing OkHttp client and Mail.tm.
  • Remove obsolete 1secmail response models and add regression coverage for the Mail.tm transport and inbox behavior.

Motivation

Native Auth end-to-end tests need both dynamically created signup inboxes and an authenticated persistent inbox for SSPR. Mail.tm supports both workflows, while the previous unauthenticated 1secmail integration cannot support the persistent SSPR mailbox used by the re-enabled tests.

Validation

  • .\gradlew.bat :testutils:clean :testutils:assembleDebug :testutils:testDebugUnitTest --no-daemon: passed locally.
  • All MSAL tests passed after applying the corresponding MSAL changes against Common commit ddb306a3884f9621e53b6eb3256fc14ea1497c7c.
  • The corresponding MSAL changes will be submitted in a separate PR.

Pipeline configuration

  • The MSAL consumer-validation task passes the secured Azure DevOps variable EMAIL_PROVIDER_PASSWORD from the pipeline's linked variable groups to Common as -PemailProviderPassword=$(EMAIL_PROVIDER_PASSWORD); Common exposes it through generated BuildConfig and BuildValues without committing the secret.

Related work

Merge sequencing

This PR is the expand step of a cross-repository migration: it temporarily retains generateRandomEmailAddressLocally() so both dev branches remain buildable. After AzureAD/microsoft-authentication-library-for-android#2553 migrates callers to createRandomEmailAddress() or generateRandomUnregisteredEmailAddress() and merges, the compatibility method will be removed in a Common follow-up.

@djanardhan98
Disha Janardhan (djanardhan98) force-pushed the djanardhan/mail-tm-native-auth-e2e-clean branch from 828e850 to ddb306a Compare August 14, 2026 07:41
@djanardhan98
Disha Janardhan (djanardhan98) marked this pull request as ready for review August 14, 2026 08:27
Copilot AI lite review requested due to automatic review settings August 14, 2026 08:27

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.

Pull request overview

This pull request migrates Native Auth end-to-end test email handling from the unauthenticated 1secmail integration to Mail.tm, aligning the testutils infrastructure with workflows that require authenticated and persistent inbox access while keeping secrets out of source control via the existing Gradle BuildConfig/BuildValues pattern.

Changes:

  • Replaced the temporary email provider implementation with a Mail.tm-backed transport + API wrapper, including authenticated inbox creation, OTP polling/checkpointing, and MIME-aware OTP extraction.
  • Removed obsolete 1secmail response models and added unit tests covering Mail.tm transport behavior and inbox/OTP retrieval logic.
  • Wired the email provider password through Gradle build config and CI pipeline parameters.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
testutils/src/test/java/com/microsoft/identity/internal/testutils/nativeauth/api/TemporaryEmailServiceTest.kt Adds focused unit tests for Mail.tm transport, checkpointed polling, OTP extraction, and retry behavior.
testutils/src/main/java/com/microsoft/identity/internal/testutils/nativeauth/api/TemporaryEmailService.kt Replaces the 1secmail implementation with authenticated Mail.tm inbox lifecycle, polling logic, and an OkHttp-based transport forced to HTTP/1.1.
testutils/src/main/java/com/microsoft/identity/internal/testutils/nativeauth/api/models/InboxContent.kt Removes obsolete 1secmail inbox response model.
testutils/src/main/java/com/microsoft/identity/internal/testutils/nativeauth/api/models/EmailContent.kt Removes obsolete 1secmail email response model.
common4j/src/testFixtures/java/com/microsoft/identity/common/nativeauth/ApiConstants.kt Updates the temporary mail service base URL to Mail.tm.
common4j/src/main/com/microsoft/identity/common/java/nativeauth/BuildValues.java Exposes the Mail.tm password via BuildValues.getEmailProviderPassword().
common4j/build.gradle Adds the emailProviderPassword Gradle property and surfaces it via generated BuildConfig.
changelog.txt Records the migration in vNext.
azure-pipelines/pull-request-validation/build-consumers.yml Passes EMAIL_PROVIDER_PASSWORD into the Gradle invocation for consumer validation.

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

Replace the 1secmail test integration with authenticated Mail.tm inboxes, checkpoint-aware OTP polling, compatibility APIs, and regression coverage. Pass the provider password through the existing secured build configuration path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@djanardhan98
Disha Janardhan (djanardhan98) force-pushed the djanardhan/mail-tm-native-auth-e2e-clean branch from ddb306a to 40ad51c Compare August 14, 2026 18:13
Disha Janardhan (djanardhan98) added a commit to AzureAD/microsoft-authentication-library-for-android that referenced this pull request Aug 14, 2026
Point the Common submodule at the latest commit from AzureAD/microsoft-authentication-library-common-for-android#3219.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread common4j/build.gradle Outdated

@fadidurah fadidurah 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.

LGTM, special emphasis on porting the build.gradle property to our weekly and monthly pipeline

Comment thread common4j/build.gradle Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83947e30-5bc9-4ec7-a8ed-c03d4415da92
@djanardhan98

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

…ive-auth-e2e-clean

Co-authored-by: djanardhan98 <307255345+djanardhan98@users.noreply.github.com>
auto-merge was automatically disabled August 18, 2026 18:51

Head branch was pushed to by a user without write access

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved by merging origin/dev into this branch and updating the PR branch tip in commit 294bfae.

@djanardhan98

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

…ive-auth-e2e-clean

Co-authored-by: djanardhan98 <307255345+djanardhan98@users.noreply.github.com>
auto-merge was automatically disabled August 24, 2026 07:39

Head branch was pushed to by a user without write access

Copilot AI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved by merging origin/dev into this branch in commit cc558c6.

@djanardhan98
Disha Janardhan (djanardhan98) merged commit 6cbee72 into dev Aug 24, 2026
29 checks 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.

6 participants