diff --git a/packages/auth/src/constants.js b/packages/auth/src/constants.js index 230c80b609..54736bed67 100644 --- a/packages/auth/src/constants.js +++ b/packages/auth/src/constants.js @@ -20,4 +20,6 @@ exports.Configs = { ACCOUNT: "account", SMTP: "smtp", GOOGLE: "google", + OIDC: "oidc", + OIDC_LOGOS: "oidc_logos", } diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 5ca413409c..cd8f784b14 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -10,6 +10,7 @@ export let disabled = false export let error = null export let fieldText = "" + export let fieldIcon = "" export let isPlaceholder = false export let placeholderOption = null export let options = [] @@ -17,11 +18,11 @@ export let onSelectOption = () => {} export let getOptionLabel = option => option export let getOptionValue = option => option + export let getOptionIcon = option => option export let open = false export let readonly = false export let quiet = false export let autoWidth = false - const dispatch = createEventDispatcher() const onClick = () => { dispatch("click") @@ -30,6 +31,7 @@ } open = true } + console.log(fieldIcon) - {/if} + {#if providers.oidc} + + + + + + OpenID Connect + + + + To allow users to authenticate using OIDC, fill out the fields below. + + + + {#each OIDCConfigFields.Oidc as field} +
+ + +
+ {/each} +
+ + To customize your login button, fill out the fields below. + +
+ + +
+
+ + onFileSelected(e)} + bind:this={fileinput} + /> + + {/if} +
+ +
diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index b93bd22c80..d83be15667 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -146,7 +146,7 @@ exports.upload = async function (ctx) { } } const url = `/${bucket}/${key}` - cfgStructure.config[`${name}Url`] = url + cfgStructure.config[`${name}`] = url // write back to db with url updated await db.put(cfgStructure) @@ -188,6 +188,10 @@ exports.configChecklist = async function (ctx) { type: Configs.GOOGLE, }) + // They have set up OIDC + const oidcConfig = await getScopedFullConfig(db, { + type: Configs.OIDC, + }) // They have set up an admin user const users = await db.allDocs( getGlobalUserParams(null, { @@ -201,6 +205,7 @@ exports.configChecklist = async function (ctx) { smtp: !!smtpConfig, adminUser, oauth: !!oauthConfig, + oidc: !!oidcConfig, } } catch (err) { ctx.throw(err.status, err) diff --git a/packages/worker/src/api/routes/admin/configs.js b/packages/worker/src/api/routes/admin/configs.js index 8056ad8cbd..2e926b61f0 100644 --- a/packages/worker/src/api/routes/admin/configs.js +++ b/packages/worker/src/api/routes/admin/configs.js @@ -41,6 +41,19 @@ function googleValidation() { }).unknown(true) } +function OidcValidation() { + // prettier-ignore + return Joi.object({ + clientID: Joi.string().required(), + authUrl: Joi.string().required(), + tokenUrl: Joi.string().required(), + userInfoUrl: Joi.string().required(), + clientId: Joi.string().required(), + clientSecret: Joi.string().required(), + callbackUrl: Joi.string().required(), + }).unknown(true) +} + function buildConfigSaveValidation() { // prettier-ignore return joiValidator.body(Joi.object({ @@ -54,7 +67,8 @@ function buildConfigSaveValidation() { { is: Configs.SMTP, then: smtpValidation() }, { is: Configs.SETTINGS, then: settingValidation() }, { is: Configs.ACCOUNT, then: Joi.object().unknown(true) }, - { is: Configs.GOOGLE, then: googleValidation() } + { is: Configs.GOOGLE, then: googleValidation() }, + { is: Configs.OIDC, then: Joi.object().unknown(true) } ], }), }).required(), @@ -65,7 +79,7 @@ function buildUploadValidation() { // prettier-ignore return joiValidator.params(Joi.object({ type: Joi.string().valid(...Object.values(Configs)).required(), - name: Joi.string().valid(...Object.values(ConfigUploads)).required(), + name: Joi.string().required(), }).required()) } diff --git a/packages/worker/src/constants/index.js b/packages/worker/src/constants/index.js index b40446cc89..ae52af9d7f 100644 --- a/packages/worker/src/constants/index.js +++ b/packages/worker/src/constants/index.js @@ -16,6 +16,7 @@ exports.Configs = Configs exports.ConfigUploads = { LOGO: "logo", + OIDC_LOGO: "oidc_logo", } const TemplateTypes = {