UNPKG

@mercury-labs/auth

Version:

Mercury framework auth library. It supports local auth, jwt with both bearer token and cookie, basic auth.

26 lines (25 loc) 1.36 kB
import { LoggerService } from '@nestjs/common'; import { EventBus } from '@nestjs/cqrs'; import { Observable } from 'rxjs'; import { IAuthDefinitions } from '../../domain'; import type { IAuthUserEntity, IAuthUserEntityForResponse } from '../definitions'; import { AuthDto } from '../dtos'; import { AuthRepository } from '../repositories'; import { PasswordHasherService } from '../services'; export interface IImpersonatedLoginRequest { impersonated: boolean; username: string; password: string; } export declare class LocalLoginAction { protected readonly authDefinitions: IAuthDefinitions; protected readonly passwordHasherService: PasswordHasherService; protected readonly authRepository: AuthRepository; protected readonly eventBus: EventBus; protected readonly loggerService: LoggerService; constructor(authDefinitions: IAuthDefinitions, passwordHasherService: PasswordHasherService, authRepository: AuthRepository, eventBus: EventBus); handle(dto: AuthDto): Observable<IAuthUserEntityForResponse>; protected doLogin(dto: AuthDto, user: IAuthUserEntity, impersonated: boolean): Observable<IAuthUserEntity | undefined>; protected verifyImpersonate({ username, password, }: AuthDto): IImpersonatedLoginRequest; protected verifyPassword(password: string, authUser: IAuthUserEntity): Observable<boolean>; }