Redirect to SAML portal upon enforcing SAML SSO

This commit is contained in:
Tuan Dang
2024-02-09 09:50:20 -08:00
parent 82181f078a
commit ed23bd40d2

View File

@@ -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) {