Skip to content

Commit

Permalink
Add SAML provider configuration handling
Browse files Browse the repository at this point in the history
  • Loading branch information
prateek3255 committed Mar 19, 2024
1 parent 4ed6c2f commit ce763f3
Show file tree
Hide file tree
Showing 6 changed files with 305 additions and 100 deletions.
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export const IN_BUILT_THIRD_PARTY_PROVIDERS = [
},
];

export const SAML_PROVIDER_ID = "boxy-saml";

export const FIRST_FACTOR_IDS = [
{
label: "Email Password",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import { Dispatch, SetStateAction } from "react";
import { useThirdPartyService } from "../../../../../api/tenants";
import { TenantDashboardView } from "../../../../../api/tenants/types";
import { IN_BUILT_THIRD_PARTY_PROVIDERS } from "../../../../../constants";
import { IN_BUILT_THIRD_PARTY_PROVIDERS, SAML_PROVIDER_ID } from "../../../../../constants";
import { getImageUrl } from "../../../../../utils";
import { useTenantDetailContext } from "../TenantDetailContext";
import { TenantDetailHeader } from "../TenantDetailHeader";
Expand Down Expand Up @@ -89,6 +89,7 @@ const ProviderInfo = ({
: resolvedProviders.find((p) => p.thirdPartyId === providerId);
const isInBuiltProvider =
typeof providerId === "string" && IN_BUILT_THIRD_PARTY_PROVIDERS.some(({ id }) => providerId.startsWith(id));
const isSAMLProvider = typeof providerId === "string" && providerId.startsWith(SAML_PROVIDER_ID);

const handlePostSaveProviders = async (action: "add-or-update" | "delete", providerId: string) => {
let promises: Array<Promise<unknown>> = [];
Expand All @@ -109,7 +110,7 @@ const ProviderInfo = ({
await refetchTenant();
};

if (isInBuiltProvider) {
if (isInBuiltProvider || isSAMLProvider) {
return (
<BuiltInProviderInfo
providerId={providerId}
Expand Down Expand Up @@ -203,6 +204,7 @@ const ThirdPartyProvidersList = ({ setViewObj }: { setViewObj: Dispatch<SetState
<ThirdPartyProviderButton
title="Add SAML Provider"
type="without-icon"
onClick={() => handleAddNewInBuiltProvider(SAML_PROVIDER_ID)}
/>
</div>
</div>
Expand Down
Loading

0 comments on commit ce763f3

Please sign in to comment.