1 |
|
2 |
|
3 | import { Strategy as PassportStrategy } from "passport-strategy";
|
4 | import express = require("express");
|
5 |
|
6 | interface IStrategyOptions {
|
7 | usernameField?: string | undefined;
|
8 | passwordField?: string | undefined;
|
9 | session?: boolean | undefined;
|
10 | passReqToCallback?: false | undefined;
|
11 | }
|
12 |
|
13 | interface IStrategyOptionsWithRequest {
|
14 | usernameField?: string | undefined;
|
15 | passwordField?: string | undefined;
|
16 | session?: boolean | undefined;
|
17 | passReqToCallback: true;
|
18 | }
|
19 |
|
20 | interface IVerifyOptions {
|
21 | message: string;
|
22 | }
|
23 |
|
24 | interface VerifyFunctionWithRequest {
|
25 | (
|
26 | req: express.Request,
|
27 | username: string,
|
28 | password: string,
|
29 | done: (error: any, user?: Express.User | false, options?: IVerifyOptions) => void,
|
30 | ): void;
|
31 | }
|
32 |
|
33 | interface VerifyFunction {
|
34 | (
|
35 | username: string,
|
36 | password: string,
|
37 | done: (error: any, user?: Express.User | false, options?: IVerifyOptions) => void,
|
38 | ): void;
|
39 | }
|
40 |
|
41 | declare class Strategy extends PassportStrategy {
|
42 | constructor(options: IStrategyOptionsWithRequest, verify: VerifyFunctionWithRequest);
|
43 | constructor(options: IStrategyOptions, verify: VerifyFunction);
|
44 | constructor(verify: VerifyFunction);
|
45 |
|
46 | name: string;
|
47 | }
|