mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
[PM-4348] Migrate AuthGuards to functions (#9595)
* Migrate auth guards * Fix remaining auth guard migration * Fix unauth guard usage * Add unit tests for auth guard and unauth guard * Remove unused angular DI code * Move auth related logic out fo sm guard * Add tests * Add more tests for unauth guard * Fix incorrect merge
This commit is contained in:
@@ -2,11 +2,10 @@ import { NgModule } from "@angular/core";
|
||||
import { Route, RouterModule, Routes } from "@angular/router";
|
||||
|
||||
import {
|
||||
AuthGuard,
|
||||
authGuard,
|
||||
lockGuard,
|
||||
redirectGuard,
|
||||
tdeDecryptionRequiredGuard,
|
||||
UnauthGuard,
|
||||
unauthGuardFn,
|
||||
} from "@bitwarden/angular/auth/guards";
|
||||
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
|
||||
@@ -105,7 +104,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: "register",
|
||||
component: TrialInitiationComponent,
|
||||
canActivate: [UnauthGuard],
|
||||
canActivate: [unauthGuardFn()],
|
||||
data: { titleId: "createAccount" } satisfies DataProperties,
|
||||
},
|
||||
{
|
||||
@@ -135,13 +134,13 @@ const routes: Routes = [
|
||||
{
|
||||
path: "verify-recover-delete-org",
|
||||
component: VerifyRecoverDeleteOrgComponent,
|
||||
canActivate: [UnauthGuard],
|
||||
canActivate: [unauthGuardFn()],
|
||||
data: { titleId: "deleteOrganization" },
|
||||
},
|
||||
{
|
||||
path: "verify-recover-delete-provider",
|
||||
component: VerifyRecoverDeleteProviderComponent,
|
||||
canActivate: [UnauthGuard],
|
||||
canActivate: [unauthGuardFn()],
|
||||
data: { titleId: "deleteAccount" } satisfies DataProperties,
|
||||
},
|
||||
{
|
||||
@@ -152,13 +151,13 @@ const routes: Routes = [
|
||||
{
|
||||
path: "update-temp-password",
|
||||
component: UpdateTempPasswordComponent,
|
||||
canActivate: [AuthGuard],
|
||||
canActivate: [authGuard],
|
||||
data: { titleId: "updateTempPassword" } satisfies DataProperties,
|
||||
},
|
||||
{
|
||||
path: "update-password",
|
||||
component: UpdatePasswordComponent,
|
||||
canActivate: [AuthGuard],
|
||||
canActivate: [authGuard],
|
||||
data: { titleId: "updatePassword" } satisfies DataProperties,
|
||||
},
|
||||
{
|
||||
@@ -395,7 +394,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: "remove-password",
|
||||
component: RemovePasswordComponent,
|
||||
canActivate: [AuthGuard],
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
pageTitle: "removeMasterPassword",
|
||||
titleId: "removeMasterPassword",
|
||||
@@ -406,7 +405,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: "",
|
||||
component: UserLayoutComponent,
|
||||
canActivate: [deepLinkGuard(), AuthGuard],
|
||||
canActivate: [deepLinkGuard(), authGuard],
|
||||
children: [
|
||||
{
|
||||
path: "vault",
|
||||
@@ -486,7 +485,7 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path: "tools",
|
||||
canActivate: [AuthGuard],
|
||||
canActivate: [authGuard],
|
||||
children: [
|
||||
{ path: "", pathMatch: "full", redirectTo: "generator" },
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user