Skip to content

Commit

Permalink
PM-3169 - Per discussion w/ Jake and Justin, rename login-initiated g…
Browse files Browse the repository at this point in the history
…uard to be tde decryption required guard (more named for functionality vs specific route)
  • Loading branch information
JaredSnider-Bitwarden committed Aug 2, 2023
1 parent 268c8fa commit 32f0201
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
7 changes: 5 additions & 2 deletions apps/browser/src/popup/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ActivatedRouteSnapshot, RouteReuseStrategy, RouterModule, Routes } from

import { AuthGuard } from "@bitwarden/angular/auth/guards/auth.guard";
import { lockGuard } from "@bitwarden/angular/auth/guards/lock.guard";
import { loginInitiatedGuard } from "@bitwarden/angular/auth/guards/login-initiated.guard";
import { tdeDecryptionRequiredGuard } from "@bitwarden/angular/auth/guards/tde-decryption-required.guard";
import { UnauthGuard } from "@bitwarden/angular/auth/guards/unauth.guard";
import { canAccessFeature } from "@bitwarden/angular/guard/feature-flag.guard";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
Expand Down Expand Up @@ -108,7 +108,10 @@ const routes: Routes = [
{
path: "login-initiated",
component: LoginDecryptionOptionsComponent,
canActivate: [loginInitiatedGuard(), canAccessFeature(FeatureFlag.TrustedDeviceEncryption)],
canActivate: [
tdeDecryptionRequiredGuard(),
canAccessFeature(FeatureFlag.TrustedDeviceEncryption),
],
},
{
path: "sso",
Expand Down
7 changes: 5 additions & 2 deletions apps/desktop/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { RouterModule, Routes } from "@angular/router";

import { AuthGuard } from "@bitwarden/angular/auth/guards/auth.guard";
import { lockGuard } from "@bitwarden/angular/auth/guards/lock.guard";
import { loginInitiatedGuard } from "@bitwarden/angular/auth/guards/login-initiated.guard";
import { redirectGuard } from "@bitwarden/angular/auth/guards/redirect.guard";
import { tdeDecryptionRequiredGuard } from "@bitwarden/angular/auth/guards/tde-decryption-required.guard";
import { canAccessFeature } from "@bitwarden/angular/guard/feature-flag.guard";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";

Expand Down Expand Up @@ -54,7 +54,10 @@ const routes: Routes = [
{
path: "login-initiated",
component: LoginDecryptionOptionsComponent,
canActivate: [loginInitiatedGuard(), canAccessFeature(FeatureFlag.TrustedDeviceEncryption)],
canActivate: [
tdeDecryptionRequiredGuard(),
canAccessFeature(FeatureFlag.TrustedDeviceEncryption),
],
},
{ path: "register", component: RegisterComponent },
{
Expand Down
7 changes: 5 additions & 2 deletions apps/web/src/app/oss-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Route, RouterModule, Routes } from "@angular/router";

import { AuthGuard } from "@bitwarden/angular/auth/guards/auth.guard";
import { lockGuard } from "@bitwarden/angular/auth/guards/lock.guard";
import { loginInitiatedGuard } from "@bitwarden/angular/auth/guards/login-initiated.guard";
import { redirectGuard } from "@bitwarden/angular/auth/guards/redirect.guard";
import { tdeDecryptionRequiredGuard } from "@bitwarden/angular/auth/guards/tde-decryption-required.guard";
import { UnauthGuard } from "@bitwarden/angular/auth/guards/unauth.guard";
import { canAccessFeature } from "@bitwarden/angular/guard/feature-flag.guard";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
Expand Down Expand Up @@ -77,7 +77,10 @@ const routes: Routes = [
{
path: "login-initiated",
component: LoginDecryptionOptionsComponent,
canActivate: [loginInitiatedGuard(), canAccessFeature(FeatureFlag.TrustedDeviceEncryption)],
canActivate: [
tdeDecryptionRequiredGuard(),
canAccessFeature(FeatureFlag.TrustedDeviceEncryption),
],
},
{
path: "register",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.se
* Only allow access to this route if the vault is locked and has never been decrypted.
* Otherwise redirect to root.
*/
export function loginInitiatedGuard(): CanActivateFn {
export function tdeDecryptionRequiredGuard(): CanActivateFn {
return async (_: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
const authService = inject(AuthService);
const cryptoService = inject(CryptoService);
Expand Down

0 comments on commit 32f0201

Please sign in to comment.