import { AuthenticationType } from '../constants'; import { ExecutionContext } from '../lib/ExecutionContext'; import { IProcessor } from './Processor'; import { Guard } from './Guard'; export interface IAuthenticatorDescriptor { id: string; name: string; authenticationType: string; description?: string; } export interface IAuthenticator extends IProcessor { authenticate(execCtx: ExecutionContext): Promise; getDescriptor(): IAuthenticatorDescriptor; } export declare abstract class Authenticator extends Guard implements IAuthenticator { name: string; abstract authenticationType: string; description?: string; id: string; constructor(name: string, options?: string | RegExp | ((execContext: ExecutionContext) => Promise)); validate(execCtx: ExecutionContext): Promise; abstract getDescriptor(): IAuthenticatorDescriptor; abstract authenticate(execCtx: ExecutionContext): Promise; } export declare class APITokenAuthenticator extends Authenticator { authenticationType: AuthenticationType; key: string; source: string; private _validate; constructor(validate: (token: string) => Promise, options?: { except?: string | RegExp | ((execContext: ExecutionContext) => Promise); name?: string; key?: string; source?: 'query' | 'header' | 'body'; description?: string; }); authenticate(execCtx: ExecutionContext): Promise; getDescriptor(): { id: string; name: string; authenticationType: AuthenticationType; key: string; source: string; description: string | undefined; }; } export declare class HttpAuthenticator extends Authenticator { authenticationType: AuthenticationType; readonly scheme: string; format: string; private _validate; constructor(validate: (key: string) => Promise, options?: { name?: string; format?: string; description?: string; except?: string | RegExp | ((execContext: ExecutionContext) => Promise); }); authenticate(execCtx: ExecutionContext): Promise; getDescriptor(): { id: string; name: string; authenticationType: AuthenticationType; scheme: string; format: string; description: string | undefined; }; }