From 2c8ae26ea125dd538e3d74c3341be853f22e29f3 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Wed, 17 Jun 2026 18:16:47 +0200 Subject: [PATCH] Open OIDC child session when assuming organization OIDC login dropped organization_id before the provider redirect, so callbacks with an existing matching root session never created an org child session. Persist organization_id in OIDC state, open the child session on callback, and forward the parameter from the sign-in UI. Signed-off-by: Bryan Frimin --- .../auth/sign-in/_components/OIDCButton.tsx | 14 ++- .../src/pages/auth/_components/OIDCButton.tsx | 14 ++- pkg/coredata/migrations/20260617T120000Z.sql | 15 +++ pkg/coredata/oidc_state.go | 37 ++++---- pkg/iam/oidc/service.go | 44 ++++----- pkg/iam/session_service.go | 93 +++++++++++++++++++ pkg/server/api/connect/v1/oidc_handler.go | 34 ++++++- 7 files changed, 202 insertions(+), 49 deletions(-) create mode 100644 pkg/coredata/migrations/20260617T120000Z.sql diff --git a/apps/console/src/pages/iam/auth/sign-in/_components/OIDCButton.tsx b/apps/console/src/pages/iam/auth/sign-in/_components/OIDCButton.tsx index f292fe148..92f6b0c5e 100644 --- a/apps/console/src/pages/iam/auth/sign-in/_components/OIDCButton.tsx +++ b/apps/console/src/pages/iam/auth/sign-in/_components/OIDCButton.tsx @@ -16,6 +16,7 @@ import { useTranslate } from "@probo/i18n"; import { Button, Google, Microsoft } from "@probo/ui"; import type { ComponentProps } from "react"; import { useFragment } from "react-relay"; +import { useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; import type { OIDCButtonFragment$key } from "#/__generated__/iam/OIDCButtonFragment.graphql"; @@ -42,19 +43,24 @@ export function OIDCButton({ providerRef: OIDCButtonFragment$key; }) { const { __ } = useTranslate(); + const [searchParams] = useSearchParams(); const safeContinueUrl = useSafeContinueUrl(); const provider = useFragment(fragment, providerRef); const Icon = providerIcons[provider.name]; + const organizationId = searchParams.get("organization-id"); return (