@mercury-labs/nest-auth
Version:
Mercury framework auth library. It supports local auth, jwt with both bearer token and cookie, basic auth.
33 lines (32 loc) • 1.07 kB
TypeScript
import { Type } from '@nestjs/common';
import { JwtSignOptions } from '@nestjs/jwt';
import { ICookieSerializeOptions } from '../helpers';
import { AuthTransferTokenMethod } from './auth-transfer-token-method.enum';
export interface IAuthDefinitions {
basicAuth?: {
username: string;
password: string;
realm?: string;
};
jwt?: {
secret: string;
signOptions?: Omit<JwtSignOptions, 'expiresIn'>;
expiresIn: string | number;
refreshTokenExpiresIn: string | number;
};
impersonate?: {
isEnabled: boolean;
cipher: string;
password: string;
};
redactedFields?: string[];
ignoredRoutes?: string[];
enableHashingToken?: boolean;
hashingSecretKey?: string;
transferTokenMethod?: AuthTransferTokenMethod;
cookieOptions?: Pick<ICookieSerializeOptions, 'domain' | 'path' | 'sameSite' | 'signed' | 'httpOnly' | 'secure'>;
usernameField?: string;
passwordField?: string;
requestPayload?: Type;
httpAdaptorType: 'fastify' | 'express';
}