Skip to content

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

Redirect to SAML portal upon enforcing SAML SSO

Tuan Danged23bd40d277
diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx
index 56187acec7..80fd890a17 100644
--- a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx
+++ b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx
@@ -1,15 +1,14 @@
-import { useRouter } from "next/router";
-
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
import { OrgPermissionCan } from "@app/components/permissions";
import { Switch } from "@app/components/v2";
-import { OrgPermissionActions,
+import {
+ OrgPermissionActions,
OrgPermissionSubjects,
-useOrganization } from "@app/context";
+ useOrganization
+} from "@app/context";
import { useLogoutUser,useUpdateOrg } from "@app/hooks/api";
export const OrgGeneralAuthSection = () => {
- const router = useRouter();
const { createNotification } = useNotificationContext();
const { currentOrg } = useOrganization();
@@ -17,16 +16,6 @@ export const OrgGeneralAuthSection = () => {
const logout = useLogoutUser();
- const logOutUser = async () => {
- try {
- console.log("Logging out...");
- await logout.mutateAsync();
- router.push("/login");
- } catch (error) {
- console.error(error);
- }
- };
-
const handleEnforceOrgAuthToggle = async (value: boolean) => {
try {
if (!currentOrg?.id) return;
@@ -42,7 +31,10 @@ export const OrgGeneralAuthSection = () => {
});
if (value) {
- logOutUser();
+ await logout.mutateAsync();
+ window.open(`/api/v1/sso/redirect/saml2/organizations/${currentOrg.slug}`);
+ window.close();
+ return;
}
} catch (err) {