Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2c5da396

Přidáno uživatelem Jakub Hlaváč před téměř 4 roky(ů)

Re #8469 - Improvment security - implementace

  • authGuard and roleGuard final version
    + usage of localStorage for fields
    + loading properties form cookies to state

Zobrazit rozdíly:

src/app/app-routing.module.ts
2 2
import {RouterModule, Routes} from '@angular/router';
3 3
import {LoginComponent} from './login/components/login.component';
4 4
import {DashboardComponent} from './dashboard/components/dashboard.component';
5
import {AuthGuard} from './auth/guards/auth.guard';
6
import {RoleGuard} from './auth/guards/role.guard';
7
import {AdministrationComponent} from './administration/components/administration.component';
5 8

  
6 9
const routes: Routes = [
7 10
  {
8
    // canActivate: [AuthGuard],
9 11
    path: '',
10 12
    redirectTo: 'login',
11 13
    pathMatch: 'full'
12 14
  }, {
13
    // canActivate: [AuthGuard, RoleGuard],
15
    canActivate: [AuthGuard],
14 16
    path: 'dashboard',
15 17
    component: DashboardComponent,
18
    pathMatch: 'full'
19
  },
20
  {
21
    canActivate: [AuthGuard, RoleGuard],
22
    path: 'administration',
23
    component: AdministrationComponent,
16 24
    pathMatch: 'full',
17 25
    data: {
18
      expectedRole: ['ROLE_ADMIN']
26
      expectedRole: ['1']
19 27
    }
20 28
  },{
21 29
    path: 'login',

Také k dispozici: Unified diff