Files
calendar/packages/features/ee/sso/lib/jackson.ts
T
759a89bb0c Reintroduce SAML SSO (#4938)
* wip reintroduce SAML SSO

* Fix the imports

* wip

* Some tweaks

* Fix the type

* Reduce the textarea height

* Cleanup

* Fix the access issues

* Make the SAML SSO active on the sidebar

* Add SP's instructions

* Remove the console.log

* Add the condition to check SAML SSO is enabled

* Replace SAML SSO with Single Sign-On

* Update to SAML feature

* Upgrade the @boxyhq/saml-jackson

* Fix the SAML part and other cleanup

* Tweaks to SAML SSO setup

* Fix the type

* Fix the import path

* Remove samlLoginUrl

* Import fixes

* Simplifies endpoints

Co-authored-by: zomars <zomars@me.com>
2022-10-18 14:34:32 -06:00

54 lines
1.3 KiB
TypeScript

import jackson, {
IConnectionAPIController,
IOAuthController,
JacksonOption,
ISPSAMLConfig,
} from "@boxyhq/saml-jackson";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { samlDatabaseUrl, samlAudience, 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,
db: {
engine: "sql",
type: "postgres",
url: samlDatabaseUrl,
encryptionKey: process.env.CALENDSO_ENCRYPTION_KEY,
},
};
let connectionController: IConnectionAPIController;
let oauthController: IOAuthController;
let samlSPConfig: ISPSAMLConfig;
const g = global as any;
export default async function init() {
if (!g.connectionController || !g.oauthController) {
const ret = await jackson(opts);
connectionController = ret.connectionAPIController;
oauthController = ret.oauthController;
samlSPConfig = ret.spConfig;
g.connectionController = connectionController;
g.oauthController = oauthController;
g.samlSPConfig = samlSPConfig;
} else {
connectionController = g.connectionController;
oauthController = g.oauthController;
samlSPConfig = g.samlSPConfig;
}
return {
connectionController,
oauthController,
samlSPConfig,
};
}