Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

add automatic SAML redirect

Vladyslav Matsiiakoff2c8d017f53
diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdx
index dae2e80445..db80341995 100644
--- a/docs/self-hosting/configuration/envars.mdx
+++ b/docs/self-hosting/configuration/envars.mdx
@@ -335,6 +335,10 @@ To login into Infisical with OAuth providers such as Google, configure the assoc
Requires enterprise license. Please contact [email protected] to get more information.
</Accordion>
+<ParamField query="NEXT_PUBLIC_SAML_ORG_SLUG" type="string">
+ Configure SAML organization slug to automatically redirect all users of your Infisical instance to the identity provider.
+</ParamField>
+
diff --git a/frontend/src/views/Login/components/InitialStep/InitialStep.tsx b/frontend/src/views/Login/components/InitialStep/InitialStep.tsx
index 2e2d8f79bc..fb191e372a 100644
--- a/frontend/src/views/Login/components/InitialStep/InitialStep.tsx
+++ b/frontend/src/views/Login/components/InitialStep/InitialStep.tsx
@@ -32,6 +32,18 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }:
const { config } = useServerConfig();
const queryParams = new URLSearchParams(window.location.search);
+ useEffect(() => {
+ if (process.env.NEXT_PUBLIC_SAML_ORG_SLUG) {
+ const callbackPort = queryParams.get("callback_port");
+ window.open(
+ `/api/v1/sso/redirect/saml2/organizations/${process.env.NEXT_PUBLIC_SAML_ORG_SLUG}${
+ callbackPort ? `?callback_port=${callbackPort}` : ""
+ }`
+ );
+ window.close();
+ }
+ })
+
const handleLogin = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
try {