diff options
Diffstat (limited to 'shared/models/plugins/register-server-auth.model.ts')
-rw-r--r-- | shared/models/plugins/register-server-auth.model.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/shared/models/plugins/register-server-auth.model.ts b/shared/models/plugins/register-server-auth.model.ts index dc46dcbc8..403a49994 100644 --- a/shared/models/plugins/register-server-auth.model.ts +++ b/shared/models/plugins/register-server-auth.model.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { UserRole } from '@shared/models' | 1 | import { UserRole } from '@shared/models' |
2 | import { MOAuthToken } from '@server/typings/models' | ||
2 | 3 | ||
3 | export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions | 4 | export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions |
4 | 5 | ||
@@ -6,11 +7,16 @@ export interface RegisterServerAuthPassOptions { | |||
6 | // Authentication name (a plugin can register multiple auth strategies) | 7 | // Authentication name (a plugin can register multiple auth strategies) |
7 | authName: string | 8 | authName: string |
8 | 9 | ||
9 | onLogout?: Function | 10 | // Called by PeerTube when a user from your plugin logged out |
11 | onLogout?(): void | ||
10 | 12 | ||
11 | // Weight of this authentication so PeerTube tries the auth methods in DESC weight order | 13 | // Weight of this authentication so PeerTube tries the auth methods in DESC weight order |
12 | getWeight(): number | 14 | getWeight(): number |
13 | 15 | ||
16 | // Your plugin can hook PeerTube access/refresh token validity | ||
17 | // So you can control for your plugin the user session lifetime | ||
18 | hookTokenValidity?(options: { token: MOAuthToken, type: 'access' | 'refresh' }): Promise<{ valid: boolean }> | ||
19 | |||
14 | // Used by PeerTube to login a user | 20 | // Used by PeerTube to login a user |
15 | // Returns null if the login failed, or { username, email } on success | 21 | // Returns null if the login failed, or { username, email } on success |
16 | login(body: { | 22 | login(body: { |