added default values for SAML_TENANT_ID and SAML_PRODUCT_ID

feature/saml-login
Deepak Prabhakara 2021-11-28 17:40:33 +00:00
parent 9815811658
commit da9b173fab
5 changed files with 11 additions and 5 deletions

View File

@ -23,6 +23,9 @@ GOOGLE_CLIENT_SECRET=
# Enable SAML login using https://github.com/boxyhq/jackson
SAML_LOGIN_URL=
SAML_API_URL=
SAML_TENANT_ID=
SAML_PRODUCT_ID=
JACKSON_API_KEYS=
# @see: https://github.com/calendso/calendso/issues/263

View File

@ -13,7 +13,7 @@ services:
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
boxyhq_saml:
image: boxyhq/jackson:2b9350d
image: boxyhq/jackson:2320557
ports:
- "5000:5000"
- "6000:6000"

View File

@ -12,7 +12,7 @@
"db-seed": "yarn ts-node scripts/seed.ts",
"db-nuke": "docker-compose down --volumes --remove-orphans",
"dx": "cross-env BASE_URL=http://localhost:3000 JWT_SECRET=secret DATABASE_URL=postgresql://postgres:@localhost:5450/calendso run-s db-up db-migrate db-seed dev",
"dx-saml": "cross-env BASE_URL=http://localhost:3000 SAML_TENANT_ID=Cal.com SAML_PRODUCT_ID=Cal.com SAML_LOGIN_URL=http://localhost:5000 SAML_API_URL=http://localhost:6000 JWT_SECRET=secret DATABASE_URL=postgresql://postgres:@localhost:5450/calendso run-s db-up db-migrate db-seed dev",
"dx-saml": "cross-env BASE_URL=http://localhost:3000 SAML_LOGIN_URL=http://localhost:5000 SAML_API_URL=http://localhost:6000 JWT_SECRET=secret DATABASE_URL=postgresql://postgres:@localhost:5450/calendso run-s db-up db-migrate db-seed dev",
"test": "jest",
"test-playwright": "jest --config jest.playwright.config.js",
"test-codegen": "yarn playwright codegen http://localhost:3000",

View File

@ -124,7 +124,9 @@ if (isSAMLLoginEnabled) {
};
},
scope: "",
clientId: `tenant=${process.env.SAML_TENANT_ID}&product=${process.env.SAML_PRODUCT_ID}`,
clientId: `tenant=${process.env.SAML_TENANT_ID || "Cal.com"}&product=${
process.env.SAML_PRODUCT_ID || "Cal.com"
}`,
clientSecret: "dummy",
});
}

View File

@ -610,12 +610,13 @@ const loggedInViewerRouter = createProtectedRouter()
params.append("rawMetadata", input.rawMetadata);
params.append("defaultRedirectUrl", `${process.env.BASE_URL}/login/saml`);
params.append("redirectUrl", JSON.stringify([`${process.env.BASE_URL}/*`]));
params.append("tenant", process.env.SAML_TENANT_ID || "");
params.append("product", process.env.SAML_PRODUCT_ID || "");
params.append("tenant", process.env.SAML_TENANT_ID || "Cal.com");
params.append("product", process.env.SAML_PRODUCT_ID || "Cal.com");
const response = await fetch(`${process.env.SAML_API_URL}/api/v1/saml/config`, {
method: "POST",
body: params,
headers: { Authorization: `api-key ${(process.env.JACKSON_API_KEYS || "").split(",")[0]}` },
});
if (response.status !== 200) {