Add validation to backend for OIDC configuration
This commit is contained in:
parent
a0f2de65e7
commit
0e6fb73b9e
|
@ -20,4 +20,5 @@ exports.Configs = {
|
||||||
ACCOUNT: "account",
|
ACCOUNT: "account",
|
||||||
SMTP: "smtp",
|
SMTP: "smtp",
|
||||||
GOOGLE: "google",
|
GOOGLE: "google",
|
||||||
|
OIDC: "oidc"
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,12 @@ exports.configChecklist = async function (ctx) {
|
||||||
type: Configs.GOOGLE,
|
type: Configs.GOOGLE,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// They have set up OIDC
|
||||||
|
const oidcConfig = await getScopedFullConfig(db, {
|
||||||
|
type: Configs.OIDC,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
// They have set up an admin user
|
// They have set up an admin user
|
||||||
const users = await db.allDocs(
|
const users = await db.allDocs(
|
||||||
getGlobalUserParams(null, {
|
getGlobalUserParams(null, {
|
||||||
|
|
|
@ -41,6 +41,19 @@ function googleValidation() {
|
||||||
}).unknown(true)
|
}).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() {
|
function buildConfigSaveValidation() {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
return joiValidator.body(Joi.object({
|
return joiValidator.body(Joi.object({
|
||||||
|
@ -54,7 +67,8 @@ function buildConfigSaveValidation() {
|
||||||
{ is: Configs.SMTP, then: smtpValidation() },
|
{ is: Configs.SMTP, then: smtpValidation() },
|
||||||
{ is: Configs.SETTINGS, then: settingValidation() },
|
{ is: Configs.SETTINGS, then: settingValidation() },
|
||||||
{ is: Configs.ACCOUNT, then: Joi.object().unknown(true) },
|
{ 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(),
|
}).required(),
|
||||||
|
|
|
@ -16,6 +16,7 @@ exports.Configs = Configs
|
||||||
|
|
||||||
exports.ConfigUploads = {
|
exports.ConfigUploads = {
|
||||||
LOGO: "logo",
|
LOGO: "logo",
|
||||||
|
OIDC_LOGO: "oidc_logo"
|
||||||
}
|
}
|
||||||
|
|
||||||
const TemplateTypes = {
|
const TemplateTypes = {
|
||||||
|
|
Loading…
Reference in New Issue