Merge pull request #2686 from horiuchi/csurf

Csurf
This commit is contained in:
Basarat Ali Syed
2014-08-20 09:19:59 +10:00
3 changed files with 43 additions and 18 deletions
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for csurf
// Project: https://www.npmjs.org/package/csurf
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module Express {
export interface Request {
csrfToken(): string;
}
}
declare module "csurf" {
import express = require('express');
function csurf(options?: {
value?: (req: express.Request) => string;
cookie?: csurf.CookieOptions;
}): express.RequestHandler;
module csurf {
export interface CookieOptions extends express.CookieOptions {
key: string;
}
}
export = csurf;
}
+1 -1
View File
@@ -821,7 +821,7 @@ declare module "express" {
(name: string): string; // Getter
(name: string, ...handlers: RequestHandler[]): Application;
(name: RegExp, ...handlers: RequestHandler[]): Application;
}
};
/**
* Return the app's absolute pathname
+12 -17
View File
@@ -8,6 +8,18 @@
declare module Express {
export interface Request {
session?: any;
// These declarations are merged into express's Request type
login(user: any, done: (err: any) => void): void;
login(user: any, options: Object, done: (err: any) => void): void;
logIn(user: any, done: (err: any) => void): void;
logIn(user: any, options: Object, done: (err: any) => void): void;
logout(): void;
logOut(): void;
isAuthenticated(): boolean;
isUnauthenticated(): boolean;
}
}
@@ -68,20 +80,3 @@ declare module 'passport' {
}
}
declare module Express {
export interface Request {
// These declarations are merged into express's Request type
login(user: any, done: (err: any) => void): void;
login(user: any, options: Object, done: (err: any) => void): void;
logIn(user: any, done: (err: any) => void): void;
logIn(user: any, options: Object, done: (err: any) => void): void;
logout(): void;
logOut(): void;
isAuthenticated(): boolean;
isUnauthenticated(): boolean;
}
}