* 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>
25 lines
731 B
TypeScript
25 lines
731 B
TypeScript
import { OAuthReq } from "@boxyhq/saml-jackson";
|
|
import { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
import jackson from "@calcom/features/ee/sso/lib/jackson";
|
|
|
|
import { HttpError } from "@lib/core/http/error";
|
|
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
const { oauthController } = await jackson();
|
|
|
|
if (req.method !== "GET") {
|
|
return res.status(400).send("Method not allowed");
|
|
}
|
|
|
|
try {
|
|
const { redirect_url } = await oauthController.authorize(req.query as unknown as OAuthReq);
|
|
|
|
return res.redirect(302, redirect_url as string);
|
|
} catch (err) {
|
|
const { message, statusCode = 500 } = err as HttpError;
|
|
|
|
return res.status(statusCode).send(message);
|
|
}
|
|
}
|