1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Begin auth plugin support

This commit is contained in:
Chocobozzz 2020-04-22 16:07:04 +02:00 committed by Chocobozzz
parent 8d41976378
commit 7fed637506
23 changed files with 604 additions and 74 deletions

View file

@ -0,0 +1,33 @@
import { UserRole } from '@shared/models'
export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions
export interface RegisterServerAuthPassOptions {
type: 'id-and-pass'
onLogout?: Function
getWeight(): number
// Used by PeerTube to login a user
// Returns null if the login failed, or { username, email } on success
login(body: {
id: string
password: string
}): Promise<{
username: string
email: string
role?: UserRole
displayName?: string
} | null>
}
export interface RegisterServerAuthExternalOptions {
type: 'external'
onLogout?: Function
}
export interface RegisterServerAuthExternalResult {
onAuth (options: { username: string, email: string }): void
}