Files
calendar/packages/features/ee/sso/lib/jackson.ts
T
Joe Au-YeungGitHubcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>Alex van Andelcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
cf13c06c57 chore: Upgrade boxyhq/saml-jackson to 1.52.2 (#23231)
* Upgrade jackson to 1.52.2

* Update apps/web/package.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Remove unused option prop

---------

Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-08-20 23:13:36 +01:00

65 lines
1.8 KiB
TypeScript

import type {
IConnectionAPIController,
IOAuthController,
ISPSSOConfig,
JacksonOption,
IDirectorySyncController,
OAuthTokenReq,
OAuthReq,
SAMLResponsePayload,
} from "@boxyhq/saml-jackson";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { clientSecretVerifier, oidcPath, samlAudience, samlDatabaseUrl, samlPath } from "./saml";
export type { OAuthTokenReq, OAuthReq, SAMLResponsePayload };
// 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,
scimPath: "/api/scim/v2.0",
db: {
engine: "sql",
type: "postgres",
url: samlDatabaseUrl,
encryptionKey: process.env.CALENDSO_ENCRYPTION_KEY,
},
idpEnabled: true,
clientSecretVerifier,
};
declare global {
/* eslint-disable no-var */
var connectionController: IConnectionAPIController | undefined;
var oauthController: IOAuthController | undefined;
var samlSPConfig: ISPSSOConfig | undefined;
var dsyncController: IDirectorySyncController | undefined;
/* eslint-enable no-var */
}
export default async function init() {
if (
!globalThis.connectionController ||
!globalThis.oauthController ||
!globalThis.samlSPConfig ||
!globalThis.dsyncController
) {
const ret = await (await import("@boxyhq/saml-jackson")).controllers(opts);
globalThis.connectionController = ret.connectionAPIController;
globalThis.oauthController = ret.oauthController;
globalThis.samlSPConfig = ret.spConfig;
globalThis.dsyncController = ret.directorySyncController;
}
return {
connectionController: globalThis.connectionController,
oauthController: globalThis.oauthController,
samlSPConfig: globalThis.samlSPConfig,
dsyncController: globalThis.dsyncController,
};
}