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
Check token source before throwing an error for auth enforced scenarios
Carlos Monastyrskie04e11f597b9
diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.tsindex e3afb754a3..e2d628c998 100644--- a/backend/src/services/auth/auth-login-service.ts+++ b/backend/src/services/auth/auth-login-service.ts@@ -453,8 +453,13 @@ export const authLoginServiceFactory = ({const selectedOrg = await orgDAL.findById(organizationId);- // Check if authEnforced is true, if that's the case, throw an error- if (selectedOrg.authEnforced) {+ // Check if authEnforced is true and the current auth method is not an enforced method+ if (+ selectedOrg.authEnforced &&+ !isAuthMethodSaml(decodedToken.authMethod) &&+ decodedToken.authMethod !== AuthMethod.OIDC &&+ decodedToken.authMethod !== AuthMethod.GOOGLE+ ) {throw new BadRequestError({message: "Authentication is required by your organization before you can log in."});