Skip to content

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

Merge branch 'main' into PLATFOR-831

Thiago Araujo da Silvaac0004d144c6
diff --cc backend/AGENTS.md
index 444e1bd111,adf8d672d3..9b685200ee
--- a/backend/AGENTS.md
+++ b/backend/AGENTS.md
@@@ -298,28 -298,49 +298,71 @@@ If you encounter `API_KEY` or `SERVICE_
Token detection logic in `inject-identity.ts` checks `x-api-key` header first, then parses `Authorization: Bearer` and inspects JWT `authTokenType` field to determine mode.
+#### SSO session binding
+
+A session minted by a SAML, OIDC or LDAP login carries `issuingRootOrgId`, the root org whose IdP
+issued it (`processProviderCallback` sets it; own-credential sessions never have it). An org that
+enforces SSO admits only sessions its own IdP issued: `validateOrgSSO` compares the claim with the
+org's root org on every user permission check, reading it from `userAuthInfo` in the request context
+(only when the check is for the requester), so it covers `selectOrganization`, OAuth consent, and a
+session that was already open when enforcement was turned on. Members who can bypass SSO are let
+through, and a token with no claim (issued before it existed) is taken at its auth method. Enforcement
+is org policy, not a permission: the permission service reads `authEnforced`, `googleSsoAuthEnforced`
+and `bypassOrgAuthEnabled` per request from the root org (`getOrgSsoPolicy`, through the same
+`orgFindById` request memo the auth layer fills), never from `permissionDAL.getPermission` or the
+cached project permission, so a change applies on the next request. A sub-org has no enforcement of its
+own and follows its root, and only a root org role can bypass it, so a sub-org admin role exempts no
+one. The project permission cache holds only that role-derived bypass answer.
+
+**Every path that issues or re-issues a user token must carry the claim forward** (MFA, refresh,
+signup, org deletion, delegated OAuth codes and tokens). A dropped claim reads as a pre-claim token
+and passes every org's enforcement. `selectOrganization` audits the refusal
+(`SELECT_ORGANIZATION_REFUSED`) by catching the `FOREIGN_SSO_SESSION_ERROR_NAME` error
+`getOrgPermission` throws.
+
+ #### MFA for SSO logins
+
+ `organizations.ssoMfaTrust` (`SsoMfaTrust` enum, `none` or `signal`) lets a SAML or OIDC login satisfy the
+ org's MFA enforcement with the MFA the IdP already performed. The SAML and OIDC callbacks derive one verdict
+ per login with `matchIdpMfaSignal` (`services/auth/idp-mfa-signal.ts`): the OIDC claim named by
+ `oidc_configs.mfaClaimName` contains `mfa`, the SAML `AuthnContextClassRef` is a class whose definition asserts
+ two factors (possession-only classes such as `Smartcard`, `SoftwarePKI` and `TimeSyncToken` are not defaults), or the
+ attribute named by `saml_configs.mfaSignalAttribute` contains `mfa` or `multipleauthn`. A null attribute name
+ means the provider's default: Entra ID's `authnmethodsreferences` for `azure-saml`, because Entra reports a push
+ or TOTP login as `Password` in `AuthnContextClassRef` and puts `multipleauthn` only there, and `amr` for every
+ other provider. The OIDC claim name defaults to `amr`, and the
+ per-config allowlists extend the built-in values rather than replace them. The verdict travels on the org-less
+ session token as `idpMfaOrgId`, the root org whose SSO config produced it (absent when the IdP did not signal
+ MFA). A first login that still has to verify its mailbox carries it on the signup token instead, and
+ `completeAccount` copies it onto the session it mints. `selectOrganization` (`auth-login-service.ts`) applies it
+ through `isIdpMfaTrusted` (`auth-fns.ts`), the only reader of the setting. Rules that must hold:
+
+ - Enforcement is decided once per selection against the root org (`actorRootOrgId`), so moving between a root
+ org and its sub-orgs never re-prompts.
+ - `isIdpMfaTrusted` refuses every non-SSO auth method, so password, Google and LDAP logins (break-glass
+ accounts) always get the Infisical challenge.
+ - The proof only counts for the root org whose IdP produced it. A user in two orgs could otherwise tune one
+ org's allowlist to accept a single factor and carry that verdict into the other, so the token stores the org
+ id rather than a boolean and selection requires it to equal the selected root org.
+ - The trust only applies while `enforceMfa` is on, and then it waives the whole challenge, including the user's
+ personal `isMfaEnabled`: passing an enforced challenge turns that flag on (`Mfa.tsx` calls `activateMfa`), so
+ honoring it would make the trust dead for anyone who ever logged in before it was enabled. Personal MFA in an
+ org that does not enforce it is still prompted. Like the admin SSO bypass, the setting can be stored at any
+ time, before enforcement is on or before any SSO config exists; `updateOrg` only requires the plan to allow
+ MFA enforcement for `signal`, and like `authEnforced` it needs `Sso.Edit`, not just `Settings.Edit`.
+ - `isMfaVerified` is never set from the IdP. It still means "proved a factor to Infisical", so step-up
+ (`mfa-step-up-fns.ts`) and PAM MFA are unaffected. OAuth consent (`authorizeConsent`) re-derives the MFA
+ requirement for the client's org and applies the same `isIdpMfaTrusted` waiver, so a session that skipped
+ the login prompt is not refused when authorizing an application.
+ - Updating a SAML or OIDC config resets the org's `authEnforced` and `scimEnabled`, except when the update
+ carries only the MFA signal fields (`mfaSignalAttribute` / `mfaAuthnContexts`, `mfaClaimName` /
+ `mfaAmrValues`), which cannot break a login. The SSO modals send only those fields when nothing else changed,
+ so tuning an allowlist on a live, enforced setup does not turn enforcement off.
+ - The callback writes a `USER_LOGIN` audit event with the `idpMfa` verdict: `evidence` is what matched and
+ `received` is every value the IdP sent in the fields that were read, so a rejected login shows which value
+ to add to the allowlist. `SELECT_ORGANIZATION` records `mfaSatisfiedBy`, so an admin can see why a login was
+ or wasn't prompted.
+
#### Delegated OAuth tokens
Two grants issue them: the authorization code flow (consented `scopes`) and the RFC 8693 token exchange
diff --cc backend/src/server/routes/v1/auth-router.ts
index c02e942fd3,05f384f678..7d87004212
--- a/backend/src/server/routes/v1/auth-router.ts
+++ b/backend/src/server/routes/v1/auth-router.ts
@@@ -153,9 -153,9 +153,10 @@@ export const registerAuthRoutes = asyn
accessVersion: tokenVersion.accessVersion,
organizationId: decodedToken.organizationId,
...(decodedToken.subOrganizationId && { subOrganizationId: decodedToken.subOrganizationId }),
+ issuingRootOrgId: decodedToken.issuingRootOrgId,
isMfaVerified: decodedToken.isMfaVerified,
- mfaMethod: decodedToken.mfaMethod
+ mfaMethod: decodedToken.mfaMethod,
+ idpMfaOrgId: decodedToken.idpMfaOrgId
},
appCfg.AUTH_SECRET,
{ expiresIn }
diff --cc backend/src/server/routes/v1/oauth-router.ts
index 1d3bf6bdab,45aedaa5ec..b6b9484954
--- a/backend/src/server/routes/v1/oauth-router.ts
+++ b/backend/src/server/routes/v1/oauth-router.ts
@@@ -424,9 -424,9 +424,10 @@@ export const registerOAuthRouter = asyn
scope: req.body.scope,
userId: req.auth.userId,
authMethod: req.auth.authMethod,
+ issuingRootOrgId: req.auth.token.issuingRootOrgId,
isMfaVerified: req.auth.isMfaVerified,
mfaMethod: req.auth.mfaMethod,
+ idpMfaOrgId: req.auth.idpMfaOrgId,
ip: req.realIp
});
diff --cc backend/src/server/routes/v3/login-router.ts
index e28ef6a21c,c30ca8f690..6e7b3ca543
--- a/backend/src/server/routes/v3/login-router.ts
+++ b/backend/src/server/routes/v3/login-router.ts
@@@ -77,9 -77,9 +77,10 @@@ export const registerLoginRouter = asyn
userId: req.auth.userId,
userAuthMethod: req.auth.authMethod,
actorRootOrgId: req.auth.rootOrgId,
+ issuingRootOrgId: req.auth.token.issuingRootOrgId,
isMfaVerified: req.auth.isMfaVerified,
- mfaMethod: req.auth.mfaMethod
+ mfaMethod: req.auth.mfaMethod,
+ idpMfaOrgId: req.auth.idpMfaOrgId
});
if (tokens.isMfaEnabled) {
diff --cc backend/src/services/auth-token/auth-token-service.ts
index 64e6f68e14,1d5ab30b73..2f0915e523
--- a/backend/src/services/auth-token/auth-token-service.ts
+++ b/backend/src/services/auth-token/auth-token-service.ts
@@@ -348,9 -348,9 +348,10 @@@ export const tokenServiceFactory = ({ t
refreshVersion: updatedSession.refreshVersion,
organizationId: decodedToken.organizationId,
...(decodedToken.subOrganizationId && { subOrganizationId: decodedToken.subOrganizationId }),
+ issuingRootOrgId: decodedToken.issuingRootOrgId,
isMfaVerified: decodedToken.isMfaVerified,
- mfaMethod: decodedToken.mfaMethod
+ mfaMethod: decodedToken.mfaMethod,
+ idpMfaOrgId: decodedToken.idpMfaOrgId
},
appCfg.AUTH_SECRET,
{ expiresIn: refreshTokenExpiresIn }
diff --cc backend/src/services/auth/auth-fns.test.ts
index f4b3abad3c,684ffa048f..5c9e15779d
--- a/backend/src/services/auth/auth-fns.test.ts
+++ b/backend/src/services/auth/auth-fns.test.ts
@@@ -1,13 -1,12 +1,14 @@@
import { LoginMethod } from "../super-admin/super-admin-types";
import {
assertOAuthLoginMethodEnabled,
+ isIdpMfaTrusted,
isMfaProofAccepted,
isOAuthLoginMethodDisabled,
+ isSsoAuthMethod,
+ isSsoSessionIssuedByOrg,
RECOVERY_CODE_MFA_ASSURANCE
} from "./auth-fns";
- import { AuthMethod, MfaMethod } from "./auth-type";
+ import { AuthMethod, MfaMethod, SsoMfaTrust } from "./auth-type";
describe("OAuth login method policy", () => {
test.each([
@@@ -65,36 -64,40 +66,74 @@@ describe("isMfaProofAccepted", () =>
});
});
+describe("isSsoSessionIssuedByOrg", () => {
+ const rootOrgId = "org-a";
+
+ test.each([
+ AuthMethod.OKTA_SAML,
+ AuthMethod.AZURE_SAML,
+ AuthMethod.KEYCLOAK_SAML,
+ AuthMethod.OIDC,
+ AuthMethod.LDAP
+ ] as const)("accepts a %s session this org's IdP issued", (authMethod) => {
+ expect(isSsoAuthMethod(authMethod)).toBe(true);
+ expect(isSsoSessionIssuedByOrg({ authMethod, issuingRootOrgId: rootOrgId, rootOrgId })).toBe(true);
+ });
+
+ test.each([AuthMethod.OKTA_SAML, AuthMethod.OIDC, AuthMethod.LDAP] as const)(
+ "refuses a %s session another org's IdP issued",
+ (authMethod) => {
+ expect(isSsoSessionIssuedByOrg({ authMethod, issuingRootOrgId: "org-b", rootOrgId })).toBe(false);
+ }
+ );
+
+ test("takes a token issued before the claim existed at its method", () => {
+ expect(isSsoSessionIssuedByOrg({ authMethod: AuthMethod.OKTA_SAML, rootOrgId })).toBe(true);
+ });
+
+ test.each([AuthMethod.EMAIL, AuthMethod.GOOGLE, AuthMethod.GITHUB, AuthMethod.GITLAB] as const)(
+ "never counts an own-credential %s session as the org's SSO",
+ (authMethod) => {
+ expect(isSsoAuthMethod(authMethod)).toBe(false);
+ expect(isSsoSessionIssuedByOrg({ authMethod, issuingRootOrgId: rootOrgId, rootOrgId })).toBe(false);
+ }
+ );
+});
++
+ describe("isIdpMfaTrusted", () => {
+ const org = { id: "org-a", enforceMfa: true, ssoMfaTrust: SsoMfaTrust.Signal };
+
+ test.each([AuthMethod.OKTA_SAML, AuthMethod.AZURE_SAML, AuthMethod.OIDC] as const)(
+ "trusts a signalled %s login when the org trusts the signal",
+ (authMethod) => {
+ expect(isIdpMfaTrusted({ org, authMethod, idpMfaOrgId: org.id })).toBe(true);
+ }
+ );
+
+ test("never trusts a login that carried no signal", () => {
+ expect(isIdpMfaTrusted({ org, authMethod: AuthMethod.OKTA_SAML })).toBe(false);
+ });
+
+ test("never trusts a signal produced by another organization's IdP", () => {
+ expect(isIdpMfaTrusted({ org, authMethod: AuthMethod.OIDC, idpMfaOrgId: "org-b" })).toBe(false);
+ });
+
+ test("has nothing to waive while the org does not enforce MFA", () => {
+ expect(
+ isIdpMfaTrusted({ org: { ...org, enforceMfa: false }, authMethod: AuthMethod.OIDC, idpMfaOrgId: org.id })
+ ).toBe(false);
+ });
+
+ test.each([AuthMethod.EMAIL, AuthMethod.GOOGLE, AuthMethod.GITHUB, AuthMethod.LDAP] as const)(
+ "never trusts a %s login, so break-glass accounts keep the Infisical challenge",
+ (authMethod) => {
+ expect(isIdpMfaTrusted({ org, authMethod, idpMfaOrgId: org.id })).toBe(false);
+ }
+ );
+
+ test.each([SsoMfaTrust.None, undefined, null, "delegate"])("ignores the signal when the setting is %s", (mode) => {
+ expect(
+ isIdpMfaTrusted({ org: { ...org, ssoMfaTrust: mode }, authMethod: AuthMethod.OIDC, idpMfaOrgId: org.id })
+ ).toBe(false);
+ });
+ });
diff --cc backend/src/services/auth/auth-fns.ts
index 0543ae9fd2,8e7cee9c4e..9686890e26
--- a/backend/src/services/auth/auth-fns.ts
+++ b/backend/src/services/auth/auth-fns.ts
@@@ -72,25 -73,25 +73,44 @@@ export const getRequiredMfaMethod =
return { isMfaRequired, requiredMfaMethod };
};
+export const isSsoAuthMethod = (authMethod: AuthMethod) =>
+ isAuthMethodSaml(authMethod) || authMethod === AuthMethod.OIDC || authMethod === AuthMethod.LDAP;
+
+/**
+ * Whether a session counts as this root org's own SSO. The method alone is not enough: a SAML
+ * session another org's IdP minted would otherwise satisfy this org's enforcement without its IdP,
+ * MFA or deprovisioning ever seeing the login. Tokens issued before the claim existed carry no
+ * issuer and are taken at their method, as before.
+ */
+export const isSsoSessionIssuedByOrg = ({
+ authMethod,
+ issuingRootOrgId,
+ rootOrgId
+}: {
+ authMethod: AuthMethod;
+ issuingRootOrgId?: string;
+ rootOrgId: string;
+}) => isSsoAuthMethod(authMethod) && (!issuingRootOrgId || issuingRootOrgId === rootOrgId);
+
+ // Whether the MFA the IdP performed satisfies this root org's enforcement. Shared by org selection and OAuth
+ // consent so a session that skipped the login prompt is not refused later. Only SAML and OIDC carry a signed
+ // IdP signal: password, Google and LDAP never qualify, so break-glass accounts always get the Infisical
+ // challenge. The proof names the org whose IdP produced it: a user in two orgs could otherwise tune one org's
+ // allowlist to accept a single factor and carry that verdict into the other.
+ export const isIdpMfaTrusted = ({
+ org,
+ authMethod,
+ idpMfaOrgId
+ }: {
+ org: { id: string; enforceMfa?: boolean | null; ssoMfaTrust?: string | null };
+ authMethod: AuthMethod;
+ idpMfaOrgId?: string;
+ }): boolean => {
+ if (!org.enforceMfa) return false;
+ if (!isAuthMethodSaml(authMethod) && authMethod !== AuthMethod.OIDC) return false;
+ return org.ssoMfaTrust === SsoMfaTrust.Signal && idpMfaOrgId === org.id;
+ };
+
export const RECOVERY_CODE_MFA_ASSURANCE = "recovery-code";
export type TMfaAssurance = MfaMethod | typeof RECOVERY_CODE_MFA_ASSURANCE;
diff --cc backend/src/services/auth/auth-login-service.ts
index e1b6e01dad,eb99a81daf..f434ac8caf
--- a/backend/src/services/auth/auth-login-service.ts
+++ b/backend/src/services/auth/auth-login-service.ts
@@@ -8,9 -8,9 +8,9 @@@ import
TUsers,
UserDeviceSchema
} from "@app/db/schemas";
- import { EventType, TAuditLogServiceFactory } from "@app/ee/services/audit-log/audit-log-types";
+ import { EventType, TAuditLogServiceFactory, TMfaSatisfiedBy } from "@app/ee/services/audit-log/audit-log-types";
import { OrgPermissionSsoActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
-import { isAuthMethodSaml } from "@app/ee/services/permission/permission-fns";
+import { FOREIGN_SSO_SESSION_ERROR_NAME } from "@app/ee/services/permission/permission-fns";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
import { getConfig } from "@app/lib/config/env";
import { crypto, generateSrpServerKey, srpCheckClientProof } from "@app/lib/crypto";
@@@ -57,9 -57,8 +57,10 @@@ import
assertOAuthLoginMethodEnabled,
enforceUserLockStatus,
getRequiredMfaMethod,
+ isIdpMfaTrusted,
isOAuthLoginMethodDisabled,
+ isSsoAuthMethod,
+ isSsoSessionIssuedByOrg,
OAuthAuthMethod,
RECOVERY_CODE_MFA_ASSURANCE
} from "./auth-fns";
@@@ -190,15 -189,15 +191,17 @@@ export const authLoginServiceFactory =
email,
authMethod,
organizationId,
+ issuingRootOrgId,
- requiredMfaMethod
+ requiredMfaMethod,
+ idpMfaOrgId
}: {
userId: string;
email?: string | null;
authMethod: AuthMethod;
organizationId?: string;
+ issuingRootOrgId?: string;
requiredMfaMethod: MfaMethod;
+ idpMfaOrgId?: string;
}) => {
const appCfg = getConfig();
@@@ -208,9 -207,9 +211,10 @@@
authTokenType: AuthTokenType.MFA_TOKEN,
userId,
organizationId,
+ issuingRootOrgId,
email,
- requiredMfaMethod
+ requiredMfaMethod,
+ idpMfaOrgId
},
appCfg.AUTH_SECRET,
{ expiresIn: appCfg.JWT_MFA_LIFETIME }
@@@ -237,9 -236,9 +241,10 @@@
organizationId,
subOrganizationId,
authMethod,
+ issuingRootOrgId,
isMfaVerified,
- mfaMethod
+ mfaMethod,
+ idpMfaOrgId
}: {
userId: string;
ip: string;
@@@ -247,9 -246,9 +252,10 @@@
organizationId?: string;
subOrganizationId?: string;
authMethod: AuthMethod;
+ issuingRootOrgId?: string;
isMfaVerified?: boolean;
mfaMethod?: MfaMethod;
+ idpMfaOrgId?: string;
},
tx?: Knex
) => {
@@@ -296,9 -295,9 +302,10 @@@
accessVersion: tokenSession.accessVersion,
organizationId,
subOrganizationId,
+ issuingRootOrgId,
isMfaVerified,
- mfaMethod
+ mfaMethod,
+ idpMfaOrgId
},
cfg.AUTH_SECRET,
{ expiresIn: tokenSessionExpiresIn }
@@@ -313,9 -312,9 +320,10 @@@
refreshVersion: tokenSession.refreshVersion,
organizationId,
subOrganizationId,
+ issuingRootOrgId,
isMfaVerified,
- mfaMethod
+ mfaMethod,
+ idpMfaOrgId
},
cfg.AUTH_SECRET,
{ expiresIn: refreshTokenExpiresIn }
@@@ -336,10 -336,10 +345,14 @@@
}: TProcessProviderCallbackDTO): Promise<TProviderAuthCallback> => {
const appCfg = getConfig();
+ // SSO configs live on root orgs, so the org an IdP login names is the issuing root org. An
+ // OAuth login may name an org too (the default auth org) and must not be bound to it.
+ const issuingRootOrgId = isSsoAuthMethod(authMethod) ? organizationId : undefined;
+
+ const idpMfaOrgId = idpMfa?.verified ? organizationId : undefined;
+
+ // A first login that still has to verify its mailbox finishes in completeAccount, which mints the session
+ // from this token, so the proof rides along or that one login would be prompted despite the trust.
if (!user.isAccepted || !isEmailVerified) {
const signupToken = crypto.jwt().sign(
{
@@@ -349,7 -349,7 +362,8 @@@
isEmailVerified,
aliasId,
organizationId,
+ issuingRootOrgId,
+ idpMfaOrgId,
callbackPort,
email: user.email,
firstName: user.firstName,
@@@ -368,7 -368,7 +382,8 @@@
ip,
userAgent,
authMethod,
- issuingRootOrgId
++ issuingRootOrgId,
+ idpMfaOrgId
});
if (organizationId) {
@@@ -753,9 -778,9 +793,10 @@@
userAgent,
organizationId: orgId,
authMethod: decodedToken.authMethod,
+ issuingRootOrgId: decodedToken.issuingRootOrgId,
isMfaVerified: true,
- mfaMethod
+ mfaMethod,
+ idpMfaOrgId: decodedToken.idpMfaOrgId
});
// Open the grace window for THIS session only (the one that just proved MFA), so
@@@ -1170,9 -1195,9 +1211,10 @@@
userId,
userAuthMethod,
actorRootOrgId,
+ issuingRootOrgId,
isMfaVerified,
- mfaMethod
+ mfaMethod,
+ idpMfaOrgId
}: {
userAgent: string | undefined;
ipAddress: string;
@@@ -1180,9 -1205,9 +1222,10 @@@
userId: string;
userAuthMethod: AuthMethod;
actorRootOrgId?: string;
+ issuingRootOrgId?: string;
isMfaVerified?: boolean;
mfaMethod?: MfaMethod;
+ idpMfaOrgId?: string;
}) => {
const cfg = getConfig();
if (!userAgent) throw new UnauthorizedError({ name: "User-Agent header is required" });
@@@ -1339,7 -1351,7 +1386,8 @@@
authMethod: userAuthMethod,
requiredMfaMethod,
organizationId: rootOrg.id,
- issuingRootOrgId
++ issuingRootOrgId,
+ idpMfaOrgId
});
return { isMfaEnabled: true, mfa: mfaToken, mfaMethod: requiredMfaMethod } as const;
@@@ -1354,12 -1366,16 +1402,17 @@@
ip: ipAddress,
organizationId: isSubOrganization ? rootOrg.id : organizationId,
subOrganizationId: isSubOrganization ? organizationId : undefined,
+ issuingRootOrgId,
isMfaVerified,
- mfaMethod
+ mfaMethod,
+ idpMfaOrgId
});
+ let mfaSatisfiedBy: TMfaSatisfiedBy = "infisical";
+ if (!isMfaRequired) mfaSatisfiedBy = "not-required";
+ else if (isMfaSatisfiedByIdp) mfaSatisfiedBy = "idp";
+
- // In the event of this being a break-glass request (non-saml / non-oidc / non-google, when any is enforced)
+ // In the event of this being a break-glass request (not this org's own SAML / OIDC / LDAP session, nor Google, when any is enforced)
const isAuthEnforcedBypass =
rootOrg.authEnforced &&
rootOrg.bypassOrgAuthEnabled &&
diff --cc backend/src/services/auth/auth-signup-service.ts
index 8bdee202bc,3ca50ecd2e..2ff70aa17d
--- a/backend/src/services/auth/auth-signup-service.ts
+++ b/backend/src/services/auth/auth-signup-service.ts
@@@ -405,7 -405,7 +405,8 @@@ export const authSignupServiceFactory
userAgent: dto.userAgent,
authMethod,
organizationId,
- issuingRootOrgId: decodedToken.issuingRootOrgId
++ issuingRootOrgId: decodedToken.issuingRootOrgId,
+ idpMfaOrgId: decodedToken.idpMfaOrgId
});
return {
diff --cc backend/src/services/auth/auth-type.ts
index 66278c2bed,696537a207..e81845630b
--- a/backend/src/services/auth/auth-type.ts
+++ b/backend/src/services/auth/auth-type.ts
@@@ -111,12 -116,9 +116,13 @@@ export type AuthModeJwtTokenPayload =
accessVersion: number;
organizationId?: string;
subOrganizationId?: string;
+ // Root org whose IdP issued this session. Set only by SAML, OIDC and LDAP logins; absent on
+ // own-credential sessions and on tokens issued before the claim existed, which are taken at
+ // their auth method as before.
+ issuingRootOrgId?: string;
isMfaVerified?: boolean;
mfaMethod?: MfaMethod;
+ idpMfaOrgId?: string;
// Present only on delegated OAuth 2.0 access tokens. Its presence marks the token as
// AuthMode.OAUTH so the default JWT middleware will not accept it as a first-party session.
oauthClientId?: string;
@@@ -133,8 -135,8 +139,9 @@@ export type AuthModeMfaJwtTokenPayload
authMethod: AuthMethod;
userId: string;
organizationId?: string;
+ issuingRootOrgId?: string;
requiredMfaMethod: MfaMethod;
+ idpMfaOrgId?: string;
};
export type AuthModeRefreshJwtTokenPayload = {
@@@ -146,9 -148,9 +153,10 @@@
refreshVersion: number;
organizationId?: string;
subOrganizationId?: string;
+ issuingRootOrgId?: string;
isMfaVerified?: boolean;
mfaMethod?: MfaMethod;
+ idpMfaOrgId?: string;
oauthClientId?: string;
scopes?: string[];
};
@@@ -160,7 -162,7 +168,8 @@@ export type AuthModeSignUpTokenPayload
isEmailVerified: boolean;
aliasId?: string;
organizationId?: string;
+ issuingRootOrgId?: string;
+ idpMfaOrgId?: string;
callbackPort?: string;
// User profile fields for the frontend signup page
email?: string;
diff --cc backend/src/services/oauth-client/oauth-client-types.ts
index 1b32612616,3c3e92e9fc..1e894c58fa
--- a/backend/src/services/oauth-client/oauth-client-types.ts
+++ b/backend/src/services/oauth-client/oauth-client-types.ts
@@@ -76,9 -76,9 +76,10 @@@ export type TOauthConsentDTO =
scope?: string;
userId: string;
authMethod: AuthMethod;
+ issuingRootOrgId?: string;
isMfaVerified?: boolean;
mfaMethod?: MfaMethod;
+ idpMfaOrgId?: string;
ip: string;
};