* Handle switch messaging
TODO: handle loading state for account switcher
* Async updates required for state
* Fallback to email for current account avatar
* Await un-awaited promises
* Remove unnecessary Prune
Prune was getting confused in browser and deleting memory in browser on
account switch. This method isn't needed since logout already removes
memory data, which is the condition for pruning
* Fix temp password in browser
* Use direct memory access until data is serializable
Safari uses a different message object extraction than firefox/chrome
and is removing `UInt8Array`s. Until all data passed into StorageService
is guaranteed serializable, we need to use direct access in state
service
* Reload badge and context menu on switch
* Gracefully switch account as they log out.
* Maintain location on account switch
* Remove unused state definitions
* Prefer null for state
undefined can be misinterpreted to indicate a value has not been set.
* Hack: structured clone in memory storage
We are currently getting dead objects on account switch due to updating
the object in the foreground state service. However, the storage service
is owned by the background. This structured clone hack ensures that all
objects stored in memory are owned by the appropriate context
* Null check nullable values
active account can be null, so we should include null safety in the
equality
* Correct background->foreground switch command
* Already providing background memory storage
* Handle connection and clipboard on switch account
* Prefer strict equal
* Ensure structuredClone is available to jsdom
This is a deficiency in jsdom --
https://github.com/jsdom/jsdom/issues/3363 -- structured clone is well
supported.
* Fixup types in faker class
* add avatar and simple navigation to header
* add options buttons
* add app-header to necessary pages
* add back button and adjust avatar sizes
* add helper text when account limit reached
* convert magic number to constant
* add clarifying comment
* adjust homepage header styles
* navigate to previousp page upon avatar click when already on '/account-switcher'
* move account UI to own component
* add i18n
* show correct auth status
* add aria-hidden to icons
* use listbox role
* add screen reader accessibility to account component
* more SR a11y updates to account component
* add hover and focus states to avatar
* refactor hover and focus states for avatar
* add screen reader text for avatar
* add slide-down animation on account switcher close
* remove comment
* setup account component story
* add all stories
* move navigation call to account component
* implement account lock
* add button hover effect
* implement account logout
* implement lockAll accounts functionality
* replace 'any' with custom type
* add account switcher button to /home login page
* use <main> tag (enables scrolling)
* change temp server filler name
* temporarily remove server arg from account story
* don't show avatar on /home if no accounts, and don't show 'lock'/'logout' buttons if no currentAccount
* add translation and a11y to /home avatar
* add correct server url to account component
* add 'server' to AccountOption type
* Enabled account switching client-side feature flag.
* add slide-in transition to /account-switcher page
* change capitalization to reflect figma design
* make screen reader read active account email, address more capitalization
* fix web avatar misalignment
* make avatar color based on user settings and in sync with other clients
* make property private
* change accountOptions to availableAccounts for clarity
* refactor to remove 'else' template ref
* remove empty scss rule
* use tailwind instead of scss
* rename isSelected to isActive
* add 'isButton' to /home page avatar
* move files to services folder
* update import
* Remove duplicate active account button
* Move no account button to current-account component
* Always complete logging out
Fixes PM-4866
* make screenreader read off email, not name
* refactor avatar for button case
* Do not next object updates
StateService's init was calling `updateState` at multiple layers,
once overall and then again for each account updated. Because
we were not maintaining a single state object through the
process, it was ending up in a consistent, but incomplete state.
Fixed by returning the updated state everywhere. This very well
may not be all the bugs associated with this
* Treat null switch account as no active user
* Listen for switchAccountFinish before routing (#6950)
* adjust avatar style when wrapped in a button
* show alt text for favicon setting
* move stories to browser
* Send Finish Message on null
* Dynamically set active user when locking all
This is required because some user lock states are not recoverable after
process reload (those with logout timeout). This waits until reload is
occurring, then sets the next user appropriately
* Move Finished Message to Finally Block
Fix tests
* Drop problematic key migration
Fixes PM-4933. This was an instance of foreground/background collision
when writing state. We have several other fallbacks of clearing
these deprecated keys.
* Prefer location to homebrew router service
* Initialize account disk cache from background
Uses the `isRecoveredSession` bool to re-initialize foreground caches
from a background message. This avoids a lengthy first-read for
foregrounds
* PM-4865 - Browser Acct Switcher - only show lock btn for lockable accounts (#6991)
* Lock of active account first, when locking multiple.
Fixes PM-4996
* Fix linter
* Hide lock now for locked users (#7020)
* Hide lock now for locked users
* Prefer disabling button to removing
* Add tooltip to TDE without unlock method
* Load all auth states on state init (#7027)
This is a temporary fix until the owning services can update state
themselves. It uses the presence of an auto key to surmise unlocked
state on init. This is safe since it's run only once on extension start.
* Ps/pm 5004/add load to account switcher (#7032)
* Add load spinner to account switcher
* Remove ul list icons
* Properly size account switcher in popout
* [PM-5005] Prevent Double Navigation (#7035)
* Delete Overriden Method
* Add Lock Transition
* truncate email and server name
* remove account.stories.ts (will add in separate PR)
* Do not switch user at reload if no user is active
* fix prettier issues
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Todd Martin <tmartin@bitwarden.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
* Handle switch messaging
TODO: handle loading state for account switcher
* Async updates required for state
* Fallback to email for current account avatar
* Await un-awaited promises
* Remove unnecessary Prune
Prune was getting confused in browser and deleting memory in browser on
account switch. This method isn't needed since logout already removes
memory data, which is the condition for pruning
* Fix temp password in browser
* Use direct memory access until data is serializable
Safari uses a different message object extraction than firefox/chrome
and is removing `UInt8Array`s. Until all data passed into StorageService
is guaranteed serializable, we need to use direct access in state
service
* Reload badge and context menu on switch
* Gracefully switch account as they log out.
* Maintain location on account switch
* Remove unused state definitions
* Prefer null for state
undefined can be misinterpreted to indicate a value has not been set.
* Hack: structured clone in memory storage
We are currently getting dead objects on account switch due to updating
the object in the foreground state service. However, the storage service
is owned by the background. This structured clone hack ensures that all
objects stored in memory are owned by the appropriate context
* Null check nullable values
active account can be null, so we should include null safety in the
equality
* Correct background->foreground switch command
* Already providing background memory storage
* Handle connection and clipboard on switch account
* Prefer strict equal
* Ensure structuredClone is available to jsdom
This is a deficiency in jsdom --
https://github.com/jsdom/jsdom/issues/3363 -- structured clone is well
supported.
* Fixup types in faker class
Assign ownership to many of the remaining libs/common files.
Criteria for ownership:
* Files used by a single team, is now owned by that team.
* Files related to a domain owned by a team is now owned by that team.
* Where ownership is unclear the "lowest level" service takes ownership.
The latest version of types/node had some breaking changes related to Timer and Timeout, #6739. It turns out that we incorrectly used the type Timer when Timeout was expected in a few places. This PR resolves them, in an effort to unblock the @types/node upgrade.
We missed an await which caused the if statement to never be true. This might have had the effect of not showing a browser integration error message when attempting to unlock should biometrics for some reason be unavailable.
* PM-2041 - (1) Bring over WebauthnApiService + required models from existing #5493 PR (2) Per discussion with Andreas, remove unnecessary methods from WebauthnApiService
* PM-2041 - Rename responses folder to response to match rest of codebase
* PM-2041 - Recreate BaseLoginViaWebAuthnComponent and then web implementation of it.
* PM-2041 - Web routing module - add LoginViaWebAuthnComponent and associated route "login-with-passkey"
* PM-2041 - InjectionTokens - add new navigator credentials injection token which provides the CredentialsContainer interface of the Credential Management API and exposes methods to request credentials and notify the user agent when events such as successful sign in or sign out happen
* PM-2041 - Rename WebauthnApiService & abstraction to WebAuthnLoginApiService
* PM-2041 - Rename WebauthnLoginApiService to WebAuthnAdminApiService
* PM-2041 - Bring over first draft of webauthn-login.service + abstraction; register on jslib-services.module.
* PM-2041 - Bring over web & base login component changes to add login with passkey button if feature flag enabled.
* PM-2041 - WebAuthnAdminApi - update list of TODOs based on conversation with Andreas
* PM-2041 - Login.module - cleanup todo after conversation w/ Andreas
* PM-2041 - Move utils out of web and into common auth/utils and renamed to webauthn-utils
* PM-2041 - Update userDecryptionOptions to support new webauthn prf decryption option
* PM-2041 - (1) Recreate webauthn-login service with updated logic (2) Move files from webauthn to webauthn-login (3) Recreate webauthn-login.strategy with updated logic
* PM-2041 - Remove completed TODO
* PM-2041 - Fix login-via-webauthn component imports + fix name (missing n)
* PM-2041 - Missed this change when renaming LoginViaWebAuthComponent to LoginViaWebAuthnComponent
* PM-2041 - Add WebAuthnLoginApiService to jslib-services.module
* PM-2041 - Remove unused param from WebAuthnLoginApiServiceAbstraction as we aren't supporting non-discoverable passkeys for MVP
* PM-2041 - WebAuthnLoginApiService - remove email and target correct endpoint for getCredentialAssertionOptions(...) call
* PM-2041 - WebAuthnLoginStrategy - (1) Remove unused dep (2) Add safeguard checks to setUserKey(...) logic similar to SSO login strategy
* PM-2041 - BaseLoginViaWebAuthnComponent - Rewrite authenticate logic to use new methods on webAuthnLoginService
* PM-2041 - UserDecryptionOptionsResponse - update naming of webAuthn options object to match server response
* PM-2041 - WebAuthnLoginAssertionResponseRequest - (1) clean up TODO (2) Fix response property name to match server
* PM-2041 - WebAuthnTokenRequest - must stringify device response b/c sending as form data
* PM-2041 - AuthService - Add WebAuthnLoginCredentials and WebAuthnLoginStrategy support to auth service
* PM-2041 - WIP tests for WebAuthnLoginService
* PM-2041 - UserDecryptionOptions - Rename WebAuthnPrfOptions to singular WebAuthnPrfOption to match server
* PM-2041 - Add TODO in login comp
* PM-2041 - (1) Update WebAuthnLoginService.assertCredential(...) to add a check to ensure we cannot leak PRF credentials to the BW server by mistake (2) Add credential to view names for clarity (3) Add JS doc style comments to WebAuthnLoginServiceAbstraction
* PM-2041 - Login.component.html - (1) Center passkey login button (2) Use correct user passkey icon
* PM-2041 - Utils + tests - (1) Add new hexStringToArrayBuffer(...) method (2) Add tests for existing fromBufferToHex(...) (3) Add tests for new hexStringToArrayBuffer(...) method
* PM-2041 - Fix broken import
* PM-2041 - WebAuthnLoginResponseRequest - Adjust warning to be correct
* PM-2041 - Webauthn-utils - createSymmetricKeyFromPrf(...) - add return type
* PM-2041 - WebAuthnLoginService spec file - good progress on figuring out how to test passkey assertion process. Tests are passing, but need to add more setup logic around the MockAuthenticatorAssertionResponse in order to be able to confirm the output is correct.
* PM-2041 - Utils + Utils Spec file changes - (1) Add new fromB64ToArrayBuffer(...) method (2) Add tests for existing fromBufferToB64(...) (3) Add tests for new fromB64ToArrayBuffer(...) method (4) Add round trip conversion tests in both directions
* PM-2041 - Utils.spec - update round trip conversion tests between hex string and array buffer.
* PM-2041 - WebAuthnLoginService.spec - assertCredential(...) happy path test passing
* PM-2041 - WebAuthnLoginAssertionResponseRequest - Add interface
* PM-2041 - WebAuthnLoginAssertionResponseRequest data should be UrlB64 strings per discussion w/ Andreas
* PM-2041 - WebAuthnLoginService Spec file - Per feedback, reverse approaches to generating test data (go from array buffer to b64 strings vs the reverse) to avoid using math.random which can introduce test inconsistency
* PM-2041 - Finish testing assertCredential(...)
* PM-2041 - WebAuthnLoginService tests completed - tested logIn method
* PM-2041 - Login html - add "or" between standard email login and passkey login
* PM-2041 - WebAuthnLoginStrategy test start
* PM-2041 - After rebase - BaseLoginViaWebAuthnComponent - Must rename ForceResetPasswordReason to ForceSetPasswordReason + refactor post login routing logic to match other auth owned flows.
* PM-2401 - Desktop - login comp - fix desktop build
* PM-2041 - Browser - login comp - fix build issue
* PM-2401 - WIP on webauthn-login.strategy testing
* PM-2401 - Finish testing webauthn login strategy
* PM-2041 - WebAuthnAdminApiService renamed to WebAuthnLoginAdminApiService
* PM-2041 - Remove unnecessary comment
* PM-2041 - Per PR feedback, remove noMargin and just add mb-3
* PM-2041 - Per PR feedback, remove unused 2FA and remember email logic (2FA isn't supported right now and we aren't using non-discoverable credentials so we aren't using a user entered email)
* PM-2401 - BaseLoginViaWebAuthnComponent - improve error handling to allow users to retry w/ another passkey
* PM-2401 - Per PR feedback, provide translated message to cover all invalid passkey scenarios.
* PM-2401 - WebAuthnLoginService - per PR feedback, remove unnecessary from
* PM-2041 - WebAuthnLoginCredentialAssertionView - per PR feedback, use actual key type
* PM-2401 - Per PR feedback, remove WebAuthnLoginStrategy constructor as it is identical to its super class constructor
* PM-2041 - WebAuthnLoginService tests - use first value from to improve tests
* PM-2401 - Fix WebAuthnLoginService build issue after changing SymmetricCryptoKey to PrfKey
* PM-2041 - WebAuthnLoginServiceAbstraction remove incorrect undefined from getCredentialAssertionOptions() abstraction
* PM-2041 - Refacor WebAuthn login service tests based on PR feedback
* PM-2041 - Per PR feedback, remove NAVIGATOR_CREDENTIALS injection token and just use WINDOW directly for WebAuthnLoginService
* PM-2041 - WebAuthnLoginServiceAbstraction - per PR feedback, improve assertCredential jsdocs with return info
* PM-2041 - Per PR feedback, update WebAuthnLoginStrategy logInTwoFactor(...) to return an exception if attempted to be called.
* PM-2041 - WebAuthnLoginResponseRequest - per PR feedback, replace fromBufferToB64(...) with fromBufferToUrlB64(...)
* PM-2041 - AssertionOptionsResponse - use doc comment per PR feedback
* PM-2041 - Per PR feedback, adjust location of helpers and mocks in WebAuthnLoginStrategy test file
* PM-2041 - Adjust WebAuthnLoginService tests to take the WebAuthnLoginResponseRequest change to use fromBufferToUrlB64(...) into account to get tests to pass again
* PM-2041 - WebAuthnLoginStrategy - adjust test name to match convention per PR feedback
* PM-2041 - More test tweaks - (1) Rename method (2) Support strict
* PM-2041 - Per PR feedback, AssertionOptionsResponse constructor should null check allowCredentials b/c it is optional
* PM-2041 - Per PR Feedback, remove duplicated fromB64ToArrayBuffer(...) from utils and update tests.
* PM-2041 - Per PR feedback, rename WebAuthnTokenRequest to WebAuthnLoginTokenRequest
* PM-2041 - Per discussion with product and Andreas, add 2FA transition handling just in case we add server support in the future.
* feat: stretch PRF key (#6927)
* feat: stretch PRF key
includes necessary utils -> service refactors
* feat: add tests
* [PM-2041] feat: assertion-options `POST` -> `GET`
* [PM-2041] chore: remove unused properties
* [PM-2041] fix: set private key
* [PM-2041] feat: remove all 2FA related fields
* [PM-2041] chore: clean up 2FA comments
* [PM-2041] chore: document `webauthn-login-prf-crypto.service.abstraction.ts`
* [PM-2041] chore: document webauthn login services
---------
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
* Allow for update logic in state update callbacks
* Prefer reading updates to sending in stream
* Inform state providers when they must deserialize
* Update DefaultGlobalState to act more like DefaultUserState
* Fully Implement AbstractStorageService
* Add KeyDefinitionOptions
* Address PR feedback
* Prefer testing interactions for ports
* Synced memory storage for browser
* Fix port handling
* Do not stringify port message data
* Use messaging storage
* Initialize new foreground memory storage services
This will need to be rethought for short-lived background pages, but for
now the background is the source of truth for memory storage
* Use global state for account service
* Use BrowserApi listener to avoid safari memory leaks
* Fix build errors: debugging and missed impls
* Prefer bound arrow functions
* JSON Stringify Messages
* Prefer `useClass`
* Use noop services
* extract storage observable to new interface
This also reverts changes for the existing services to use
foreground/background services. Those are now used only in state
providers
* Fix web DI
* Prefer initializing observable in constructor
* Do not use jsonify as equality operator
* Remove port listener to avoid memory leaks
* Fix logic and type issues
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Allow for update logic in state update callbacks
* Prefer reading updates to sending in stream
* Inform state providers when they must deserialize
* Update DefaultGlobalState to act more like DefaultUserState
* Fully Implement AbstractStorageService
* Add KeyDefinitionOptions
* Address PR feedback
* More Descriptive Error
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* add server url to account switcher tab
* add serverUrl to SwitcherAccount(s)
* refactor serverUrl getter
* cleanup urls
* adjust styling
* remove SwitcherAccount class
* remove authenticationStatus from AccountProfile
* rename to inactiveAccounts for clarity
* move business logic to environmentService
* use tokenService instead of stateService
* cleanup type and comments
* remove unused property
* replace magic strings
* remove unused function
* minor refactoring
* refactor to use environmentService insead of getServerConfig
* use Utils.getHost() instead of Utils.getDomain()
* create getHost() method
* remove comment
* get base url as fallback
* resolve eslint error
* Update apps/desktop/src/app/layout/account-switcher.component.html
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
---------
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Add StateDefinition
Add a class for encapsulation information about state
this will often be for a domain but creations of this will
exist outside of a specific domain, hence just the name State.
* Add KeyDefinition
This adds a type that extends state definition into another sub-key
and forces creators to define the data that will be stored and how
to read the data that they expect to be stored.
* Add key-builders helper functions
Adds to function to help building keys for both keys scoped
to a specific user and for keys scoped to global storage.
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Add updates$ stream to existing storageServices
Original commit by Matt: 823d9546fe
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Add fromChromeEvent helper
Create a helper that creats an Observable from a chrome event
and removes the listener when the subscription is completed.
* Implement `updates$` property for chrome storage
Use fromChromeEvent to create an observable from chrome
event and map that into our expected shape.
* Add GlobalState Abstractions
* Add UserState Abstractions
* Add Default Implementations of User/Global state
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Add Barrel File for state
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Fix ChromeStorageServices
* Rework fromChromeEvent
Rework fromChromeEvent so we have to lie to TS less and
remove unneeded generics. I did this by caring less about
the function and more about the parameters only.
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Fix UserStateProvider Test
* Add Inner Mock & Assert Calls
* Update Tests to use new keys
Use different key format
* Prefer returns over mutations in update
* Update Tests
* Address PR Feedback
* Be stricter with userId parameter
* Add Better Way To Determine if it was a remove
* Fix Web & Browser Storage Services
* Fix Desktop & CLI Storage Services
* Fix Test Storage Service
* Use createKey Helper
* Prefer implement to extending
* Determine storage location in providers
* Export default providers publicly
* Fix user state tests
* Name tests
* Fix CLI
* Prefer Implement In Chrome Storage
* Remove Secure Storage Option
Also throw an exception for subscribes to the secure storage observable.
* Update apps/browser/src/platform/browser/from-chrome-event.ts
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Enforce state module barrel file
* Fix Linting Error
* Allow state module import from other modules
* Globally Unregister fromChromeEvent Listeners
Changed fromChromeEvent to add its listeners through the BrowserApi, so that
they will be unregistered when safari closes.
* Test default global state
* Use Proper Casing in Parameter
* Address Feedback
* Update libs/common/src/platform/state/key-definition.ts
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Add `buildCacheKey` Method
* Fix lint errors
* Add Comment
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Use Generic in callback parameter
* Refactor Out DerivedStateDefinition
* Persist Listener Return Type
* Add Ticket Link
---------
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* PM-3275 - Policy.service - Refactor existing mapPoliciesFromToken internal logic to provide public mapPolicyFromResponse method
* PM-3275 - Add new PolicyApiService.getMasterPasswordPolicyOptsForOrgUser method for use in the set password comp
* PM-3275 - Update set-password.comp to use new policyApiService.getMasterPasswordPoliciesForInvitedUsers method
* PM-3275 - (1) Remove post TDE AuthN set password routing logic from SSO/2FA comps as we cannot set an initial user password until after decryption in order to avoid losing the ability to decrypt existing vault items (a new user key would be created if one didn't exist in memory) (2) Add set password routing logic post TDE decryption in LoginWithDevice/Lock components (3) Add new ForceResetPasswordReason to capture this case so that we can guard against users manually navigating away from the set password screen
* PM-3275 - SyncSvc - Add logic for setting forcePasswordReset reason if TDE user w/out MP went from not having MP reset permission to having it.
* PM-3275 - Rename ForceResetPasswordReason enum to ForceSetPasswordReason + update all references.
* PM-3275 - Removing client deprecated calls to getPoliciesByInvitedUser and helper call getMasterPasswordPoliciesForInvitedUsers
* PM-3275 - PolicyAPI service - remove no longer necessary getPoliciesByInvitedUser method
* PM-3275 - LockComp - TODO cleanup
* PM-3275 - SSO & 2FA comp - cleanup of incorrect routing path
* PM-3275 - (1) State service refactor - change getForcePasswordResetReason / setForcePasswordResetReason to be getForceSetPasswordReason / setForceSetPasswordReason (2) Sync Service - encapsulate setForceSetPasswordReasonIfNeeded logic into own method
* PM-3275 - SetPassword Comp - Rename "identifier" to be "orgSsoIdentifier" for clarity
* PM-3275 - SetPasswordComp - Moving routing from SSO / 2FA comps to Lock / LoginWithDevice comps results in a loss of the the OrgSsoId. However, as part of the TDE work, we added the OrgSsoId to state so use that as a fallback so we can accurately evaluate if the user needs to be auto enrolled in admin account recovery.
* PM-3275 - SetPasswordComp - add a bit more context to why/when we are reading the user org sso id out of state
* PM-3275 - SetPassword Comp - (1) Add forceSetPasswordReason and ForceSetPasswordReason enum as public props on the class so we can change copy text based on which is set + set forceSetPasswordReason on ngOnInit (2) Refactor ngOnInit to use a single RxJs observable chain for primary logic as the auto enroll check was occurring before the async getUserSsoOrganizationIdentifier could finish.
* PM-3275 - Desktop - App comp - missed replacing getForcePasswordResetReason with getForceSetPasswordReason
* PM-3275 - TDE Decryption Option Comps - must set ForceSetPasswordReason so that we can properly enforce keeping the user on the component + display the correct copy explaining the scenario to the user.
* PM-3275 - All Clients - SetPasswordComp html - Update page description per product + remove no longer used ssoCompleteRegistration translation.
* PM-3275 - SetPasswordComp - hopefully the final puzzle piece - must clear ForceSetPasswordReason in order to let user navigate back to vault.
* PM-3275 - SyncService - Remove check for previous value of account decryption options hasManageResetPasswordPermission as when a user logged in on a trusted device after having their permissions updated, the initial setting would be true and it would cause the flag to NOT be set when it should have.
* PM-3275 - TDE User Context - (1) Remove explicit navigation to set password screen from post decryption success scenarios on lock & login w/ device comps (2) Move TdeUserWithoutPasswordHasPasswordResetPermission flag setting to SSO / 2FA components to support both trusted and untrusted device scenarios (both of which are now caught by the auth guard).
* PM-3275 - (1) SetPassword comp - adjust set password logic for TDE users to avoid creating a new user asymmetric key pair and setting a new private key in memory. (2) Adjust SetPasswordRequest to allow null keys
* PM-3275 - Remove unused route from login with device comp
* PM-3275 - Sso & 2FA comp tests - Update tests to reflect new routing logic when TDE user needs to set a password
* PM-3275 - Lock comp - per PR feedback, remove unused setPasswordRoute property.
* PM-3275 - SetPasswordComp - Per PR feedback, use explicit null check
* PM-3275 - Per PR Feedback, rename missed forcePasswordResetReason to be forceSetPasswordReason on account model
* PM-3275 - Auth guard - rename forcePasswordResetReason to forceSetPasswordReason
* PM-3275 - SSO / 2FA comps - Per PR feedback, refactor Admin Force Password reset handling to be in one place above the TDE user flows and standard user flows as it applies to both.
* PM-3275 - Per PR feedback, clarify 2FA routing comment
* PM-3275 - Per PR feedback, update set-password comp ngOnInit switchMaps to just return promises as switchMap converts promises to observables internally.
* PM-3275 - Per PR feedback, refactor set password ngOnInit observable chain to avoid using async subscribe and instead simply sequence the calls via switchMap and tap for side effects.
* PM-3275 - Per PR feedback, move tap after filter so we can remove if check
* PM-3275 - Per PR feedback, update policy service mapping methods to use shorthand null checking.
* PM-3275 - SetPassword comp - (1) Move force set password reason logic into onSetPasswordSuccess(...) (2) On onSetPasswordSuccess, must set hasMasterPassword to true for user verification scenarios.
* PM-3275 - Per PR feedback, remove new hasManageResetPasswordPermission flag from profile response and instead simply read the information off the existing profile.organizations data as the information I needed was already present.
* PM-4633 - PolicyService - mapPolicyFromResponse(...) - remove incorrect null check for data. Policies with internal null data property should still be evaluated and turned into Policy objects or the policy array ends up having null values in it and it causes errors down the line on login after acct creation.
* Tweak account switcher button
- if it opens a dialog, it should advertise this with `aria-haspopup="dialog"`, not `aria-haspopup="menu"`
- if it opens a dialog, the `aria-expanded` is pointless (as the user will never get back out into the underlying page to check if it's expanded or collapsed, since it's for a dialog not a disclosure widget or menu)
* Make two variants for button to sort out `aria-label` on logged-in case
* Remove `aria-controls` for button
as it's a dialog that opens, not a disclosure, this is irrelevant
* Fix `overlayPostition` typo
* Simplify approach
just use existing single button, but add visually hidden extra "Switch account" to accName
* Tweak account switch buttons in dialog/dropdown
* Take out the confusing "Logged in as..." a11y text
* Use visible button text (with a few extra `sr-only` parts, for readability) as the button's accName
* Add the "Switch account" context to each of the buttons to make clear what they do
* Noop notifications for dev
We rarely have notifications set up for development environments, this
removes the error messages related to missing server notification
services
* Log actions in noop service
* Add line breaks
* Improve log messages
* Ignore local config at all levels
* [PM-3753] Update desktop language handling
* Remove i18n service import aliases
* Validate the provided locale before loading it
* Support underscores in locales
* Split up import/export into separate modules
* Fix routing and apply PR feedback
* Renamed OrganizationExport exports to OrganizationVaultExport
* Make import dialogs standalone and move them to libs/importer
* Make import.component re-usable
- Move functionality which was previously present on the org-import.component into import.component
- Move import.component into libs/importer
Make import.component standalone
Create import-web.component to represent Web UI
Fix module imports and routing
Remove unused org-import-files
* Enable importing on deskop
Create import-dialog
Create file-menu entry to open import-dialog
Extend messages.json to include all the necessary messages from shared components
* Renamed filenames according to export rename
* Make ImportWebComponent standalone, simplify routing
* Pass organizationId as Input to ImportComponent
* use formLoading and formDisabled outputs
* use formLoading & formDisabled in desktop
* Emit an event when the import succeeds
Remove Angular router from base-component as other clients might not have routing (i.e. desktop)
Move logic that happened on web successful import into the import-web.component
* Enable importing on deskop
Create import-dialog
Create file-menu entry to open import-dialog
Extend messages.json to include all the necessary messages from shared components
* use formLoading & formDisabled in desktop
* Add missing message for importBlockedByPolicy callout
* Remove commented code for submit button
* Implement onSuccessfulImport to close dialog on success
* fix table themes on desktop & browser
* fix fileSelector button styles
* update selectors to use tools prefix; remove unused selectors
* update selectors
* Wall off UI components in libs/importer
Create barrel-file for libs/importer/components
Remove components and dialog exports from libs/importer/index.ts
Extend libs/shared/tsconfig.libs.json to include @bitwarden/importer/ui -> libs/importer/components
Extend apps/web/tsconfig.ts to include @bitwarden/importer/ui
Update all usages
* Rename @bitwarden/importer to @bitwarden/importer/core
Create more barrel files in libs/importer/*
Update imports within libs/importer
Extend tsconfig files
Update imports in web, desktop, browser and cli
* import-lastpass wip
* Lazy-load the ImportWebComponent via both routes
* Fix import path for ImportComponent
* add validation; add shared folders field
* clean up logic
* fill fileContent on account change
* Use SharedModule as import in import-web.component
* show spinner on pending validation; properly debounce; refactor to loadCSVData func
* fix pending submit guard
* hide on web, show on desktop & browser
* reset user agent fieldset styles
* fix validation
* File selector should be displayed as secondary
* update validation
* Fix setUserTypeContext always throwing
* refactor to password dialog approach
* remove control on destroy; dont submit on enter keydown
* helper to serialize vault accounts (#6556)
* helper to serialize vault accounts
* prettier
* add prompts
* Add missing messages for file-password-prompt
* Add missing messages for import-error-dialog
* Add missing message for import-success-dialog
* Create client-info
* Separate submit and handling import, add error-handling
* Move catch and error handling into submit
* Remove AsyncValidator logic from handleImport
* Add support for filtering shared accounts
* add sso flow to lp import (#6574)
* stub out some sso flow
* use computer props
* lastpass callback
* baseOpenIDConnectAuthority
* openIDConnectAuthorityBase
* comments
* camelCase user type context model
* processSigninResponse
* Refactor handleImport
* use large dialogSize
* remove extra setUserTypeContext
* fix passwordGenerationService provider; pass all errors to ValidationErrors
* add await SSO dialog & logic
* Move lastpass related files into separate folder
* Use bitSubmit to override submit preventDefault (#6607)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Use large dialogSize
* revert jslib changes
* PM-4398 - Add missing importWarning
* make ui class methods async
* add LastPassDirectImportService
* update error handling
* add OOB methods (manual passcode only)
* fix typo
* respond to SSO callback
* localize error messages
* remove uneeded comment
* update i18n
* add await sso i18n
* add not implemented error to service
* fix getting k2
* fix k1 bugs
* null checks should not be strict
* update awaiting sso dialog
* update approveDuoWebSdk
* refactor oob login flow
* Removing fieldset due to merge of https://github.com/bitwarden/clients/pull/6626
* Refactoring to push logic into the service vs the component
Move all methods related to MFA-UI into a LastPassDirectImportUIService
Move all logic around the import into a LastPassDirectImportService
The component now only has the necessary flows but no knowledge on how to use the lastpass import lib or the need for a OIDC client
* Remove unneeded passwordGenerationService
* move all import logic to service
* apply code review: remove name attributes; use protected fields; use formGroup.value
* rename submit method and add comment
* update textarea id
* update i18n
* remove rogue todo comment
* extract helper asyncValidatorsFinished
* Remove files related to DuoUI we didn't need to differentiate for MFA via Duo
* Add missing import
* revert formGroup.value access
* add email to signInRequest
* add try again error message
* add try again i18n
* consistent clientinfo id (#6654)
---------
Co-authored-by: William Martin <contact@willmartian.com>
* hide on browser
* add lastpass prefix
* add shared i18n copy to web and browser
* rename deeplink
* use protected field
* rename el ids
* refactor: remove nested conditional
* update form ids in consuming client components
* remove unnecessary return statement
* fix file id
* use ngIf
* use hidden because of getElementById
* Remove OIDC lib logging
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com>
* Add support for alias creation via self-hosted SimpleLogin
* Add forwardedSimpleLoginBaseUrl to username-gen-options type
* Only show Server Url on web if on selfhosted bitwarden
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Define account service observable responsibilities
* Establish account service observables and update methods
* Update Account Service observables from state service
This is a temporary stop-gap to avoid needing to reroute all account
activity and status changes through the account service. That can be
done as part of the breakup of state service.
* Add matchers for Observable emissions
* Fix null active account
* Test account service
* Transition account status to account info
* Remove unused matchers
* Remove duplicate class
* Replay active account for late subscriptions
* Add factories for background services
* Fix state service for web
* Allow for optional messaging
This is a temporary hack until the flow of account status can be
reversed from state -> account to account -> state. The foreground
account service will still logout, it's just the background one cannot
send messages
* Fix add account logic
* Do not throw on recoverable errors
It's possible that duplicate entries exist in `activeAccounts` exist
in the wild. If we throw on adding a duplicate account this will cause
applications to be unusable until duplicates are removed it is not
necessary to throw since this is recoverable. with some potential loss
in current account status
* Add documentation to abstraction
* Update libs/common/spec/utils.ts
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Fix justin's comment :fist-shake:
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Split up import/export into separate modules
* Fix routing and apply PR feedback
* Renamed OrganizationExport exports to OrganizationVaultExport
* Make import dialogs standalone and move them to libs/importer
* Make import.component re-usable
- Move functionality which was previously present on the org-import.component into import.component
- Move import.component into libs/importer
Make import.component standalone
Create import-web.component to represent Web UI
Fix module imports and routing
Remove unused org-import-files
* Enable importing on deskop
Create import-dialog
Create file-menu entry to open import-dialog
Extend messages.json to include all the necessary messages from shared components
* Renamed filenames according to export rename
* Make ImportWebComponent standalone, simplify routing
* Pass organizationId as Input to ImportComponent
* use formLoading and formDisabled outputs
* use formLoading & formDisabled in desktop
* Emit an event when the import succeeds
Remove Angular router from base-component as other clients might not have routing (i.e. desktop)
Move logic that happened on web successful import into the import-web.component
* Enable importing on deskop
Create import-dialog
Create file-menu entry to open import-dialog
Extend messages.json to include all the necessary messages from shared components
* use formLoading & formDisabled in desktop
* Add missing message for importBlockedByPolicy callout
* Remove commented code for submit button
* Implement onSuccessfulImport to close dialog on success
* fix table themes on desktop & browser
* fix fileSelector button styles
* update selectors to use tools prefix; remove unused selectors
* update selectors
* Wall off UI components in libs/importer
Create barrel-file for libs/importer/components
Remove components and dialog exports from libs/importer/index.ts
Extend libs/shared/tsconfig.libs.json to include @bitwarden/importer/ui -> libs/importer/components
Extend apps/web/tsconfig.ts to include @bitwarden/importer/ui
Update all usages
* Rename @bitwarden/importer to @bitwarden/importer/core
Create more barrel files in libs/importer/*
Update imports within libs/importer
Extend tsconfig files
Update imports in web, desktop, browser and cli
* Lazy-load the ImportWebComponent via both routes
* Fix import path for ImportComponent
* Use SharedModule as import in import-web.component
* File selector should be displayed as secondary
* Add missing messages for file-password-prompt
* Add missing messages for import-error-dialog
* Add missing message for import-success-dialog
* Use bitSubmit to override submit preventDefault (#6607)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Use large dialogSize
* PM-4398 - Add missing importWarning
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: William Martin <contact@willmartian.com>