1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | import { Strategy as PassportStrategy } from 'passport-strategy';
|
13 | import { Request } from 'express';
|
14 | import { VerifyOptions } from 'jsonwebtoken';
|
15 |
|
16 | export declare class Strategy extends PassportStrategy {
|
17 | constructor(opt: StrategyOptions, verify: VerifyCallback);
|
18 | constructor(opt: StrategyOptions, verify: VerifyCallbackWithRequest);
|
19 | name: string;
|
20 | }
|
21 |
|
22 | export interface StrategyOptions {
|
23 | secretOrKey?: string | Buffer | undefined;
|
24 | secretOrKeyProvider?: SecretOrKeyProvider | undefined;
|
25 | jwtFromRequest: JwtFromRequestFunction;
|
26 | issuer?: string | undefined;
|
27 | audience?: string | undefined;
|
28 | algorithms?: string[] | undefined;
|
29 | ignoreExpiration?: boolean | undefined;
|
30 | passReqToCallback?: boolean | undefined;
|
31 | jsonWebTokenOptions?: VerifyOptions | undefined;
|
32 | }
|
33 |
|
34 | export interface VerifyCallback {
|
35 | (payload: any, done: VerifiedCallback): void;
|
36 | }
|
37 |
|
38 | export interface VerifyCallbackWithRequest {
|
39 | (req: Request, payload: any, done: VerifiedCallback): void;
|
40 | }
|
41 |
|
42 | export interface VerifiedCallback {
|
43 | (error: any, user?: any, info?: any): void;
|
44 | }
|
45 |
|
46 | export interface JwtFromRequestFunction {
|
47 | (req: Request): string | null;
|
48 | }
|
49 |
|
50 | export interface SecretOrKeyProvider {
|
51 | (request: Request, rawJwtToken: any, done: (err: any, secretOrKey?: string | Buffer) => void): void;
|
52 | }
|
53 |
|
54 | export declare namespace ExtractJwt {
|
55 | export function fromHeader(header_name: string): JwtFromRequestFunction;
|
56 | export function fromBodyField(field_name: string): JwtFromRequestFunction;
|
57 | export function fromUrlQueryParameter(param_name: string): JwtFromRequestFunction;
|
58 | export function fromAuthHeaderWithScheme(auth_scheme: string): JwtFromRequestFunction;
|
59 | export function fromAuthHeader(): JwtFromRequestFunction;
|
60 | export function fromExtractors(extractors: JwtFromRequestFunction[]): JwtFromRequestFunction;
|
61 | export function fromAuthHeaderAsBearerToken(): JwtFromRequestFunction;
|
62 | }
|