admin

Please wait...

settings_applications Security Configuration

All role types enum are in the file core/models/role.ts file. This modular approach ensures consistent access control across your application.

code
1. role.ts

Define your application roles using an Enum for type safety. Role.All public access, Role.Admin restricted access.

export enum Role {
  Admin = 'Admin',
  Employee = 'Employee',
  Client = 'Client',
}
person
2. user.ts

The User model defines the structure of authenticated users and their assigned roles.

import { Role } from './role';

export class User {
  id!: number;
  img!: string;
  username!: string;
  password!: string;
  firstName!: string;
  lastName!: string;
  role!: Role;
  token!: string;
}
security
3. auth.service.ts

Authentication Logic

Handles authentication logic, login/logout operations, and session management using JWT or other strategies. It provides the core methods for identifying the current user and their role.

verified_user
4. auth.guard.ts

Route Protection

Route guard that intercepts navigation requests to ensure the user has the required role for specific routes. It prevents unauthorized access to restricted areas of the application.