Migrate Native Auth test email provider to Mail.tm, Fixes AB#3720943 - #3215
Migrate Native Auth test email provider to Mail.tm, Fixes AB#3720943#3215Disha Janardhan (djanardhan98) wants to merge 10 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
90a68a7 to
da8d585
Compare
Mail.tm resets HTTP/2 streams used by the legacy OkHttp client. Restrict the test transport to HTTP/1.1 and cover the protocol configuration with a regression test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Work item link check complete. Description contains link AB#3720943 to an Azure Boards work item. |
Model Mail.tm response fields as nullable at the JSON boundary, skip incomplete entries, and add regression coverage. Add the PR changelog entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
testutils/src/main/java/com/microsoft/identity/internal/testutils/nativeauth/api/TemporaryEmailService.kt:95
- Authentication performs a Mail.tm network request before the bounded retry loop. A transient
/tokenfailure therefore fails the E2E flow immediately, even though equivalent transient/messagesand/sourcesfailures are retried; this is especially relevant to the linked SSPR tests, which no longer wrap the flow in their previous outer retry. Move token acquisition into the retry policy (while still failing immediately for blank credentials/permanent auth errors).
val token = state.token ?: authenticate(emailAddress).also { state.token = it }
testutils/src/main/java/com/microsoft/identity/internal/testutils/nativeauth/api/TemporaryEmailService.kt:180
- This treats a MIME text part as already decoded, but
/sources/{id}returns raw message source and valid text parts may useContent-Transfer-Encoding: base64orquoted-printable. In those cases the OTP is not present as literal digits and polling times out. Parse the selected MIME part's headers and decode its transfer encoding before applying the OTP regex; add encoded-part regression cases.
val textPart = TEXT_PART_REGEX.find(body)
if (textPart != null) {
body = textPart.groupValues[1]
}
return FALLBACK_OTP_REGEX.find(body)?.groupValues?.get(1)
Co-authored-by: djanardhan98 <307255345+djanardhan98@users.noreply.github.com>
Preserve zero-argument construction for downstream MSAL consumers while sourcing the Mail.tm password from BuildValues. Add regression coverage for the compatibility API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep downstream consumers buildable while MSAL migrates to the explicit Mail.tm address APIs. Add regression coverage for authenticated inbox creation through the compatibility bridge. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Copilot resolve the merge conflicts in this pull request |
…ive-auth-e2e Co-authored-by: djanardhan98 <307255345+djanardhan98@users.noreply.github.com>
Resolved the merge conflicts by merging |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
testutils/src/main/java/com/microsoft/identity/internal/testutils/nativeauth/api/TemporaryEmailService.kt:208
[^\r\n]*treats every line afterContent-Typeas another header. Because that repetition is greedy, a text part containing a blank paragraph (for example, the OTP in the first paragraph followed by\r\n\r\nThanks) is parsed from the last blank line, so the OTP is discarded and polling eventually fails. Restrict the repeated lines to actual MIME headers/folded continuations, and add a regression case with a multi-paragraph text part.
"Content-Type:\\s*text/(?:plain|html)[^\\r\\n]*(?:\\r?\\n[^\\r\\n]*)*\\r?\\n\\r?\\n(.*?)(?=\\r?\\n--|$)",
Supply the secured email provider password when validating the Common branch against MSAL dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
BuildConfig/BuildValuespattern without committing credentials.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.devwith this Common working tree,./gradlew.bat :msal:compileLocalDebugUnitTestKotlin --no-daemon: passed locally.SSPRTest: 7 tests executed locally with 0 failures and 1 intentional skip.Pipeline configuration
EMAIL_PROVIDER_PASSWORDfrom the pipeline's linked variable groups to Common as-PemailProviderPassword=$(EMAIL_PROVIDER_PASSWORD); Common exposes it through generatedBuildConfigandBuildValueswithout committing the secret.Related work
Merge sequencing
This PR is the expand step of a cross-repository migration: it temporarily retains
generateRandomEmailAddressLocally()so bothdevbranches remain buildable. After AzureAD/microsoft-authentication-library-for-android#2553 migrates callers tocreateRandomEmailAddress()orgenerateRandomUnregisteredEmailAddress()and merges, the compatibility method will be removed in a Common follow-up.