[PR #2686] [MERGED] [PM-3394] Fix login with device for passwordless approvals #9880

Closed
opened 2026-04-11 02:30:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2686
Author: @jlf0dev
Created: 8/13/2023
Status: Merged
Merged: 8/15/2023
Merged by: @andrebispo5

Base: feature/pm-1029-tde-loginHead: pm-3394-login-with-device


📝 Commits (9)

  • ec9578d set activeUserId to null when logging in a new account
  • c1f10a3 get token for login with device if approving device doesn't have master key
  • 3dbbb71 add comment
  • 1b9fb69 simplify logic
  • 3b33360 check for route instead of using isAuthenticated
  • f8a9905 use authenticated auth request for tde login with device
  • 34c6cd6 [PM-3394] Add authingWithSso parameter to LoginPasswordlessRequestPage.
  • 233b39c pr feedback
  • 2c35699 [PM-3394] Refactor condition

📊 Changes

11 files changed (+42 additions, -32 deletions)

View changed files

📝 src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs (+2 -2)
📝 src/App/Pages/Accounts/LoginPasswordlessRequestPage.xaml.cs (+2 -1)
📝 src/App/Pages/Accounts/LoginPasswordlessRequestViewModel.cs (+4 -3)
📝 src/App/Pages/Accounts/LoginSsoPageViewModel.cs (+2 -2)
📝 src/Core/Abstractions/IAuthService.cs (+1 -1)
📝 src/Core/Services/AuthService.cs (+8 -4)
📝 src/Core/Services/CryptoService.cs (+2 -2)
📝 src/Core/Services/VaultTimeoutService.cs (+9 -5)
📝 src/iOS.Autofill/CredentialProviderViewController.cs (+4 -4)
📝 src/iOS.Extension/LoadingViewController.cs (+4 -4)
📝 src/iOS.ShareExtension/LoadingViewController.cs (+4 -4)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

If the approving device doesn't have a master key, users should still be able to use Login with Device. This adds a token request in that instance, and sets the user key after.

While investigating this, I discovered that we're not clearing the active user id when adding a new account. This is problematic because isAuthenticated simply checks if the user id is null.
Edit: I originally fixed this by setting the active user Id to null but we can't do that for autofill purposes. Instead I am passing the AuthRequestType to any auth request logic so we know whether to use the Admin Approval logic or Unlock and Authenticate.

I also discovered that our background script to log out inactive accounts was attempting to set the user key if the vault timeout was set to 'never'. This change prevents that from happening as well, simply just returning if we have an auto key without using it.

Code changes

  • file.ext: Description of what was changed and why

Screenshots

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/2686 **Author:** [@jlf0dev](https://github.com/jlf0dev) **Created:** 8/13/2023 **Status:** ✅ Merged **Merged:** 8/15/2023 **Merged by:** [@andrebispo5](https://github.com/andrebispo5) **Base:** `feature/pm-1029-tde-login` ← **Head:** `pm-3394-login-with-device` --- ### 📝 Commits (9) - [`ec9578d`](https://github.com/bitwarden/android/commit/ec9578d2bb1f932fb1da6e48f713190c84af5cea) set activeUserId to null when logging in a new account - [`c1f10a3`](https://github.com/bitwarden/android/commit/c1f10a32efd891702331c4e375dfcd0b6a0d3449) get token for login with device if approving device doesn't have master key - [`3dbbb71`](https://github.com/bitwarden/android/commit/3dbbb71576cc44565a7ad80053453100e86b4a96) add comment - [`1b9fb69`](https://github.com/bitwarden/android/commit/1b9fb695679a326ff98b7d773183a683ed2f8f34) simplify logic - [`3b33360`](https://github.com/bitwarden/android/commit/3b333607e3eee960363f07f675eeb0cb4909579b) check for route instead of using isAuthenticated - [`f8a9905`](https://github.com/bitwarden/android/commit/f8a9905cb24127d2a676d017266523abf52db1f0) use authenticated auth request for tde login with device - [`34c6cd6`](https://github.com/bitwarden/android/commit/34c6cd614aefddfcd7db9a9ca75eb9246ad03bca) [PM-3394] Add authingWithSso parameter to LoginPasswordlessRequestPage. - [`233b39c`](https://github.com/bitwarden/android/commit/233b39c1b5a1279330f3c8bbb8f36e2044df29fe) pr feedback - [`2c35699`](https://github.com/bitwarden/android/commit/2c35699c2f35c8bccf5e3180f09ef763ef26f1bd) [PM-3394] Refactor condition ### 📊 Changes **11 files changed** (+42 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs` (+2 -2) 📝 `src/App/Pages/Accounts/LoginPasswordlessRequestPage.xaml.cs` (+2 -1) 📝 `src/App/Pages/Accounts/LoginPasswordlessRequestViewModel.cs` (+4 -3) 📝 `src/App/Pages/Accounts/LoginSsoPageViewModel.cs` (+2 -2) 📝 `src/Core/Abstractions/IAuthService.cs` (+1 -1) 📝 `src/Core/Services/AuthService.cs` (+8 -4) 📝 `src/Core/Services/CryptoService.cs` (+2 -2) 📝 `src/Core/Services/VaultTimeoutService.cs` (+9 -5) 📝 `src/iOS.Autofill/CredentialProviderViewController.cs` (+4 -4) 📝 `src/iOS.Extension/LoadingViewController.cs` (+4 -4) 📝 `src/iOS.ShareExtension/LoadingViewController.cs` (+4 -4) </details> ### 📄 Description ## Type of change - [x] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> If the approving device doesn't have a master key, users should still be able to use Login with Device. This adds a token request in that instance, and sets the user key after. While investigating this, I discovered that we're not clearing the active user id when adding a new account. This is problematic because `isAuthenticated` simply checks if the user id is `null`. **Edit:** I originally fixed this by setting the active user Id to `null` but we can't do that for autofill purposes. Instead I am passing the `AuthRequestType` to any auth request logic so we know whether to use the Admin Approval logic or Unlock and Authenticate. I also discovered that our background script to log out inactive accounts was attempting to set the user key if the vault timeout was set to 'never'. This change prevents that from happening as well, simply just returning if we have an auto key without using it. ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **file.ext:** Description of what was changed and why ## Screenshots <!--Required for any UI changes. Delete if not applicable--> ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If this change has particular **deployment requirements** - notify the DevOps team --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-11 02:30:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#9880