Fix bug where OIDC icon was not being displayed due to misconfiguration
This commit is contained in:
parent
005e0a2deb
commit
7138070e4c
|
@ -31,7 +31,6 @@
|
||||||
}
|
}
|
||||||
open = true
|
open = true
|
||||||
}
|
}
|
||||||
console.log(fieldIcon)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
AD: MicrosoftLogo
|
AD: MicrosoftLogo
|
||||||
}
|
}
|
||||||
$: show = $admin.checklist?.oidc
|
$: show = $admin.checklist?.oidc
|
||||||
console.log(preDefinedIcons[oidcIcon])
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if show}
|
{#if show}
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import api from "builderStore/api"
|
import api from "builderStore/api"
|
||||||
import { writable } from "svelte/store"
|
|
||||||
import { organisation } from "stores/portal"
|
|
||||||
|
|
||||||
const ConfigTypes = {
|
const ConfigTypes = {
|
||||||
Google: "google",
|
Google: "google",
|
||||||
|
@ -41,12 +39,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const OIDCConfigFields = {
|
const OIDCConfigFields = {
|
||||||
Oidc: ["configUrl", "clientId", "clientSecret"],
|
Oidc: ["configUrl", "clientID", "clientSecret"],
|
||||||
}
|
}
|
||||||
const OIDCConfigLabels = {
|
const OIDCConfigLabels = {
|
||||||
Oidc: {
|
Oidc: {
|
||||||
configUrl: "Config URL",
|
configUrl: "Config URL",
|
||||||
clientId: "Client ID",
|
clientID: "Client ID",
|
||||||
clientSecret: "Client Secret",
|
clientSecret: "Client Secret",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,15 +111,24 @@ exports.publicSettings = async function (ctx) {
|
||||||
const oidcConfig = await getScopedFullConfig(db, {
|
const oidcConfig = await getScopedFullConfig(db, {
|
||||||
type: Configs.OIDC,
|
type: Configs.OIDC,
|
||||||
})
|
})
|
||||||
if (!publicConfig) {
|
|
||||||
ctx.body = {}
|
if (publicConfig && !oidcConfig) {
|
||||||
} else {
|
|
||||||
ctx.body = publicConfig
|
ctx.body = publicConfig
|
||||||
if (oidcConfig.config) {
|
|
||||||
publicConfig.config.oidcIcon = oidcConfig.config.iconName
|
|
||||||
publicConfig.config.oidcName = oidcConfig.config.name
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if(!publicConfig && oidcConfig) {
|
||||||
|
// Pull out the OIDC icon and name because the other properties shouldn't
|
||||||
|
// be made public
|
||||||
|
let config = {}
|
||||||
|
config.oidcIcon = oidcConfig.config.iconName
|
||||||
|
config.oidcName = oidcConfig.config.name
|
||||||
|
oidcConfig.config = config
|
||||||
|
ctx.body = oidcConfig
|
||||||
|
}
|
||||||
|
else if (publicConfig && oidcConfig) {
|
||||||
|
ctx.body = publicConfig
|
||||||
|
publicConfig.config.oidcIcon = oidcConfig.config.iconName
|
||||||
|
publicConfig.config.oidcName = oidcConfig.config.name
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(err.status, err)
|
ctx.throw(err.status, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ const controller = require("../../controllers/admin/configs")
|
||||||
const joiValidator = require("../../../middleware/joi-validator")
|
const joiValidator = require("../../../middleware/joi-validator")
|
||||||
const adminOnly = require("../../../middleware/adminOnly")
|
const adminOnly = require("../../../middleware/adminOnly")
|
||||||
const Joi = require("joi")
|
const Joi = require("joi")
|
||||||
const { Configs, ConfigUploads } = require("../../../constants")
|
const { Configs } = require("../../../constants")
|
||||||
|
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
|
@ -41,16 +41,14 @@ function googleValidation() {
|
||||||
}).unknown(true)
|
}).unknown(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
function OidcValidation() {
|
function oidcValidation() {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
return Joi.object({
|
return Joi.object({
|
||||||
clientID: Joi.string().required(),
|
clientID: Joi.string().required(),
|
||||||
authUrl: Joi.string().required(),
|
|
||||||
tokenUrl: Joi.string().required(),
|
|
||||||
userInfoUrl: Joi.string().required(),
|
|
||||||
clientId: Joi.string().required(),
|
|
||||||
clientSecret: Joi.string().required(),
|
clientSecret: Joi.string().required(),
|
||||||
callbackUrl: Joi.string().required(),
|
configUrl: Joi.string().required(),
|
||||||
|
iconName: Joi.string().required(),
|
||||||
|
name: Joi.string().required(),
|
||||||
}).unknown(true)
|
}).unknown(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue