From 39c44eb49cbc43f1e6dde2fbca8ed3cfe74f55ce Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Tue, 17 Jun 2014 15:23:55 +0900 Subject: [PATCH] add Profile common interface --- passport-facebook/passport-facebook.d.ts | 31 +++++++++++++++--------- passport/passport.d.ts | 19 +++++++++++++++ 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/passport-facebook/passport-facebook.d.ts b/passport-facebook/passport-facebook.d.ts index 47c9b68bb8..0cf0cfae04 100644 --- a/passport-facebook/passport-facebook.d.ts +++ b/passport-facebook/passport-facebook.d.ts @@ -10,18 +10,25 @@ declare module 'passport-facebook' { import passport = require('passport'); import express = require('express'); - interface Profile { - id:string; - provider:string; - displayName:string; - name:{familyName:string; givenName:string; middleName:string}; - profileUrl:string; + interface Profile extends passport.Profile { + gender: string; + profileUrl: string; } - class Strategy implements passport.Strategy{ - constructor(options:{clientID:string; clientSecret:string; callbackURL:string}, - verify:(accessToken:string, refreshToken:string, profile:Profile, done:(error:any, user?:any) => void) => void); - name: string; - authenticate:(req: express.Request, options?: Object) => void; + interface IStrategyOption { + clientID: string; + clientSecret: string; + callbackURL: string; + + scopeSeparator?: string; + enableProof?: boolean; + profileFields?: string[]; } -} \ No newline at end of file + + class Strategy implements passport.Strategy { + constructor(options: IStrategyOption, + verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + name: string; + authenticate: (req: express.Request, options?: Object) => void; + } +} diff --git a/passport/passport.d.ts b/passport/passport.d.ts index cd86228f62..3b46c7d8f7 100644 --- a/passport/passport.d.ts +++ b/passport/passport.d.ts @@ -42,6 +42,24 @@ declare module 'passport' { name?: string; authenticate(req: express.Request, options?: Object): void; } + + interface Profile { + provider: string; + id: string; + displayName: string; + name? : { + familyName: string; + givenName: string; + middleName?: string; + }; + emails?: { + value: string; + type?: string; + }[]; + photos?: { + value: string; + }[]; + } } declare module Express { @@ -60,3 +78,4 @@ declare module Express { isUnauthenticated(): boolean; } } +