:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat: add xaa frontend (#61172)
Reece Jones6df9647473ee
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 894328f5c650..5dd48643c1b6 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5747,13 +5747,13 @@ snapshots:scenes-app-sessionattributionexplorer--session-attribution-explorer--light:hash: v1.k794b7964.0991f5a040b4748331dbbc56de4466a29f085920ac28aa0b5c0d9eb395d92b41.7INkvyEz3MsImYXMXhRN3L6cYi-a1ebsN8_R_WCK9EQscenes-app-settings-authentication-domains--boost-needs-upgrade--dark:- hash: v1.k794b7964.4a7b5dd965cc42008c3f1b369bc17bb607f2b8732df179111c10a4b0f1549161.lkw1726FZqQB3OXVGheLYBCCszuFsaO7GJCp2JcO1pI+ hash: v1.k794b7964.eb36f6d452117316b4aa7475216c2d76121e27d91b24ef62095adbe6c8d92b00.2OGx7RSRzH5pUym7kaWVPBKklDKF7bwuXPXDu9fWk80scenes-app-settings-authentication-domains--boost-needs-upgrade--light:- hash: v1.k794b7964.c77abc79e98f1261afecd1f60cc538478bdecf344bfa1f55b9f7f335a53685d1.C-Djt3YmDTJq2NrLMRn9aSrlEI43WJloxuwm2SrT2Wc+ hash: v1.k794b7964.40f221482e9373705b66a6f90832cfce07dca997d554307e66ddbd893cc7a605.QEbUVhbcdbE3Psp5wEUyvpPtjF3otP7-Rz3oA37i86kscenes-app-settings-authentication-domains--enterprise-mixed--dark:- hash: v1.k794b7964.ac36a20ca0e8f6fd18e298c7c73a67b1bf25f9d57987c838eeb32896acb5fa19.hvlYilnk6qrYJLWaFCCjl5uI2teRjwqvcjeDJuf0ZrY+ hash: v1.k794b7964.2b543849212a450b35a366cbd41bd9826a9f882054d8cd431e59f74731ba520e.Cld5WEnkApG3ilCynLj_0yRh5yjFK550jMG6HSGzi8wscenes-app-settings-authentication-domains--enterprise-mixed--light:- hash: v1.k794b7964.4facffcaa3b90aa1af710390d48639c9d8a6d2154810701330c2d97371ef99d4.0SUpzWPC3vP3EquGOBgiUiq-qNE30EjvZkJ3Mjnq3Es+ hash: v1.k794b7964.eae47e2d0207f7779345b4fa5e53e3d6fa0a3693a75b995c125adf76da927c8a.lyAI3ygzN0PhofKB3wAAO8OCrFAJAruNw170lqCOy9sscenes-app-settings-authentication-domains--no-domains--dark:hash: v1.k794b7964.81d8504bef54b83d0498d9b9d5c11e91a390d3a219096e35d79afccca7831ac6.P2c7dJOuMA9Hg3RjhxS-INorkY1fvHawlNzMBfBs7n8scenes-app-settings-authentication-domains--no-domains--light:diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.tsindex ae7e2915c72f..1cae9887d5e3 100644--- a/frontend/src/generated/core/api.schemas.ts+++ b/frontend/src/generated/core/api.schemas.ts@@ -136,6 +136,22 @@ export interface OrganizationDomainApi {readonly scim_base_url: string | null/** @nullable */readonly scim_bearer_token: string | null+ /** Returns whether ID-JAG (XAA) is configured for this domain. */+ readonly has_id_jag: boolean+ /**+ * Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.+ * @maxLength 512+ * @nullable+ */+ id_jag_issuer_url?: string | null+ /**+ * Override JWKS URL. Defaults to OIDC discovery on the issuer URL.+ * @maxLength 512+ * @nullable+ */+ id_jag_jwks_url?: string | null+ /** Allowed ID-JAG client IDs. Empty list allows any client_id. */+ id_jag_allowed_clients?: string[]}export interface PaginatedOrganizationDomainListApi {@@ -180,6 +196,22 @@ export interface PatchedOrganizationDomainApi {readonly scim_base_url?: string | null/** @nullable */readonly scim_bearer_token?: string | null+ /** Returns whether ID-JAG (XAA) is configured for this domain. */+ readonly has_id_jag?: boolean+ /**+ * Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.+ * @maxLength 512+ * @nullable+ */+ id_jag_issuer_url?: string | null+ /**+ * Override JWKS URL. Defaults to OIDC discovery on the issuer URL.+ * @maxLength 512+ * @nullable+ */+ id_jag_jwks_url?: string | null+ /** Allowed ID-JAG client IDs. Empty list allows any client_id. */+ id_jag_allowed_clients?: string[]}/**diff --git a/frontend/src/generated/core/api.zod.ts b/frontend/src/generated/core/api.zod.tsindex 75e37b0f8971..0f26e9337dd7 100644--- a/frontend/src/generated/core/api.zod.ts+++ b/frontend/src/generated/core/api.zod.ts@@ -33,6 +33,12 @@ export const domainsCreateBodySamlEntityIdMax = 512export const domainsCreateBodySamlAcsUrlMax = 512+export const domainsCreateBodyIdJagIssuerUrlMax = 512++export const domainsCreateBodyIdJagJwksUrlMax = 512++export const domainsCreateBodyIdJagAllowedClientsItemMax = 256+export const DomainsCreateBody = /* @__PURE__ */ zod.object({domain: zod.string().max(domainsCreateBodyDomainMax),jit_provisioning_enabled: zod.boolean().optional(),@@ -41,6 +47,20 @@ export const DomainsCreateBody = /* @__PURE__ */ zod.object({saml_acs_url: zod.string().max(domainsCreateBodySamlAcsUrlMax).nullish(),saml_x509_cert: zod.string().nullish(),scim_enabled: zod.boolean().optional(),+ id_jag_issuer_url: zod+ .string()+ .max(domainsCreateBodyIdJagIssuerUrlMax)+ .nullish()+ .describe('Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.'),+ id_jag_jwks_url: zod+ .string()+ .max(domainsCreateBodyIdJagJwksUrlMax)+ .nullish()+ .describe('Override JWKS URL. Defaults to OIDC discovery on the issuer URL.'),+ id_jag_allowed_clients: zod+ .array(zod.string().max(domainsCreateBodyIdJagAllowedClientsItemMax))+ .optional()+ .describe('Allowed ID-JAG client IDs. Empty list allows any client_id.'),})export const domainsUpdateBodyDomainMax = 128@@ -51,6 +71,12 @@ export const domainsUpdateBodySamlEntityIdMax = 512export const domainsUpdateBodySamlAcsUrlMax = 512+export const domainsUpdateBodyIdJagIssuerUrlMax = 512++export const domainsUpdateBodyIdJagJwksUrlMax = 512++export const domainsUpdateBodyIdJagAllowedClientsItemMax = 256+export const DomainsUpdateBody = /* @__PURE__ */ zod.object({domain: zod.string().max(domainsUpdateBodyDomainMax),jit_provisioning_enabled: zod.boolean().optional(),@@ -59,6 +85,20 @@ export const DomainsUpdateBody = /* @__PURE__ */ zod.object({saml_acs_url: zod.string().max(domainsUpdateBodySamlAcsUrlMax).nullish(),saml_x509_cert: zod.string().nullish(),scim_enabled: zod.boolean().optional(),+ id_jag_issuer_url: zod+ .string()+ .max(domainsUpdateBodyIdJagIssuerUrlMax)+ .nullish()+ .describe('Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.'),+ id_jag_jwks_url: zod+ .string()+ .max(domainsUpdateBodyIdJagJwksUrlMax)+ .nullish()+ .describe('Override JWKS URL. Defaults to OIDC discovery on the issuer URL.'),+ id_jag_allowed_clients: zod+ .array(zod.string().max(domainsUpdateBodyIdJagAllowedClientsItemMax))+ .optional()+ .describe('Allowed ID-JAG client IDs. Empty list allows any client_id.'),})export const domainsPartialUpdateBodyDomainMax = 128@@ -69,6 +109,12 @@ export const domainsPartialUpdateBodySamlEntityIdMax = 512export const domainsPartialUpdateBodySamlAcsUrlMax = 512+export const domainsPartialUpdateBodyIdJagIssuerUrlMax = 512++export const domainsPartialUpdateBodyIdJagJwksUrlMax = 512++export const domainsPartialUpdateBodyIdJagAllowedClientsItemMax = 256+export const DomainsPartialUpdateBody = /* @__PURE__ */ zod.object({domain: zod.string().max(domainsPartialUpdateBodyDomainMax).optional(),jit_provisioning_enabled: zod.boolean().optional(),@@ -77,6 +123,20 @@ export const DomainsPartialUpdateBody = /* @__PURE__ */ zod.object({saml_acs_url: zod.string().max(domainsPartialUpdateBodySamlAcsUrlMax).nullish(),saml_x509_cert: zod.string().nullish(),scim_enabled: zod.boolean().optional(),+ id_jag_issuer_url: zod+ .string()+ .max(domainsPartialUpdateBodyIdJagIssuerUrlMax)+ .nullish()+ .describe('Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.'),+ id_jag_jwks_url: zod+ .string()+ .max(domainsPartialUpdateBodyIdJagJwksUrlMax)+ .nullish()+ .describe('Override JWKS URL. Defaults to OIDC discovery on the issuer URL.'),+ id_jag_allowed_clients: zod+ .array(zod.string().max(domainsPartialUpdateBodyIdJagAllowedClientsItemMax))+ .optional()+ .describe('Allowed ID-JAG client IDs. Empty list allows any client_id.'),})/**@@ -90,6 +150,12 @@ export const domainsScimTokenCreateBodySamlEntityIdMax = 512export const domainsScimTokenCreateBodySamlAcsUrlMax = 512+export const domainsScimTokenCreateBodyIdJagIssuerUrlMax = 512++export const domainsScimTokenCreateBodyIdJagJwksUrlMax = 512++export const domainsScimTokenCreateBodyIdJagAllowedClientsItemMax = 256+export const DomainsScimTokenCreateBody = /* @__PURE__ */ zod.object({domain: zod.string().max(domainsScimTokenCreateBodyDomainMax),jit_provisioning_enabled: zod.boolean().optional(),@@ -98,6 +164,20 @@ export const DomainsScimTokenCreateBody = /* @__PURE__ */ zod.object({saml_acs_url: zod.string().max(domainsScimTokenCreateBodySamlAcsUrlMax).nullish(),saml_x509_cert: zod.string().nullish(),scim_enabled: zod.boolean().optional(),+ id_jag_issuer_url: zod+ .string()+ .max(domainsScimTokenCreateBodyIdJagIssuerUrlMax)+ .nullish()+ .describe('Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.'),+ id_jag_jwks_url: zod+ .string()+ .max(domainsScimTokenCreateBodyIdJagJwksUrlMax)+ .nullish()+ .describe('Override JWKS URL. Defaults to OIDC discovery on the issuer URL.'),+ id_jag_allowed_clients: zod+ .array(zod.string().max(domainsScimTokenCreateBodyIdJagAllowedClientsItemMax))+ .optional()+ .describe('Allowed ID-JAG client IDs. Empty list allows any client_id.'),})export const domainsVerifyCreateBodyDomainMax = 128@@ -108,6 +188,12 @@ export const domainsVerifyCreateBodySamlEntityIdMax = 512export const domainsVerifyCreateBodySamlAcsUrlMax = 512+export const domainsVerifyCreateBodyIdJagIssuerUrlMax = 512++export const domainsVerifyCreateBodyIdJagJwksUrlMax = 512++export const domainsVerifyCreateBodyIdJagAllowedClientsItemMax = 256+export const DomainsVerifyCreateBody = /* @__PURE__ */ zod.object({domain: zod.string().max(domainsVerifyCreateBodyDomainMax),jit_provisioning_enabled: zod.boolean().optional(),@@ -116,6 +202,20 @@ export const DomainsVerifyCreateBody = /* @__PURE__ */ zod.object({saml_acs_url: zod.string().max(domainsVerifyCreateBodySamlAcsUrlMax).nullish(),saml_x509_cert: zod.string().nullish(),scim_enabled: zod.boolean().optional(),+ id_jag_issuer_url: zod+ .string()+ .max(domainsVerifyCreateBodyIdJagIssuerUrlMax)+ .nullish()+ .describe('Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.'),+ id_jag_jwks_url: zod+ .string()+ .max(domainsVerifyCreateBodyIdJagJwksUrlMax)+ .nullish()+ .describe('Override JWKS URL. Defaults to OIDC discovery on the issuer URL.'),+ id_jag_allowed_clients: zod+ .array(zod.string().max(domainsVerifyCreateBodyIdJagAllowedClientsItemMax))+ .optional()+ .describe('Allowed ID-JAG client IDs. Empty list allows any client_id.'),})export const invitesCreateBodyTargetEmailMax = 254diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex d3aadf178d95..e8cb6b1a7f10 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -526,6 +526,7 @@ export const FEATURE_FLAGS = {WORKFLOWS_PUSH_NOTIFICATIONS: 'workflows-push-notifications', // owner: @Odin #team-workflowsWORKFLOWS_RECURRING_SCHEDULES: 'workflows-recurring-schedules', // owner: #team-workflowsWORKFLOWS_WAIT_UNTIL_EVENT: 'workflows-wait-until-event', // owner: #team-workflows+ XAA_AUTHENTICATION: 'xaa-authentication', // owner: @reecejones #team-platform-features} as constexport type FeatureFlagLookupKey = keyof typeof FEATURE_FLAGSexport type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS]diff --git a/frontend/src/scenes/settings/organization/VerifiedDomains/ConfigureIdJagModal.tsx b/frontend/src/scenes/settings/organization/VerifiedDomains/ConfigureIdJagModal.tsxnew file mode 100644index 000000000000..614e0e876cd2--- /dev/null+++ b/frontend/src/scenes/settings/organization/VerifiedDomains/ConfigureIdJagModal.tsx@@ -0,0 +1,90 @@+import { useActions, useValues } from 'kea'+import { Form } from 'kea-forms'++import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'+import { LemonBanner } from 'lib/lemon-ui/LemonBanner'+import { LemonButton } from 'lib/lemon-ui/LemonButton'+import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput'+import { LemonInputSelect } from 'lib/lemon-ui/LemonInputSelect/LemonInputSelect'+import { LemonModal } from 'lib/lemon-ui/LemonModal'+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'++import { verifiedDomainsLogic } from './verifiedDomainsLogic'++export function ConfigureIdJagModal(): JSX.Element {+ const { configureIdJagModalId, isIdJagConfigSubmitting, idJagConfig } = useValues(verifiedDomainsLogic)+ const { setConfigureIdJagModalId } = useActions(verifiedDomainsLogic)+ const { preflight } = useValues(preflightLogic)+ const siteUrl = (preflight?.site_url ?? window.location.origin).replace(/\/$/, '')++ const idJagReady = Boolean(idJagConfig.id_jag_issuer_url)++ const handleClose = (): void => {+ setConfigureIdJagModalId(null)+ }++ return (+ <LemonModal onClose={handleClose} isOpen={!!configureIdJagModalId} title="" simple>+ <Form logic={verifiedDomainsLogic} formKey="idJagConfig" enableFormOnSubmit className="LemonModal__layout ">+ <LemonModal.Header>+ <h3>Configure XAA (ID-JAG)</h3>+ </LemonModal.Header>+ <LemonModal.Content className="deprecated-space-y-2">+ <LemonField label="Token endpoint" name="_tokenEndpoint">+ <CopyToClipboardInline>{`${siteUrl}/id-jag/token`}</CopyToClipboardInline>+ </LemonField>+ <LemonField+ name="id_jag_issuer_url"+ label="IdP issuer URL"+ info="The trusted identity provider issuer URL. Must match the iss claim on ID-JAG tokens for users on this domain."+ >+ <LemonInput+ className="ph-ignore-input"+ placeholder="https://idp.example.com"+ autoComplete="off"+ />+ </LemonField>+ <LemonField+ name="id_jag_jwks_url"+ label="JWKS URL (optional)"+ info="Override JWKS discovery. Leave empty to use OIDC discovery at the issuer URL."+ >+ <LemonInput+ className="ph-ignore-input"+ placeholder="https://idp.example.com/.well-known/jwks.json"+ autoComplete="off"+ />+ </LemonField>+ <LemonField+ name="id_jag_allowed_clients"+ label="Allowed client IDs (optional)"+ info="Restrict which client_id values are accepted. Leave empty to allow any client_id."+ >+ {({ value, onChange }) => (+ <LemonInputSelect+ value={value ?? []}+ onChange={onChange}+ placeholder="Add client IDs..."+ mode="multiple"+ allowCustomValues+ options={[]}+ />+ )}+ </LemonField>+ {!idJagReady && (+ <LemonBanner type="info">+ XAA will not be enabled until you enter an IdP issuer URL. You can save partial settings as+ a draft.+ </LemonBanner>+ )}+ </LemonModal.Content>+ <LemonModal.Footer>+ <LemonButton loading={isIdJagConfigSubmitting} type="primary" htmlType="submit">+ Save settings+ </LemonButton>+ </LemonModal.Footer>+ </Form>+ </LemonModal>+ )+}diff --git a/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.stories.tsx b/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.stories.tsxindex 99350828eebb..b1dc970cf47f 100644--- a/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.stories.tsx+++ b/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.stories.tsx@@ -56,6 +56,10 @@ const VERIFIED_DOMAIN_WITH_SAML_SCIM: OrganizationDomainType = {saml_x509_cert: 'cert',scim_enabled: true,scim_base_url: 'https://posthog.com/scim/v2',+ has_id_jag: true,+ id_jag_issuer_url: 'https://idp.posthog.com',+ id_jag_jwks_url: null,+ id_jag_allowed_clients: ['posthog-mcp'],}const VERIFIED_DOMAIN_NO_SAML_SCIM: OrganizationDomainType = {@@ -71,6 +75,10 @@ const VERIFIED_DOMAIN_NO_SAML_SCIM: OrganizationDomainType = {saml_acs_url: '',saml_x509_cert: '',scim_enabled: false,+ has_id_jag: false,+ id_jag_issuer_url: null,+ id_jag_jwks_url: null,+ id_jag_allowed_clients: [],}const UNVERIFIED_DOMAIN: OrganizationDomainType = {@@ -86,6 +94,7 @@ const UNVERIFIED_DOMAIN: OrganizationDomainType = {saml_acs_url: '',saml_x509_cert: '',scim_enabled: false,+ has_id_jag: false,}const ALL_FEATURES = [diff --git a/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.tsx b/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.tsxindex 5f54b1e7927a..d862f924e872 100644--- a/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.tsx+++ b/frontend/src/scenes/settings/organization/VerifiedDomains/VerifiedDomains.tsx@@ -1,20 +1,21 @@import { useActions, useValues } from 'kea'-import { IconCheckCircle, IconInfo, IconLock, IconTrash, IconWarning } from '@posthog/icons'+import { IconInfo, IconLock, IconPeople, IconShieldLock, IconShuffle, IconTrash, IconWarning } from '@posthog/icons'import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'import { RestrictionScope } from 'lib/components/RestrictedArea'import { useRestrictedArea } from 'lib/components/RestrictedArea'-import { OrganizationMembershipLevel } from 'lib/constants'-import { IconExclamation, IconOffline } from 'lib/lemon-ui/icons'+import { FEATURE_FLAGS, OrganizationMembershipLevel } from 'lib/constants'+import { IconExclamation } from 'lib/lemon-ui/icons'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { More } from 'lib/lemon-ui/LemonButton/More'import { LemonDialog } from 'lib/lemon-ui/LemonDialog'import { LemonSwitch } from 'lib/lemon-ui/LemonSwitch/LemonSwitch'import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'-import { LemonTag } from 'lib/lemon-ui/LemonTag/LemonTag'+import { LemonTag, LemonTagType } from 'lib/lemon-ui/LemonTag/LemonTag'import { Link } from 'lib/lemon-ui/Link'import { Tooltip } from 'lib/lemon-ui/Tooltip'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { organizationLogic } from 'scenes/organizationLogic'import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'import { urls } from 'scenes/urls'@@ -23,6 +24,7 @@ import { ProductKey } from '~/queries/schema/schema-general'import { AvailableFeature, OrganizationDomainType } from '~/types'import { AddDomainModal } from './AddDomainModal'+import { ConfigureIdJagModal } from './ConfigureIdJagModal'import { ConfigureSAMLModal } from './ConfigureSAMLModal'import { ConfigureSCIMModal } from './ConfigureSCIMModal'import { ScimLogsModal } from './ScimLogsModal'@@ -30,6 +32,44 @@ import { SSOSelect } from './SSOSelect'import { verifiedDomainsLogic } from './verifiedDomainsLogic'import { VerifyDomainModal } from './VerifyDomainModal'+// One distinctive icon per integration type, reused across each integration's status badges.+const SAML_ICON = <IconShieldLock />+const SCIM_ICON = <IconPeople />+const XAA_ICON = <IconShuffle />++function IntegrationBadge({+ label,+ type,+ tooltip,+ icon,+ to,+}: {+ label: string+ type: LemonTagType+ tooltip: string+ icon?: JSX.Element+ to?: string+}): JSX.Element {+ const tag = (+ <LemonTag type={type} icon={icon}>+ {label}+ </LemonTag>+ )+ // The tooltip needs a plain element it can attach hover handlers to; LemonTag can't reliably act as a+ // Base UI tooltip trigger (it would also pick up the injected onClick and look clickable), so wrap it.+ return (+ <Tooltip title={tooltip}>+ {to ? (+ <Link to={to} className="inline-flex">+ {tag}+ </Link>+ ) : (+ <span className="inline-flex">{tag}</span>+ )}+ </Tooltip>+ )+}+export function VerifiedDomains(): JSX.Element {const { verifiedDomainsLoading, updatingDomainLoading } = useValues(verifiedDomainsLogic)const { showAddDomainModal } = useActions(verifiedDomainsLogic)@@ -75,9 +115,13 @@ function VerifiedDomainsTable(): JSX.Element {setVerifyModal,setConfigureSAMLModalId,setConfigureSCIMModalId,+ setConfigureIdJagModalId,setScimLogsModalId,} = useActions(verifiedDomainsLogic)const { preflight } = useValues(preflightLogic)+ const { featureFlags } = useValues(featureFlagLogic)++ const isXAAAuthenticationEnabled = !!featureFlags[FEATURE_FLAGS.XAA_AUTHENTICATION]const restrictionReason = useRestrictedArea({minimumAccessLevel: OrganizationMembershipLevel.Admin,@@ -158,57 +202,108 @@ function VerifiedDomainsTable(): JSX.Element {},},{- key: 'saml',- title: 'SAML',- render: function SAML(_, { saml_acs_url, saml_entity_id, saml_x509_cert, has_saml }) {+ key: 'integrations',+ title: 'Integrations',+ render: function Integrations(+ _,+ { has_saml, saml_acs_url, saml_entity_id, saml_x509_cert, scim_enabled, has_id_jag }+ ) {+ const billingLink = urls.organizationBilling([ProductKey.PLATFORM_AND_SUPPORT])+ const badges: JSX.Element[] = []+if (!isSAMLAvailable) {- return (- <Link- to={urls.organizationBilling([ProductKey.PLATFORM_AND_SUPPORT])}- className="flex items-center gap-1"- >- <IconLock className="text-warning text-lg" /> Upgrade to enable- </Link>+ badges.push(+ <IntegrationBadge+ key="saml"+ label="SAML"+ type="muted"+ icon={SAML_ICON}+ tooltip="Upgrade your plan to enable SAML"+ to={billingLink}+ />+ )+ } else if (has_saml) {+ badges.push(+ <IntegrationBadge+ key="saml"+ label="SAML"+ type="success"+ icon={SAML_ICON}+ tooltip="SAML is enabled"+ />+ )+ } else if (saml_acs_url || saml_entity_id || saml_x509_cert) {+ badges.push(+ <IntegrationBadge+ key="saml"+ label="SAML"+ type="warning"+ icon={SAML_ICON}+ tooltip="SAML is partially configured"+ />+ )+ } else {+ badges.push(+ <IntegrationBadge+ key="saml"+ label="SAML"+ type="muted"+ icon={SAML_ICON}+ tooltip="SAML is not enabled"+ />)}- return has_saml ? (- <div className="flex items-center gap-1 text-success">- <IconCheckCircle className="text-lg pt-0.5" /> SAML enabled- </div>- ) : saml_acs_url || saml_entity_id || saml_x509_cert ? (- <div className="flex items-center gap-1 text-warning">- <IconWarning className="text-lg pt-0.5" /> SAML partially configured- </div>- ) : (- <div className="flex items-center gap-1">- <IconOffline className="text-lg" /> SAML not set up- </div>- )- },- },- {- key: 'scim',- title: 'SCIM',- render: function SCIM(_, { scim_enabled }) {+if (!isSCIMAvailable) {- return (- <Link- to={urls.organizationBilling([ProductKey.PLATFORM_AND_SUPPORT])}- className="flex items-center gap-1"- >- <IconLock className="text-warning text-lg" /> Upgrade to enable- </Link>+ badges.push(+ <IntegrationBadge+ key="scim"+ label="SCIM"+ type="muted"+ icon={SCIM_ICON}+ tooltip="Upgrade your plan to enable SCIM"+ to={billingLink}+ />+ )+ } else if (scim_enabled) {+ badges.push(+ <IntegrationBadge+ key="scim"+ label="SCIM"+ type="success"+ icon={SCIM_ICON}+ tooltip="SCIM is enabled"+ />+ )+ } else {+ badges.push(+ <IntegrationBadge+ key="scim"+ label="SCIM"+ type="muted"+ icon={SCIM_ICON}+ tooltip="SCIM is not enabled"+ />)}- return scim_enabled ? (- <div className="flex items-center gap-1 text-success">- <IconCheckCircle className="text-lg pt-0.5" /> SCIM enabled- </div>- ) : (- <div className="flex items-center gap-1">- <IconOffline className="text-lg" /> SCIM not set up- </div>- )++ if (isXAAAuthenticationEnabled && has_id_jag) {+ badges.push(+ <IntegrationBadge+ key="xaa"+ label="XAA"+ type="success"+ icon={XAA_ICON}+ tooltip="XAA is enabled"+ />+ )+ }++ if (badges.length === 0) {+ return <span className="text-muted">Not configured</span>+ }++ return <div className="flex items-center gap-1 flex-wrap">{badges}</div>},},{@@ -238,6 +333,15 @@ function VerifiedDomainsTable(): JSX.Element {>Configure SCIM</LemonButton>+ {isXAAAuthenticationEnabled && (+ <LemonButton+ onClick={() => setConfigureIdJagModalId(id)}+ fullWidth+ disabledReason={restrictionReason}+ >+ Configure XAA+ </LemonButton>+ )}{isSCIMAvailable && (<LemonButtononClick={() => setScimLogsModalId(id)}@@ -379,6 +483,7 @@ function VerifiedDomainsTable(): JSX.Element {<AddDomainModal /><ConfigureSAMLModal /><ConfigureSCIMModal />+ {isXAAAuthenticationEnabled && <ConfigureIdJagModal />}<ScimLogsModal /><VerifyDomainModal /></div>diff --git a/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snap b/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snapindex 067c9131ba20..5b8860aafdbb 100644--- a/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snap+++ b/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snap@@ -3,10 +3,28 @@exports[`verifiedDomainsLogic values has proper defaults 1`] = `{"addModalShown": false,+ "configureIdJagModalId": null,"configureSAMLModalId": null,"configureSCIMModalId": null,"currentOrganizationId": "ABCD","domainBeingVerified": null,+ "idJagConfig": {},+ "idJagConfigAllErrors": {+ "id_jag_issuer_url": undefined,+ "id_jag_jwks_url": undefined,+ },+ "idJagConfigChanged": false,+ "idJagConfigErrors": {},+ "idJagConfigHasErrors": false,+ "idJagConfigManualErrors": {},+ "idJagConfigTouched": false,+ "idJagConfigTouches": {},+ "idJagConfigValidationErrors": {+ "id_jag_issuer_url": undefined,+ "id_jag_jwks_url": undefined,+ },+ "isIdJagConfigSubmitting": false,+ "isIdJagConfigValid": true,"isSAMLAvailable": false,"isSCIMAvailable": false,"isSSOEnforcementAvailable": false,@@ -33,6 +51,7 @@ exports[`verifiedDomainsLogic values has proper defaults 1`] = `"scimLogsPage": 1,"scimLogsSearch": "","scimLogsStatusFilter": "all",+ "showIdJagConfigErrors": false,"showSamlConfigErrors": false,"updatingDomain": false,"updatingDomainLoading": false,diff --git a/frontend/src/scenes/settings/organization/VerifiedDomains/verifiedDomainsLogic.ts b/frontend/src/scenes/settings/organization/VerifiedDomains/verifiedDomainsLogic.tsindex 7861dc51dd26..7bb5b678aa50 100644--- a/frontend/src/scenes/settings/organization/VerifiedDomains/verifiedDomainsLogic.ts+++ b/frontend/src/scenes/settings/organization/VerifiedDomains/verifiedDomainsLogic.ts@@ -28,6 +28,11 @@ export type SCIMConfigType = Partial<Pick<OrganizationDomainType, 'id'>>+export type IdJagConfigType = Partial<+ Pick<OrganizationDomainType, 'id_jag_issuer_url' | 'id_jag_jwks_url' | 'id_jag_allowed_clients'> &+ Pick<OrganizationDomainType, 'id'>+>+export const isSecureURL = (url: string): boolean => {try {const parsed = new URL(url)@@ -46,6 +51,7 @@ export const verifiedDomainsLogic = kea<verifiedDomainsLogicType>([hideAddDomainModal: true,setConfigureSAMLModalId: (id: string | null) => ({ id }),setConfigureSCIMModalId: (id: string | null) => ({ id }),+ setConfigureIdJagModalId: (id: string | null) => ({ id }),setScimLogsModalId: (id: string | null) => ({ id }),setScimLogsStatusFilter: (filter: 'all' | 'success' | '4xx' | '5xx') => ({ filter }),setScimLogsSearch: (search: string) => ({ search }),@@ -84,6 +90,12 @@ export const verifiedDomainsLogic = kea<verifiedDomainsLogicType>([setConfigureSCIMModalId: (_, { id }) => id,},],+ configureIdJagModalId: [+ null as null | string,+ {+ setConfigureIdJagModalId: (_, { id }) => id,+ },+ ],scimLogsModalId: [null as null | string,{@@ -257,6 +269,18 @@ export const verifiedDomainsLogic = kea<verifiedDomainsLogicType>([actions.setSamlConfigValues({ saml_acs_url, saml_entity_id, saml_x509_cert, id })}},+ setConfigureIdJagModalId: ({ id }) => {+ const domain = values.verifiedDomains.find(({ id: _idToFind }) => _idToFind === id)+ if (id && domain) {+ const { id_jag_issuer_url, id_jag_jwks_url, id_jag_allowed_clients } = domain+ actions.setIdJagConfigValues({+ id,+ id_jag_issuer_url: id_jag_issuer_url ?? '',+ id_jag_jwks_url: id_jag_jwks_url ?? '',+ id_jag_allowed_clients: id_jag_allowed_clients ?? [],+ })+ }+ },setConfigureSCIMModalId: ({ id }) => {if (id) {actions.loadScimConfig(id)@@ -341,5 +365,37 @@ export const verifiedDomainsLogic = kea<verifiedDomainsLogicType>([lemonToast.success(`SAML configuration for ${response.domain} updated successfully.`)},},+ idJagConfig: {+ defaults: {} as IdJagConfigType,+ errors: (payload) => ({+ id_jag_issuer_url:+ payload.id_jag_issuer_url && !payload.id_jag_issuer_url.match(SECURE_URL_REGEX)+ ? 'Please enter a valid URL, including https://'+ : undefined,+ id_jag_jwks_url:+ payload.id_jag_jwks_url && !payload.id_jag_jwks_url.match(SECURE_URL_REGEX)+ ? 'Please enter a valid URL, including https://'+ : undefined,+ }),+ submit: async (payload, breakpoint) => {+ const { id, id_jag_issuer_url, id_jag_jwks_url, id_jag_allowed_clients } = payload+ if (!id) {+ return+ }+ const response = await api.update<OrganizationDomainType>(+ `api/organizations/${values.currentOrganizationId}/domains/${id}`,+ {+ id_jag_issuer_url: id_jag_issuer_url?.trim() || null,+ id_jag_jwks_url: id_jag_jwks_url?.trim() || null,+ id_jag_allowed_clients: id_jag_allowed_clients ?? [],+ }+ )+ breakpoint()+ actions.replaceDomain(response)+ actions.setConfigureIdJagModalId(null)+ actions.setIdJagConfigValues({})+ lemonToast.success(`XAA configuration for ${response.domain} updated successfully.`)+ },+ },})),])diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 8baa15a21d32..7b19a44068c9 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -528,6 +528,10 @@ export interface OrganizationDomainType {scim_enabled?: booleanscim_base_url?: stringscim_bearer_token?: string+ has_id_jag?: boolean+ id_jag_issuer_url?: string | null+ id_jag_jwks_url?: string | null+ id_jag_allowed_clients?: string[]}export interface SCIMRequestLogType {diff --git a/posthog/api/organization_domain.py b/posthog/api/organization_domain.pyindex 1ca920a6bf40..1930ccdd93ce 100644--- a/posthog/api/organization_domain.py+++ b/posthog/api/organization_domain.py@@ -1,6 +1,7 @@import refrom typing import Any, cast+from django.core.exceptions import ValidationError as DjangoValidationErrorfrom django.db.models import Q, QuerySetimport django_filters@@ -52,10 +53,23 @@ def _capture_domain_event(request, domain: OrganizationDomain, event_type: str,class OrganizationDomainSerializer(serializers.ModelSerializer):- UPDATE_ONLY_WHEN_VERIFIED = ["jit_provisioning_enabled", "sso_enforcement", "scim_enabled"]+ UPDATE_ONLY_WHEN_VERIFIED = [+ "jit_provisioning_enabled",+ "sso_enforcement",+ "scim_enabled",+ "id_jag_issuer_url",+ "id_jag_jwks_url",+ "id_jag_allowed_clients",+ ]scim_base_url = serializers.SerializerMethodField()scim_bearer_token = serializers.SerializerMethodField()+ id_jag_allowed_clients = serializers.ListField(+ child=serializers.CharField(max_length=256),+ required=False,+ allow_empty=True,+ help_text="Allowed ID-JAG client IDs. Empty list allows any client_id.",+ )class Meta:model = OrganizationDomain@@ -75,6 +89,10 @@ class OrganizationDomainSerializer(serializers.ModelSerializer):"scim_enabled","scim_base_url","scim_bearer_token",+ "has_id_jag",+ "id_jag_issuer_url",+ "id_jag_jwks_url",+ "id_jag_allowed_clients",)extra_kwargs = {"verified_at": {"read_only": True},@@ -84,6 +102,19 @@ class OrganizationDomainSerializer(serializers.ModelSerializer):"has_scim": {"read_only": True},"scim_base_url": {"read_only": True},"scim_bearer_token": {"read_only": True},+ "has_id_jag": {"read_only": True},+ "id_jag_issuer_url": {+ "required": False,+ "allow_null": True,+ "allow_blank": True,+ "help_text": "Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.",+ },+ "id_jag_jwks_url": {+ "required": False,+ "allow_null": True,+ "allow_blank": True,+ "help_text": "Override JWKS URL. Defaults to OIDC discovery on the issuer URL.",+ },}def __init__(self, *args, **kwargs):@@ -107,6 +138,9 @@ class OrganizationDomainSerializer(serializers.ModelSerializer):validated_data.pop("sso_enforcement", None) # can never be set on creation because domain must be verifiedvalidated_data.pop("scim_enabled", None)validated_data.pop("scim_bearer_token", None)+ validated_data.pop("id_jag_issuer_url", None)+ validated_data.pop("id_jag_jwks_url", None)+ validated_data.pop("id_jag_allowed_clients", None)instance: OrganizationDomain = super().create(validated_data)return instance@@ -116,6 +150,21 @@ class OrganizationDomainSerializer(serializers.ModelSerializer):raise serializers.ValidationError("Please enter a valid domain or subdomain name.")return domain+ @staticmethod+ def _normalize_optional_url(value: str | None) -> str | None:+ if value is None:+ return None+ stripped = value.strip()+ if not stripped:+ return None+ return stripped.rstrip("/")++ def validate_id_jag_issuer_url(self, value: str | None) -> str | None:+ return self._normalize_optional_url(value)++ def validate_id_jag_jwks_url(self, value: str | None) -> str | None:+ return self._normalize_optional_url(value)+def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:instance = cast(OrganizationDomain, self.instance)organization: Organization = self.context["view"].organization@@ -163,6 +212,13 @@ class OrganizationDomainSerializer(serializers.ModelSerializer):self._scim_plain_token = scim_plain_token+ id_jag_fields = {"id_jag_issuer_url", "id_jag_jwks_url", "id_jag_allowed_clients"}+ if id_jag_fields.intersection(validated_data):+ try:+ instance.full_clean()+ except DjangoValidationError as e:+ raise serializers.ValidationError(e.message_dict) from e+return instancedef get_scim_base_url(self, obj: OrganizationDomain) -> str | None:@@ -269,6 +325,8 @@ class OrganizationDomainViewset(TeamAndOrgViewSetMixin, ModelViewSet):data = request.dataif any(f.startswith("saml_") for f in data):event_type = "saml configured"+ elif any(f.startswith("id_jag_") for f in data):+ event_type = "id-jag configured"elif "sso_enforcement" in data:event_type = "sso enforcement updated"elif data.get("jit_provisioning_enabled") is True:@@ -295,6 +353,7 @@ class OrganizationDomainViewset(TeamAndOrgViewSetMixin, ModelViewSet):"had_jit_provisioning": instance.jit_provisioning_enabled,"had_sso_enforcement": bool(instance.sso_enforcement),"had_scim": instance.has_scim,+ "had_id_jag": instance.has_id_jag,},)diff --git a/posthog/api/test/test_organization_domain.py b/posthog/api/test/test_organization_domain.pyindex 6dbe0e5ef83f..6ca1d31178c3 100644--- a/posthog/api/test/test_organization_domain.py+++ b/posthog/api/test/test_organization_domain.py@@ -511,6 +511,7 @@ class TestOrganizationDomainsAPI(APIBaseTest):"had_jit_provisioning": False,"had_sso_enforcement": False,"had_scim": False,+ "had_id_jag": False,},groups={"instance": ANY, "organization": str(self.organization.id)},)@@ -663,6 +664,92 @@ class TestOrganizationDomainsAPI(APIBaseTest):response = self.client.post(f"/api/organizations/@current/domains/{self.domain.id}/scim/token")self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)+ # ID-JAG (XAA) configuration++ def test_can_configure_id_jag(self):+ self.organization_membership.level = OrganizationMembership.Level.ADMIN+ self.organization_membership.save()+ self.domain.verified_at = timezone.now()+ self.domain.save()++ response = self.client.patch(+ f"/api/organizations/@current/domains/{self.domain.id}/",+ {+ "id_jag_issuer_url": "https://example.com/",+ "id_jag_jwks_url": "https://example.com/keys.json",+ "id_jag_allowed_clients": ["client-a", "client-b"],+ },+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ response_data = response.json()+ self.assertEqual(response_data["id_jag_issuer_url"], "https://example.com")+ self.assertEqual(response_data["id_jag_jwks_url"], "https://example.com/keys.json")+ self.assertEqual(response_data["id_jag_allowed_clients"], ["client-a", "client-b"])+ self.assertTrue(response_data["has_id_jag"])++ self.domain.refresh_from_db()+ self.assertEqual(self.domain.id_jag_issuer_url, "https://example.com")+ self.assertEqual(self.domain.id_jag_jwks_url, "https://example.com/keys.json")+ self.assertEqual(self.domain.id_jag_allowed_clients, ["client-a", "client-b"])++ def test_can_clear_id_jag_configuration(self):+ self.organization_membership.level = OrganizationMembership.Level.ADMIN+ self.organization_membership.save()+ self.domain.verified_at = timezone.now()+ self.domain.id_jag_issuer_url = "https://example.com"+ self.domain.save()++ response = self.client.patch(+ f"/api/organizations/@current/domains/{self.domain.id}/",+ {"id_jag_issuer_url": "", "id_jag_jwks_url": "", "id_jag_allowed_clients": []},+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ self.assertFalse(response.json()["has_id_jag"])+ self.assertIsNone(response.json()["id_jag_issuer_url"])++ self.domain.refresh_from_db()+ self.assertIsNone(self.domain.id_jag_issuer_url)++ def test_cannot_configure_id_jag_on_unverified_domain(self):+ self.organization_membership.level = OrganizationMembership.Level.ADMIN+ self.organization_membership.save()++ response = self.client.patch(+ f"/api/organizations/@current/domains/{self.domain.id}/",+ {"id_jag_issuer_url": "https://example.com"},+ )+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertEqual(+ response.json(),+ {+ "type": "validation_error",+ "code": "verification_required",+ "detail": "This attribute cannot be updated until the domain is verified.",+ "attr": "id_jag_issuer_url",+ },+ )++ def test_rejects_disallowed_id_jag_urls(self):+ self.organization_membership.level = OrganizationMembership.Level.ADMIN+ self.organization_membership.save()+ self.domain.verified_at = timezone.now()+ self.domain.save()++ response = self.client.patch(+ f"/api/organizations/@current/domains/{self.domain.id}/",+ {"id_jag_issuer_url": "http://127.0.0.1"},+ )+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertEqual(+ response.json(),+ {+ "type": "validation_error",+ "code": "invalid_input",+ "detail": "URL is not allowed: Local/Loopback host not allowed",+ "attr": "id_jag_issuer_url",+ },+ )+class TestSCIMRequestLogsAPI(APILicensedTest):def setUp(self):diff --git a/posthog/models/organization_domain.py b/posthog/models/organization_domain.pyindex fae68a87a739..6477e22e1c1e 100644--- a/posthog/models/organization_domain.py+++ b/posthog/models/organization_domain.py@@ -265,6 +265,13 @@ class OrganizationDomain(ModelActivityMixin, UUIDTModel):"""return self.scim_enabled and bool(self.scim_bearer_token)+ @property+ def has_id_jag(self) -> bool:+ """+ Returns whether ID-JAG (XAA) is configured for this domain.+ """+ return bool(self.id_jag_issuer_url)+def _complete_verification(self) -> tuple["OrganizationDomain", bool]:self.last_verification_retry = Noneself.verified_at = timezone.now()diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 964648d8e087..8651cbeceaa1 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -23520,6 +23520,22 @@ export namespace Schemas {readonly scim_base_url: string | null;/** @nullable */readonly scim_bearer_token: string | null;+ /** Returns whether ID-JAG (XAA) is configured for this domain. */+ readonly has_id_jag: boolean;+ /**+ * Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.+ * @maxLength 512+ * @nullable+ */+ id_jag_issuer_url?: string | null;+ /**+ * Override JWKS URL. Defaults to OIDC discovery on the issuer URL.+ * @maxLength 512+ * @nullable+ */+ id_jag_jwks_url?: string | null;+ /** Allowed ID-JAG client IDs. Empty list allows any client_id. */+ id_jag_allowed_clients?: string[];}/**@@ -30761,6 +30777,22 @@ export namespace Schemas {readonly scim_base_url?: string | null;/** @nullable */readonly scim_bearer_token?: string | null;+ /** Returns whether ID-JAG (XAA) is configured for this domain. */+ readonly has_id_jag?: boolean;+ /**+ * Trusted IdP issuer URL for ID-JAG (XAA). Required to enable ID-JAG on this domain.+ * @maxLength 512+ * @nullable+ */+ id_jag_issuer_url?: string | null;+ /**+ * Override JWKS URL. Defaults to OIDC discovery on the issuer URL.+ * @maxLength 512+ * @nullable+ */+ id_jag_jwks_url?: string | null;+ /** Allowed ID-JAG client IDs. Empty list allows any client_id. */+ id_jag_allowed_clients?: string[];}/**