forked from microsoft/code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoauth2-server.d.ts
57 lines (48 loc) · 1.82 KB
/
oauth2-server.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
declare module Express {
export interface Request {
user?: any;
}
}
declare module "oauth2-server" {
import express = require('express');
module o {
interface Server {
authorise(): express.RequestHandler;
errorHandler(): express.ErrorRequestHandler;
grant(): express.RequestHandler;
}
interface Model {
getAccessToken(bearerToken: string, callback: (error: any, accessToken?: AccessToken) => void): void;
getClient(clientId: string, clientSecret: string, callback: (error: any, client?: Client) => void): void;
grantTypeAllowed(clientId: string, grantType: string, callback: (error: any, allowed?: boolean) => void): void;
saveAccessToken(accessToken: string, clientId: string, expires: Date, user: any, callback: (error: any) => void): void;
getUserFromClient(clientId: string, clientSecret: string, callback: (error: any, user?: User) => void): void;
generateToken(type: string, req: Express.Request, callback: (error: any, token?: string) => void): void;
}
interface AccessToken {
expires: Date;
user?: Object;
userId?: any;
}
interface Client {
clientId: string;
redirectUri?: string;
}
interface User {
id: any;
}
interface ServerOptions {
model: Model;
grants?: string[];
debug?: boolean;
accessTokenLifetime?: number;
refreshTokenLifetime?: number;
authCodeLifetime?: number;
clientIdRegex?: RegExp;
passthroughErrors?: boolean;
continueAfterResponse?: boolean;
}
}
function o(options: o.ServerOptions): o.Server;
export = o;
}