Skip to content

Commit 8368803

Browse files
committed
fix(tests): default forceAdvancedAuthentication to false in migrateAndValidate
Migration is a silent token exchange — the browser is never opened, so BW is absent from the post-migration UA regardless of how the initial login was done. Defaulting to false avoids spurious BW assertions in all migration tests. Remove now-redundant explicit false from two DPoPLoginTests callers.
1 parent a8ceed7 commit 8368803

2 files changed

Lines changed: 13 additions & 20 deletions

File tree

native/SampleApps/AuthFlowTester/AuthFlowTesterUITests/Tests/DPoPLoginTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ class DPoPLoginTests: BaseAuthFlowTester {
112112
staticScopeSelection: .subset,
113113
migrationAppConfigName: .ecaJwtDpop,
114114
migrationScopeSelection: .all,
115-
forceAdvancedAuthentication: false,
116115
useDPoP: true
117116
)
118117

@@ -131,7 +130,6 @@ class DPoPLoginTests: BaseAuthFlowTester {
131130
staticAppConfigName: .ecaJwtDpop,
132131
migrationAppConfigName: .ecaJwtDpopRtr,
133132
migrationUseHybridFlow: false,
134-
forceAdvancedAuthentication: false,
135133
useDPoP: true
136134
)
137135

native/SampleApps/AuthFlowTester/AuthFlowTesterUITests/Util/BaseAuthFlowTester.swift

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,10 @@ class BaseAuthFlowTester: XCTestCase {
556556
/// Performs a refresh token migration from the current app configuration to a new one,
557557
/// then validates that the credentials are updated correctly and the refresh token has changed.
558558
///
559+
/// `forceAdvancedAuthentication` defaults to `false` because migration is a silent token
560+
/// exchange — the browser is never opened, so the BW feature marker is not present in the
561+
/// post-migration UA regardless of how the initial login was performed.
562+
///
559563
/// - Parameters:
560564
/// - loginHost: The login host configuration to use.
561565
/// - staticAppConfigName: The static app configuration name.
@@ -564,6 +568,9 @@ class BaseAuthFlowTester: XCTestCase {
564568
/// - migrationScopeSelection: The scope selection for the migration target. Defaults to `.empty`.
565569
/// - migrationUseWebServerFlow: Whether to use web server OAuth flow for migration. Defaults to `true`.
566570
/// - migrationUseHybridFlow: Whether to use hybrid authentication flow for migration. Defaults to `true`.
571+
/// - forceAdvancedAuthentication: Whether to expect the BW flag in the post-migration UA. Defaults to `false`.
572+
/// - useDPoP: Whether DPoP was enabled for this session. Defaults to `false`.
573+
/// - isMultiUser: Whether multiple users are logged in. Defaults to `false`.
567574
func migrateAndValidate(
568575
loginHost: KnownLoginHostConfig,
569576
staticAppConfigName: KnownAppConfig,
@@ -572,37 +579,25 @@ class BaseAuthFlowTester: XCTestCase {
572579
migrationScopeSelection: ScopeSelection = .empty,
573580
migrationUseWebServerFlow: Bool = true,
574581
migrationUseHybridFlow: Bool = true,
575-
forceAdvancedAuthentication: Bool = true,
582+
forceAdvancedAuthentication: Bool = false,
576583
useDPoP: Bool = false,
577584
isMultiUser: Bool = false
578585
) {
579-
// Get original credentials before migration
580586
let originalUserCredentials = mainPage.getUserCredentials()
581-
582-
// Get current user
583587
let user = getKnownUserConfig(loginHost: loginHost, byUsername: originalUserCredentials.username)
584588

585-
586-
// Migrate refresh token
587589
migrateRefreshToken(
588590
appConfigName: migrationAppConfigName,
589591
scopeSelection: migrationScopeSelection,
590592
useWebServerFlow: migrationUseWebServerFlow,
591593
useHybridFlow: migrationUseHybridFlow
592594
)
593595

594-
// Validate after migration.
595-
//
596-
// NB on `useDPoP`: The SDK's Change Key sheet does not expose a DPoP toggle, so the
597-
// migration refresh exchange inherits `SalesforceManager.shared.usesDPoP` from the initial
598-
// login. We forward `useDPoP` here purely to strengthen the intermediate revoke/refresh
599-
// assertion inside `validate` — without it, a DPoP regression during the post-migration
600-
// refresh cycle would go undetected here.
601-
//
602-
// NB on `forceAdvancedAuthentication`: the BW feature marker is not re-registered during
603-
// `migrateRefreshToken` (migration is a silent refresh exchange, not an interactive login).
604-
// Tests that logged in with browser auth should pass `false` here so `expectAdvancedAuth`
605-
// matches the observed post-migration UA (BW absent).
596+
// NB: The SDK's Change Key sheet does not expose a DPoP toggle, so the migration refresh
597+
// exchange inherits `SalesforceManager.shared.usesDPoP` from the initial login. `useDPoP`
598+
// is forwarded here to strengthen the intermediate revoke/refresh assertion inside
599+
// `validate` — without it, a DPoP regression during the post-migration refresh cycle
600+
// would go undetected.
606601
let migratedUserCredentials = validate(
607602
loginHost: loginHost,
608603
user: user,

0 commit comments

Comments
 (0)