UNPKG

lbx-jwt

Version:

Provides JWT authentication for loopback applications. Includes storing roles inside tokens and handling refreshing. Built-in reuse detection.

55 lines (54 loc) 1.48 kB
import { Entity } from '@loopback/repository'; import { BiometricCredentials } from './biometric-credentials.model'; import { Credentials } from './credentials.model'; /** * The base user model with data that all user types share. */ export declare class BaseUser<RoleType extends string> extends Entity { /** * The id of the user. */ id: string; /** * The email of the user. * Needs to be unique and in a valid format. */ email: string; /** * The roles the user has. * Is used by authorization. */ roles: RoleType[]; /** * Whether or not this user account has two factor authentication enabled. */ twoFactorEnabled?: boolean; /** * Whether or not this user needs to change his password. */ requiresPasswordChange?: boolean; /** * The credentials of the user. * Contains the hashed password. */ credentials: Credentials; /** * The credentials of the user. * Contains the hashed password. */ biometricCredentials?: BiometricCredentials[]; /** * Helper for defining the roles open api. */ private readonly roleValues; constructor(data?: Partial<BaseUser<RoleType>>); } /** * Properties of the entity relations. */ export interface BaseUserRelations { } /** * The entity with its relation properties. */ export type BaseUserWithRelations<RoleType extends string> = BaseUser<RoleType> & BaseUserRelations;