@raddiamond/nexauth-core
Version:
Core authentication plugin supporting Local, AD authentication
38 lines (37 loc) • 1.1 kB
TypeScript
import { DataSource } from 'typeorm';
import { OTPValidator } from '../identity/IdentityProvider';
export interface CommonUserLookupOptions<T> {
matchField: keyof T;
extractRoles?: (user: T) => string[];
}
export interface LocalUserLookupOptions<T> extends CommonUserLookupOptions<T> {
entity: new () => T;
passwordField?: string;
comparePassword?: (plain: string, hashed: string) => Promise<boolean>;
}
export interface ADUserLookupOptions extends CommonUserLookupOptions<any> {
additionalAttributes?: string[];
}
export interface TenantContext {
identityProviderType: 'local' | 'ad' | 'ui';
dbConnection?: DataSource;
tenantId?: string;
clientSecret?: string;
domain?: string;
localUser?: LocalUserLookupOptions<any>;
adConfig?: {
url: string;
bindDN: string;
bindCredentials: string;
baseDN: string;
userLookup: ADUserLookupOptions;
};
uiConfig?: {
clientId: string;
};
otpValidator?: OTPValidator<any>;
authSteps?: {
type: string;
[key: string]: any;
}[];
}