diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.ts index e3afb754a..0e5ed2ad9 100644 --- a/backend/src/services/auth/auth-login-service.ts +++ b/backend/src/services/auth/auth-login-service.ts @@ -453,10 +453,14 @@ 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 + ) { throw new BadRequestError({ - message: "Authentication is required by your organization before you can log in." + message: "Login with the auth method required by your organization." }); }