Skip to content

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

add info card when oauth application token exchange

Thiago Araujo da Silvad6f9a899d298
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
index 5db0978e92..5575693bca 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
@@ -32,9 +32,10 @@ import {
OrgPermissionActions,
OrgPermissionSubjects,
useOrganization,
+ useOrgPermission,
useSubscription
} from "@app/context";
-import { useGetOIDCConfig } from "@app/hooks/api";
+import { OauthGrantType, useGetOauthClients, useGetOIDCConfig } from "@app/hooks/api";
import { useUpdateOIDCConfig } from "@app/hooks/api/oidcConfig/mutations";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -44,9 +45,33 @@ type Props = {
onSwitchProvider?: () => void;
};
+const TokenExchangeDependentsAlert = () => {
+ const { currentOrg } = useOrganization();
+ const { data: oauthClients } = useGetOauthClients(currentOrg?.id ?? "");
+
+ const hasTokenExchangeClient = (oauthClients ?? []).some((client) =>
+ client.grantTypes.includes(OauthGrantType.TokenExchange)
+ );
+
+ if (!hasTokenExchangeClient) return null;
+
+ return (
+ <Alert>
+ <Info />
+ <AlertDescription className="text-xs">
+ <p>
+ OAuth application depends on this configuration. Disabling OIDC will stop the application
+ from exchanging tokens.
+ </p>
+ </AlertDescription>
+ </Alert>
+ );
+};
+
export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {
const { currentOrg } = useOrganization();
const { subscription } = useSubscription();
+ const { permission } = useOrgPermission();
const { data, isPending } = useGetOIDCConfig(currentOrg?.id ?? "");
const { mutateAsync } = useUpdateOIDCConfig();
@@ -103,6 +128,10 @@ export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {
};
const isGoogleOAuthEnabled = currentOrg.googleSsoAuthEnforced;
+ const canReadOauthClients = permission.can(
+ OrgPermissionActions.Read,
+ OrgPermissionSubjects.OauthClients
+ );
return (
<>
@@ -140,6 +169,7 @@ export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {
</CardHeader>
<CardContent>
<FieldGroup>
+ {canReadOauthClients && <TokenExchangeDependentsAlert />}
{data && (
<Field orientation="horizontal">
<FieldContent>