integreat
Version:
Node.js integration layer
14 lines (13 loc) • 939 B
TypeScript
import type { AuthOptions, Authentication } from './types.js';
import type { Authenticator, Action, Response, Transporter, HandlerDispatch } from '../types.js';
export default class Auth {
#private;
readonly id: string;
constructor(id: string, authenticator: Authenticator, options?: AuthOptions, overrideAuthAsMethod?: string);
authenticate(action: Action | null, dispatch: HandlerDispatch): Promise<boolean>;
validate(authentication: Authentication, action: Action | null, dispatch: HandlerDispatch): Promise<Response>;
authenticateAndGetAuthObject(action: Action | null, authAsMethod: string, dispatch: HandlerDispatch): Promise<Record<string, unknown> | null>;
getAuthObject(transporter: Transporter, action: Action | null, providedAuthKey?: string): Record<string, unknown> | null;
getResponseFromAuth(authKey?: string): Response;
applyToAction(action: Action, transporter: Transporter): Action;
}