Skip to content

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

Restrict changing user auth methods if SAML SSO is enforced

Tuan Dangfcdfa424bc18
diff --git a/backend/src/controllers/v2/usersController.ts b/backend/src/controllers/v2/usersController.ts
index 0c78d76675..237d326711 100644
--- a/backend/src/controllers/v2/usersController.ts
+++ b/backend/src/controllers/v2/usersController.ts
@@ -4,6 +4,7 @@ import crypto from "crypto";
import bcrypt from "bcrypt";
import {
APIKeyData,
+ AuthProvider,
MembershipOrg,
TokenVersion,
User
@@ -121,6 +122,10 @@ export const updateAuthProvider = async (req: Request, res: Response) => {
const {
authProvider
} = req.body;
+
+ if (req.user?.authProvider === AuthProvider.OKTA_SAML) return res.status(400).send({
+ message: "Failed to update user authentication method because SAML SSO is enforced"
+ });
const user = await User.findByIdAndUpdate(
req.user._id.toString(),