Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Chore: Move SAML org check to permission service
Daniel Hougaard08b5975f2668
diff --git a/backend/src/server/routes/v3/login-router.ts b/backend/src/server/routes/v3/login-router.tsindex 62002b7752..4e64d6c09e 100644--- a/backend/src/server/routes/v3/login-router.ts+++ b/backend/src/server/routes/v3/login-router.ts@@ -65,9 +65,9 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {// The decoded JWT token, which contains the auth method.const decodedToken = jwt.verify(authToken, cfg.AUTH_SECRET) as AuthModeJwtTokenPayload;- if (decodedToken.organizationId) {- throw new UnauthorizedError({ message: "You have already selected an organization" });- }+ // if (decodedToken.organizationId) {+ // throw new UnauthorizedError({ message: "You have already selected an organization" });+ // }const user = await server.services.user.getMe(decodedToken.userId);diff --git a/backend/src/services/auth-token/auth-token-service.ts b/backend/src/services/auth-token/auth-token-service.tsindex a5c93e3aa2..5d0011d112 100644--- a/backend/src/services/auth-token/auth-token-service.ts+++ b/backend/src/services/auth-token/auth-token-service.ts@@ -6,8 +6,7 @@ import { TAuthTokens, TAuthTokenSessions } from "@app/db/schemas";import { getConfig } from "@app/lib/config/env";import { UnauthorizedError } from "@app/lib/errors";-import { AuthMethod, AuthModeJwtTokenPayload } from "../auth/auth-type";-import { TOrgDALFactory } from "../org/org-dal";+import { AuthModeJwtTokenPayload } from "../auth/auth-type";import { TUserDALFactory } from "../user/user-dal";import { TTokenDALFactory } from "./auth-token-dal";import { TCreateTokenForUserDTO, TIssueAuthTokenDTO, TokenType, TValidateTokenForUserDTO } from "./auth-token-types";@@ -15,7 +14,6 @@ import { TCreateTokenForUserDTO, TIssueAuthTokenDTO, TokenType, TValidateTokenFotype TAuthTokenServiceFactoryDep = {tokenDAL: TTokenDALFactory;userDAL: Pick<TUserDALFactory, "findById">;- orgDAL: TOrgDALFactory;};export type TAuthTokenServiceFactory = ReturnType<typeof tokenServiceFactory>;@@ -56,7 +54,7 @@ export const getTokenConfig = (tokenType: TokenType) => {}};-export const tokenServiceFactory = ({ tokenDAL, userDAL, orgDAL }: TAuthTokenServiceFactoryDep) => {+export const tokenServiceFactory = ({ tokenDAL, userDAL }: TAuthTokenServiceFactoryDep) => {const createTokenForUser = async ({ type, userId, orgId }: TCreateTokenForUserDTO) => {const { token, ...tkCfg } = getTokenConfig(type);const appCfg = getConfig();@@ -144,18 +142,6 @@ export const tokenServiceFactory = ({ tokenDAL, userDAL, orgDAL }: TAuthTokenSerconst user = await userDAL.findById(session.userId);if (!user || !user.isAccepted) throw new UnauthorizedError({ name: "Token user not found" });- if (token.organizationId) {- const organization = await orgDAL.findById(token.organizationId);-- if (organization.authEnforced) {- const tokenAuthMode = token.authMethod;-- if (![AuthMethod.AZURE_SAML, AuthMethod.OKTA_SAML, AuthMethod.JUMPCLOUD_SAML].includes(tokenAuthMode)) {- throw new UnauthorizedError({ name: "Organization enforces SAML" });- }- }- }-return { user, tokenVersionId: token.tokenVersionId, orgId: token.organizationId };};