Files
calendar/packages/features/ee/sso/lib/jackson.ts
T
2082a4f4ed chore: upgrades boxyhq jackson (#13477)
* chore: upgrades boxyhq jackson

* Update jackson.ts

reduces bundle size

* Update yarn.lock

* Update apps/web/next.config.js

* Upgrades again

---------

Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2024-02-08 17:51:29 -03:00

54 lines
1.5 KiB
TypeScript

import type {
IConnectionAPIController,
IOAuthController,
ISPSSOConfig,
JacksonOption,
} from "@boxyhq/saml-jackson";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { clientSecretVerifier, oidcPath, samlAudience, samlDatabaseUrl, samlPath } from "./saml";
// Set the required options. Refer to https://github.com/boxyhq/jackson#configuration for the full list
const opts: JacksonOption = {
externalUrl: WEBAPP_URL,
samlPath,
samlAudience,
oidcPath,
db: {
engine: "sql",
type: "postgres",
url: samlDatabaseUrl,
encryptionKey: process.env.CALENDSO_ENCRYPTION_KEY,
},
idpEnabled: true,
clientSecretVerifier,
ory: {
projectId: undefined,
sdkToken: undefined,
},
};
declare global {
/* eslint-disable no-var */
var connectionController: IConnectionAPIController | undefined;
var oauthController: IOAuthController | undefined;
var samlSPConfig: ISPSSOConfig | undefined;
/* eslint-enable no-var */
}
export default async function init() {
if (!globalThis.connectionController || !globalThis.oauthController || !globalThis.samlSPConfig) {
const ret = await (await import("@boxyhq/saml-jackson")).controllers(opts);
globalThis.connectionController = ret.connectionAPIController;
globalThis.oauthController = ret.oauthController;
globalThis.samlSPConfig = ret.spConfig;
}
return {
connectionController: globalThis.connectionController,
oauthController: globalThis.oauthController,
samlSPConfig: globalThis.samlSPConfig,
};
}