UNPKG

@mercury-labs/nest-auth

Version:

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

27 lines (26 loc) 1.44 kB
import { LoggerService } from '@nestjs/common'; import { EventBus } from '@nestjs/cqrs'; import { Observable } from 'rxjs'; import type { IAuthUserEntity, IAuthWithTokenResponse } from '../definitions'; import { AuthDto } from '../dtos'; import { IAuthDefinitions } from '../index'; import { AuthRepository } from '../repositories'; import { PasswordHasherService, TokenService } 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 tokenService: TokenService; protected readonly eventBus: EventBus; protected readonly loggerService: LoggerService; constructor(authDefinitions: IAuthDefinitions, passwordHasherService: PasswordHasherService, authRepository: AuthRepository, tokenService: TokenService, eventBus: EventBus); handle<T extends IAuthWithTokenResponse>(dto: AuthDto): Observable<T>; protected doLogin(dto: AuthDto, user: IAuthUserEntity, impersonated: boolean): Observable<IAuthUserEntity | undefined>; protected verifyImpersonate(dto: AuthDto): IImpersonatedLoginRequest; protected verifyPassword(password: string, authUser: IAuthUserEntity): Observable<boolean>; }