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