From 669b260307ed2046ea7ff47b5caefa46b74f5b5f Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 16 Apr 2024 17:18:14 +0200 Subject: [PATCH] Possibility to configure an OpenID Connect provider on the instance level WIP (#128). --- CHANGELOG.md | 2 +- conversejs/builtin.ts | 1 + .../livechat-external-login-modal.js | 5 +- conversejs/lib/plugins/livechat-specific.ts | 2 +- .../lib/plugins/livechat-viewer-mode.ts | 3 +- languages/en.yml | 3 + server/lib/conversejs/params.ts | 23 +++-- .../diagnostic/external-auth-custom-oidc.ts | 6 +- server/lib/external-auth/oidc.ts | 84 +++++++++++++++++-- server/lib/settings.ts | 52 +++++++++++- shared/lib/types.ts | 1 + 11 files changed, 158 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c97de4b7..637b8c94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ TODO: https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/48 * For anonymous users: new "log in using an external account" dialog, with following options: * remote Peertube account, - * #128: possibility to configure an OpenID Connect provider on the instance level. + * #128 (**Experimental Feature**): possibility to configure an OpenID Connect provider on the instance level. * #143: User colors: implementing [XEP-0392](https://xmpp.org/extensions/xep-0392.html) to have random colors on users nicknames * #330: Chat does no more use an iframe to display the chat besides the videos. * #330: Fullscreen chat: now uses a custom page (in other words: when opening the chat in a new tab, you will have the Peertube menu). diff --git a/conversejs/builtin.ts b/conversejs/builtin.ts index feeeb965..a7fd05dd 100644 --- a/conversejs/builtin.ts +++ b/conversejs/builtin.ts @@ -160,6 +160,7 @@ async function initConverse ( // no viewer mode if authenticated. params.livechat_enable_viewer_mode = autoViewerMode && !isAuthenticated && !isRemoteWithNicknameSet params.livechat_external_auth_oidc_button_label = initConverseParams.externalAuthOIDC?.buttonLabel + params.livechat_external_auth_oidc_url = initConverseParams.externalAuthOIDC?.url if (chatIncludeMode === 'peertube-video') { params.livechat_mini_muc_head = true // we must replace the muc-head by the custom buttons toolbar. diff --git a/conversejs/custom/templates/livechat-external-login-modal.js b/conversejs/custom/templates/livechat-external-login-modal.js index b5a158c3..a2f935c3 100644 --- a/conversejs/custom/templates/livechat-external-login-modal.js +++ b/conversejs/custom/templates/livechat-external-login-modal.js @@ -9,14 +9,15 @@ export const tplExternalLoginModal = (el, o) => { const i18nRemotePeertubeUrl = __(LOC_login_remote_peertube_url) const i18nRemotePeertubeOpen = __('OK') const externalAuthOIDCButtonLabel = api.settings.get('livechat_external_auth_oidc_button_label') + const externalAuthOIDCUrl = api.settings.get('livechat_external_auth_oidc_url') return html`