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:
parent
8d41976378
commit
7fed637506
23 changed files with 604 additions and 74 deletions
33
shared/models/plugins/register-server-auth.model.ts
Normal file
33
shared/models/plugins/register-server-auth.model.ts
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue