aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-22 16:07:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit7fed637506043e4432cbebe041ada0625171cceb (patch)
tree07f174e17c4b4a0b3d43a0fa6944865c06234338 /shared/models
parent8d4197637868d5cde49434e937186b57e40f4b2b (diff)
downloadPeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.gz
PeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.zst
PeerTube-7fed637506043e4432cbebe041ada0625171cceb.zip
Begin auth plugin support
Diffstat (limited to 'shared/models')
-rw-r--r--shared/models/plugins/register-server-auth.model.ts33
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 @@
1import { UserRole } from '@shared/models'
2
3export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions
4
5export 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
25export interface RegisterServerAuthExternalOptions {
26 type: 'external'
27
28 onLogout?: Function
29}
30
31export interface RegisterServerAuthExternalResult {
32 onAuth (options: { username: string, email: string }): void
33}