@neuralegion/passport-headerapikey
Version:
Api key authentication strategy for Passport, which only handles headers (not body fields).
32 lines (31 loc) • 1.09 kB
TypeScript
/**
* Creator: Christian Hotz
* Company: hydra newmedia GmbH
* Date: 27.06.16
*
* Copyright hydra newmedia GmbH
*/
/**
* Imports
*/
import { Request } from 'express';
import { Strategy as PassportStrategy } from 'passport-strategy';
export interface StrategyOptions {
realm?: string;
header: string;
prefix: string;
scope?: string | string[];
passReqToCallback?: boolean;
}
export declare type VerifyFunction = (apiKey: string, done: (error: any, user?: any, info?: Object | string) => void) => void;
export declare type VerifyFunctionWithRequest = (req: Request, apiKey: string, done: (error: any, user?: any, info?: Object | string) => void) => void;
export declare class Strategy extends PassportStrategy {
readonly name: string;
readonly verify: VerifyFunction | VerifyFunctionWithRequest;
private readonly prefixPattern;
private _options;
get options(): StrategyOptions;
constructor(options: StrategyOptions, verify: VerifyFunction | VerifyFunctionWithRequest);
authenticate(req: Request): void;
private _challenge;
}