mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 18:27:36 +00:00
Redirect to SAML portal upon enforcing SAML SSO
This commit is contained in:
+8
-16
@@ -1,15 +1,14 @@
|
|||||||
import { useRouter } from "next/router";
|
|
||||||
|
|
||||||
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
import { OrgPermissionCan } from "@app/components/permissions";
|
import { OrgPermissionCan } from "@app/components/permissions";
|
||||||
import { Switch } from "@app/components/v2";
|
import { Switch } from "@app/components/v2";
|
||||||
import { OrgPermissionActions,
|
import {
|
||||||
|
OrgPermissionActions,
|
||||||
OrgPermissionSubjects,
|
OrgPermissionSubjects,
|
||||||
useOrganization } from "@app/context";
|
useOrganization
|
||||||
|
} from "@app/context";
|
||||||
import { useLogoutUser,useUpdateOrg } from "@app/hooks/api";
|
import { useLogoutUser,useUpdateOrg } from "@app/hooks/api";
|
||||||
|
|
||||||
export const OrgGeneralAuthSection = () => {
|
export const OrgGeneralAuthSection = () => {
|
||||||
const router = useRouter();
|
|
||||||
const { createNotification } = useNotificationContext();
|
const { createNotification } = useNotificationContext();
|
||||||
const { currentOrg } = useOrganization();
|
const { currentOrg } = useOrganization();
|
||||||
|
|
||||||
@@ -17,16 +16,6 @@ export const OrgGeneralAuthSection = () => {
|
|||||||
|
|
||||||
const logout = useLogoutUser();
|
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) => {
|
const handleEnforceOrgAuthToggle = async (value: boolean) => {
|
||||||
try {
|
try {
|
||||||
if (!currentOrg?.id) return;
|
if (!currentOrg?.id) return;
|
||||||
@@ -42,7 +31,10 @@ export const OrgGeneralAuthSection = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
logOutUser();
|
await logout.mutateAsync();
|
||||||
|
window.open(`/api/v1/sso/redirect/saml2/organizations/${currentOrg.slug}`);
|
||||||
|
window.close();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user