Add validation to backend for OIDC configuration
This commit is contained in:
parent
a0f2de65e7
commit
0e6fb73b9e
|
@ -20,4 +20,5 @@ exports.Configs = {
|
|||
ACCOUNT: "account",
|
||||
SMTP: "smtp",
|
||||
GOOGLE: "google",
|
||||
OIDC: "oidc"
|
||||
}
|
||||
|
|
|
@ -188,6 +188,12 @@ 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, {
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -16,6 +16,7 @@ exports.Configs = Configs
|
|||
|
||||
exports.ConfigUploads = {
|
||||
LOGO: "logo",
|
||||
OIDC_LOGO: "oidc_logo"
|
||||
}
|
||||
|
||||
const TemplateTypes = {
|
||||
|
|
Loading…
Reference in New Issue