🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(sso): expose custom oidc options (#13647)
Steffen Schmitz7a5afd392eca
diff --git a/web/src/__tests__/server/ssoConfigRouter.servertest.ts b/web/src/__tests__/server/ssoConfigRouter.servertest.tsindex 872e8cbc68..5ae27be4a7 100644--- a/web/src/__tests__/server/ssoConfigRouter.servertest.ts+++ b/web/src/__tests__/server/ssoConfigRouter.servertest.ts@@ -136,6 +136,19 @@ const samplePayload = (domain: string) => ({},});+const sampleCustomPayload = (domain: string, idToken: boolean) => ({+ domain,+ authProvider: "custom" as const,+ authConfig: {+ name: "Custom OIDC",+ clientId: "client-123",+ clientSecret: "super-secret-value",+ issuer: "https://example.okta.com",+ idToken,+ allowDangerousEmailAccountLinking: false,+ },+});+describe("ssoConfigRouter.save", () => {it("rejects when the domain has no verified VerifiedDomain row for the org", async () => {const { org, caller } = await prepare();@@ -386,6 +399,37 @@ describe("ssoConfigRouter.save", () => {expect(cfg.idTokenSignedResponseAlg).toBe("RS256");});+ it("persists custom idToken values", async () => {+ const { org, caller } = await prepare();+ const falseDomain = `custom-false-${uuidv4().slice(0, 8)}.com`;+ const trueDomain = `custom-true-${uuidv4().slice(0, 8)}.com`;+ await addVerifiedDomain(org.id, falseDomain);+ await addVerifiedDomain(org.id, trueDomain);++ await caller.ssoConfig.save({+ orgId: org.id,+ payload: sampleCustomPayload(falseDomain, false),+ });+ await caller.ssoConfig.save({+ orgId: org.id,+ payload: sampleCustomPayload(trueDomain, true),+ });++ const storedFalse = await prisma.ssoConfig.findUniqueOrThrow({+ where: { domain: falseDomain },+ });+ const storedTrue = await prisma.ssoConfig.findUniqueOrThrow({+ where: { domain: trueDomain },+ });++ expect((storedFalse.authConfig as Record<string, unknown>).idToken).toBe(+ false,+ );+ expect((storedTrue.authConfig as Record<string, unknown>).idToken).toBe(+ true,+ );+ });+it("resets authConfig fields when the provider changes", async () => {// Switching providers is an explicit reset — Custom-only fields like// `name`/`scope` aren't valid in another provider's schema and shouldn'tdiff --git a/web/src/ee/features/multi-tenant-sso/server/ssoConfigRouter.ts b/web/src/ee/features/multi-tenant-sso/server/ssoConfigRouter.tsindex 4797287fdd..de426ac462 100644--- a/web/src/ee/features/multi-tenant-sso/server/ssoConfigRouter.ts+++ b/web/src/ee/features/multi-tenant-sso/server/ssoConfigRouter.ts@@ -118,7 +118,7 @@ export const ssoConfigRouter = createTRPCRouter({});// Preserve advanced authConfig fields the self-service form doesn't- // surface (scope, idToken, tokenEndpointAuthMethod, idTokenSignedResponseAlg)+ // surface (scope, tokenEndpointAuthMethod, idTokenSignedResponseAlg)// when the admin re-saves the same provider — typically just to rotate a// secret. Without this merge, fields originally set via the legacy// support endpoint would silently disappear and break sign-in. Switchingdiff --git a/web/src/ee/features/sso-settings/components/SSOSettings.tsx b/web/src/ee/features/sso-settings/components/SSOSettings.tsxindex 85bd930814..2981fa5c86 100644--- a/web/src/ee/features/sso-settings/components/SSOSettings.tsx+++ b/web/src/ee/features/sso-settings/components/SSOSettings.tsx@@ -13,6 +13,7 @@ import {import { Badge } from "@/src/components/ui/badge";import { Button } from "@/src/components/ui/button";import { Card } from "@/src/components/ui/card";+import { Checkbox } from "@/src/components/ui/checkbox";import {Dialog,DialogBody,@@ -25,6 +26,7 @@ import {import {Form,FormControl,+ FormDescription,FormField,FormItem,FormLabel,@@ -100,11 +102,21 @@ const formSchema = z.object({// providers don't carry a stray field. The strict provider schema// enforces presence at submit for `custom`.name: z.string().optional(),+ idToken: z.boolean().optional(),}),});type FormValues = z.infer<typeof formSchema>;+type AuthConfigFormField = `authConfig.${+ | "clientId"+ | "clientSecret"+ | "issuer"+ | "tenantId"+ | "baseUrl"+ | "name"+ | "idToken"}`;+type SsoConfigRow = {domain: string;authProvider: string;@@ -293,6 +305,7 @@ function SsoConfigDialog({tenantId: typeof cfg.tenantId === "string" ? cfg.tenantId : "",baseUrl: enterprise?.baseUrl ?? "",name: typeof cfg.name === "string" ? cfg.name : "",+ idToken: typeof cfg.idToken === "boolean" ? cfg.idToken : true,},};}, [existing]);@@ -360,7 +373,7 @@ function SsoConfigDialog({? "authConfig.baseUrl": schemaPath;const formField = formPath.startsWith("authConfig.")- ? (formPath as `authConfig.${"clientId" | "clientSecret" | "issuer" | "tenantId" | "baseUrl" | "name"}`)+ ? (formPath as AuthConfigFormField): "authProvider";form.setError(formField, { message: firstIssue.message });// Defensive fallback: if a future schema path doesn't map cleanly to@@ -374,6 +387,7 @@ function SsoConfigDialog({"authConfig.tenantId","authConfig.baseUrl","authConfig.name",+ "authConfig.idToken",];if (!FORM_FIELDS.includes(formField)) {showErrorToast(@@ -540,6 +554,36 @@ function SsoConfigDialog({)}/>) : null}++ {selectedProvider === "custom" ? (+ <>+ <FormField+ control={form.control}+ name="authConfig.idToken"+ render={({ field }) => (+ <FormItem className="flex flex-row items-start space-y-0 space-x-3 rounded-md border p-4">+ <FormControl>+ <Checkbox+ checked={field.value ?? false}+ onCheckedChange={(checked) =>+ field.onChange(checked === true)+ }+ />+ </FormControl>+ <div className="space-y-1 leading-none">+ <FormLabel>+ Use id_token claims only (skip userinfo)+ </FormLabel>+ <FormDescription>+ Leave off for IdPs that release email only via the+ userinfo endpoint.+ </FormDescription>+ </div>+ </FormItem>+ )}+ />+ </>+ ) : null}</DialogBody><DialogFooter><Button@@ -738,6 +782,7 @@ function buildSsoPayload(domain: string, values: FormValues) {...base,issuer: authConfig.issuer ?? "",name: authConfig.name ?? "",+ idToken: authConfig.idToken ?? true,},};default: