generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where non-SSO users are forced into an SSO flow (#951)
- Loading branch information
1 parent
3a02b1d
commit a26d0c7
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,43 @@ final class AuthRouterTests: BitwardenTestCase { // swiftlint:disable:this type_ | |
XCTAssertEqual(route, .enterpriseSingleSignOn(email: "[email protected]")) | ||
} | ||
|
||
/// `handleAndRoute(_ :)` redirects `.accountBecameActive()` to `.vaultUnlock` | ||
/// when the user profile has no user decryption options. | ||
func test_handleAndRoute_accountBecameActive_noUserDecryptionOptions() async { | ||
let active = Account.fixture( | ||
profile: .fixture( | ||
userDecryptionOptions: nil | ||
) | ||
) | ||
stateService.activeAccount = active | ||
|
||
biometricsRepository.biometricUnlockStatus = .success( | ||
.available(.faceID, enabled: true, hasValidIntegrity: false) | ||
) | ||
stateService.isAuthenticated = [ | ||
active.profile.userId: true, | ||
] | ||
authRepository.isLockedResult = .success(true) | ||
|
||
let route = await subject.handleAndRoute( | ||
.accountBecameActive( | ||
active, | ||
animated: true, | ||
attemptAutomaticBiometricUnlock: true, | ||
didSwitchAccountAutomatically: false | ||
) | ||
) | ||
XCTAssertEqual( | ||
route, | ||
.vaultUnlock( | ||
active, | ||
animated: true, | ||
attemptAutomaticBiometricUnlock: true, | ||
didSwitchAccountAutomatically: false | ||
) | ||
) | ||
} | ||
|
||
/// `handleAndRoute(_ :)` redirects `.accountBecameActive()` to `.vaultUnlock` when checking if | ||
/// an account is authenticated fails. | ||
func test_handleAndRoute_accountBecameActive_logout_isAuthenticatedError() async { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters