Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Get saml-jackson working

Steven Teyf170a352db19
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/security/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/security/page-client.tsx
index 532d0ce08c..3a0c18a277 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/security/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/security/page-client.tsx
@@ -29,7 +29,7 @@ const SAMLSection = () => {
const { provider, configured, loading } = useSAML();
const currentProvider = useMemo(
- () => SAML_PROVIDERS.find((p) => p.name.startsWith(provider!)),
+ () => provider && SAML_PROVIDERS.find((p) => p.name.startsWith(provider)),
[provider],
);
@@ -40,19 +40,19 @@ const SAMLSection = () => {
title: null,
description: null,
};
- } else if (configured) {
+ } else if (currentProvider) {
return {
logo: (
<img
- src={currentProvider!.logo}
- alt={currentProvider!.name}
+ src={currentProvider.logo}
+ alt={currentProvider.name}
className="h-8 w-8"
/>
),
- title: `${currentProvider!.name} SAML`,
+ title: `${currentProvider.name} SAML`,
description: "SAML SSO is configured for your workspace.",
};
- } else
+ } else {
return {
status: "unconfigured",
logo: (
@@ -63,6 +63,7 @@ const SAMLSection = () => {
title: "SAML",
description: "Choose an identity provider to get started.",
};
+ }
}, [provider, configured, loading]);
const [openPopover, setOpenPopover] = useState(false);
diff --git a/apps/web/lib/jackson.ts b/apps/web/lib/jackson.ts
index 0dc91a05d6..38b90393c2 100644
--- a/apps/web/lib/jackson.ts
+++ b/apps/web/lib/jackson.ts
@@ -5,6 +5,7 @@ import type {
JacksonOption,
} from "@boxyhq/saml-jackson";
import jackson from "@boxyhq/saml-jackson";
+import { APP_DOMAIN_WITH_NGROK } from "@dub/utils";
export const samlAudience = "https://saml.dub.co";
@@ -12,7 +13,7 @@ const opts: JacksonOption = {
externalUrl:
process.env.NODE_ENV === "production"
? "https://api.dub.co"
- : `${process.env.NEXTAUTH_URL}`,
+ : APP_DOMAIN_WITH_NGROK,
samlPath:
process.env.NODE_ENV === "production"
? "/auth/saml/callback"
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index e21245fc09..42104ab2b9 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -13,7 +13,12 @@ const REDIRECT_SEGMENTS = [
/** @type {import('next').NextConfig} */
module.exports = withAxiom({
reactStrictMode: false,
- transpilePackages: ["shiki", "@dub/prisma", "@dub/email"],
+ transpilePackages: [
+ "shiki",
+ "@dub/prisma",
+ "@dub/email",
+ "@boxyhq/saml-jackson",
+ ],
webpack: (config, { webpack, isServer }) => {
if (isServer) {
config.plugins.push(
diff --git a/apps/web/package.json b/apps/web/package.json
index 73359cd69d..7f9b7a2d8b 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -78,7 +78,6 @@
"he": "^1.2.0",
"html-escaper": "^3.0.3",
"input-otp": "^1.2.4",
- "jose": "^6.0.10",
"js-cookie": "^3.0.5",
"json-2-csv": "^5.5.0",
"jszip": "^3.10.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b14dd70257..af8a1381f5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -222,9 +222,6 @@ importers:
input-otp:
specifier: ^1.2.4
- jose:
- specifier: ^6.0.10
- version: 6.0.10
js-cookie:
specifier: ^3.0.5
version: 3.0.5