Handle SCIM body requests
This commit is contained in:
parent
2fda1bb5d1
commit
fc0c4815af
|
@ -36,6 +36,7 @@ const { userAgent } = require("koa-useragent")
|
||||||
|
|
||||||
import destroyable from "server-destroy"
|
import destroyable from "server-destroy"
|
||||||
import { initPro } from "./initPro"
|
import { initPro } from "./initPro"
|
||||||
|
import { handleScimBody } from "./middleware/handleScimBody"
|
||||||
|
|
||||||
// configure events to use the pro audit log write
|
// configure events to use the pro audit log write
|
||||||
// can't integrate directly into backend-core due to cyclic issues
|
// can't integrate directly into backend-core due to cyclic issues
|
||||||
|
@ -55,7 +56,9 @@ const app: Application = new Koa()
|
||||||
app.keys = ["secret", "key"]
|
app.keys = ["secret", "key"]
|
||||||
|
|
||||||
// set up top level koa middleware
|
// 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(koaSession(app))
|
||||||
app.use(middleware.logging)
|
app.use(middleware.logging)
|
||||||
app.use(logger(logging.pinoSettings()))
|
app.use(logger(logging.pinoSettings()))
|
||||||
|
|
|
@ -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()
|
||||||
|
}
|
Loading…
Reference in New Issue