Handle SCIM body requests

This commit is contained in:
adrinr 2023-03-15 12:23:55 +01:00
parent 2fda1bb5d1
commit fc0c4815af
2 changed files with 16 additions and 1 deletions

View File

@ -36,6 +36,7 @@ const { userAgent } = require("koa-useragent")
import destroyable from "server-destroy"
import { initPro } from "./initPro"
import { handleScimBody } from "./middleware/handleScimBody"
// configure events to use the pro audit log write
// can't integrate directly into backend-core due to cyclic issues
@ -55,7 +56,9 @@ const app: Application = new Koa()
app.keys = ["secret", "key"]
// set up top level koa middleware
app.use(koaBody({ multipart: true }))
app.use(handleScimBody)
app.use(koaBody({ multipart: true, jsonStrict: false }))
app.use(koaSession(app))
app.use(middleware.logging)
app.use(logger(logging.pinoSettings()))

View File

@ -0,0 +1,12 @@
import { Ctx } from "@budibase/types"
export const handleScimBody = (ctx: Ctx, next: any) => {
var type = ctx.req.headers["content-type"] || ""
type = type.split(";")[0]
if (type === "application/scim+json") {
ctx.req.headers["content-type"] = "application/json"
}
next()
}