X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fmodels%2Fplugins%2Fregister-server-auth.model.ts;h=403a499946bf2c221d11b1c2d556ecac9645923d;hb=e307e4fce39853d445d086f92b8c556c363ee15d;hp=34ebbe71223e45bc98e5e86b98158c4f93bd90ce;hpb=7fed637506043e4432cbebe041ada0625171cceb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/models/plugins/register-server-auth.model.ts b/shared/models/plugins/register-server-auth.model.ts index 34ebbe712..403a49994 100644 --- a/shared/models/plugins/register-server-auth.model.ts +++ b/shared/models/plugins/register-server-auth.model.ts @@ -1,14 +1,22 @@ import { UserRole } from '@shared/models' +import { MOAuthToken } from '@server/typings/models' export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions export interface RegisterServerAuthPassOptions { - type: 'id-and-pass' + // Authentication name (a plugin can register multiple auth strategies) + authName: string - onLogout?: Function + // Called by PeerTube when a user from your plugin logged out + onLogout?(): void + // Weight of this authentication so PeerTube tries the auth methods in DESC weight order getWeight(): number + // Your plugin can hook PeerTube access/refresh token validity + // So you can control for your plugin the user session lifetime + hookTokenValidity?(options: { token: MOAuthToken, type: 'access' | 'refresh' }): Promise<{ valid: boolean }> + // Used by PeerTube to login a user // Returns null if the login failed, or { username, email } on success login(body: { @@ -23,7 +31,8 @@ export interface RegisterServerAuthPassOptions { } export interface RegisterServerAuthExternalOptions { - type: 'external' + // Authentication name (a plugin can register multiple auth strategies) + authName: string onLogout?: Function }