UNPKG

1.48 kBTypeScriptView Raw
1// Type definitions for passport-local 1.0.0
2// Project: https://github.com/jaredhanson/passport-local
3// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 2.3
6
7/// <reference types="passport"/>
8
9import { Strategy as PassportStrategy } from "passport-strategy";
10import express = require("express");
11
12interface IStrategyOptions {
13 usernameField?: string;
14 passwordField?: string;
15 session?: boolean;
16 passReqToCallback?: false;
17}
18
19interface IStrategyOptionsWithRequest {
20 usernameField?: string;
21 passwordField?: string;
22 session?: boolean;
23 passReqToCallback: true;
24}
25
26interface IVerifyOptions {
27 message: string;
28}
29
30interface 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
39interface VerifyFunction {
40 (
41 username: string,
42 password: string,
43 done: (error: any, user?: any, options?: IVerifyOptions) => void
44 ): void;
45}
46
47declare 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}