diff options
Diffstat (limited to 'shared/models/plugins/register-server-auth.model.ts')
-rw-r--r-- | shared/models/plugins/register-server-auth.model.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/shared/models/plugins/register-server-auth.model.ts b/shared/models/plugins/register-server-auth.model.ts new file mode 100644 index 000000000..34ebbe712 --- /dev/null +++ b/shared/models/plugins/register-server-auth.model.ts | |||
@@ -0,0 +1,33 @@ | |||
1 | import { UserRole } from '@shared/models' | ||
2 | |||
3 | export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions | ||
4 | |||
5 | export interface RegisterServerAuthPassOptions { | ||
6 | type: 'id-and-pass' | ||
7 | |||
8 | onLogout?: Function | ||
9 | |||
10 | getWeight(): number | ||
11 | |||
12 | // Used by PeerTube to login a user | ||
13 | // Returns null if the login failed, or { username, email } on success | ||
14 | login(body: { | ||
15 | id: string | ||
16 | password: string | ||
17 | }): Promise<{ | ||
18 | username: string | ||
19 | email: string | ||
20 | role?: UserRole | ||
21 | displayName?: string | ||
22 | } | null> | ||
23 | } | ||
24 | |||
25 | export interface RegisterServerAuthExternalOptions { | ||
26 | type: 'external' | ||
27 | |||
28 | onLogout?: Function | ||
29 | } | ||
30 | |||
31 | export interface RegisterServerAuthExternalResult { | ||
32 | onAuth (options: { username: string, email: string }): void | ||
33 | } | ||