forked from sourcefuse/loopback4-authentication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
39 lines (33 loc) · 928 Bytes
/
types.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
// Copyright IBM Corp. 2018. All Rights Reserved.
// Node module: @loopback/authentication
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {Request, Response} from '@loopback/rest';
export * from './strategies/types';
export interface IAuthClient {
clientId: string;
clientSecret: string;
redirectUrl?: string;
}
export interface IAuthUser {
id?: number | string;
username: string;
password?: string;
}
export interface AuthenticationMetadata {
strategy: string;
options?: Object;
authOptions?: (req: Request) => Object;
}
/**
* interface definition of a function which accepts a request
* and returns an authenticated user
*/
export interface AuthenticateFn<T> {
(request: Request, response?: Response): Promise<T>;
}
export interface ClientAuthCode<T extends IAuthUser> {
clientId: string;
userId?: string;
user?: T;
}