aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins/register-helpers-store.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-29 09:04:42 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit9107d791e2eef9a1b24b0499dac8b9dbba8a792f (patch)
treef09b20f06008b094f3266b39063bc9785dfebf5f /server/lib/plugins/register-helpers-store.ts
parent4a8d113b9b57d97ff13ad1608798eabca99643e4 (diff)
downloadPeerTube-9107d791e2eef9a1b24b0499dac8b9dbba8a792f.tar.gz
PeerTube-9107d791e2eef9a1b24b0499dac8b9dbba8a792f.tar.zst
PeerTube-9107d791e2eef9a1b24b0499dac8b9dbba8a792f.zip
Add external login tests
Diffstat (limited to 'server/lib/plugins/register-helpers-store.ts')
-rw-r--r--server/lib/plugins/register-helpers-store.ts22
1 files changed, 19 insertions, 3 deletions
diff --git a/server/lib/plugins/register-helpers-store.ts b/server/lib/plugins/register-helpers-store.ts
index 277f2b687..151196bf1 100644
--- a/server/lib/plugins/register-helpers-store.ts
+++ b/server/lib/plugins/register-helpers-store.ts
@@ -1,5 +1,12 @@
1import * as express from 'express'
1import { logger } from '@server/helpers/logger' 2import { logger } from '@server/helpers/logger'
2import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PRIVACIES } from '@server/initializers/constants' 3import {
4 VIDEO_CATEGORIES,
5 VIDEO_LANGUAGES,
6 VIDEO_LICENCES,
7 VIDEO_PLAYLIST_PRIVACIES,
8 VIDEO_PRIVACIES
9} from '@server/initializers/constants'
3import { onExternalUserAuthenticated } from '@server/lib/auth' 10import { onExternalUserAuthenticated } from '@server/lib/auth'
4import { PluginModel } from '@server/models/server/plugin' 11import { PluginModel } from '@server/models/server/plugin'
5import { RegisterServerOptions } from '@server/typings/plugins' 12import { RegisterServerOptions } from '@server/typings/plugins'
@@ -10,11 +17,15 @@ import { PluginVideoCategoryManager } from '@shared/models/plugins/plugin-video-
10import { PluginVideoLanguageManager } from '@shared/models/plugins/plugin-video-language-manager.model' 17import { PluginVideoLanguageManager } from '@shared/models/plugins/plugin-video-language-manager.model'
11import { PluginVideoLicenceManager } from '@shared/models/plugins/plugin-video-licence-manager.model' 18import { PluginVideoLicenceManager } from '@shared/models/plugins/plugin-video-licence-manager.model'
12import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model' 19import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model'
13import { RegisterServerAuthExternalOptions, RegisterServerAuthExternalResult, RegisterServerAuthPassOptions, RegisterServerExternalAuthenticatedResult } from '@shared/models/plugins/register-server-auth.model' 20import {
21 RegisterServerAuthExternalOptions,
22 RegisterServerAuthExternalResult,
23 RegisterServerAuthPassOptions,
24 RegisterServerExternalAuthenticatedResult
25} from '@shared/models/plugins/register-server-auth.model'
14import { RegisterServerHookOptions } from '@shared/models/plugins/register-server-hook.model' 26import { RegisterServerHookOptions } from '@shared/models/plugins/register-server-hook.model'
15import { RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' 27import { RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model'
16import { serverHookObject } from '@shared/models/plugins/server-hook.model' 28import { serverHookObject } from '@shared/models/plugins/server-hook.model'
17import * as express from 'express'
18import { buildPluginHelpers } from './plugin-helpers' 29import { buildPluginHelpers } from './plugin-helpers'
19 30
20type AlterableVideoConstant = 'language' | 'licence' | 'category' | 'privacy' | 'playlistPrivacy' 31type AlterableVideoConstant = 'language' | 'licence' | 'category' | 'privacy' | 'playlistPrivacy'
@@ -174,6 +185,11 @@ export class RegisterHelpersStore {
174 const self = this 185 const self = this
175 186
176 return (options: RegisterServerAuthExternalOptions) => { 187 return (options: RegisterServerAuthExternalOptions) => {
188 if (!options.authName || !options.onAuthRequest || typeof options.onAuthRequest !== 'function') {
189 logger.error('Cannot register auth plugin %s: authName of getWeight or login are not valid.', this.npmName)
190 return
191 }
192
177 this.externalAuths.push(options) 193 this.externalAuths.push(options)
178 194
179 return { 195 return {