diff --git a/backend/src/controllers/v1/membershipOrgController.ts b/backend/src/controllers/v1/membershipOrgController.ts
index b5669a6715..02b99537f1 100644
--- a/backend/src/controllers/v1/membershipOrgController.ts
+++ b/backend/src/controllers/v1/membershipOrgController.ts
@@ -1,6 +1,7 @@
import { Types } from "mongoose";
import { Request, Response } from "express";
import { MembershipOrg, Organization, User } from "../../models";
+import { SSOConfig } from "../../ee/models";
import { deleteMembershipOrg as deleteMemberFromOrg } from "../../helpers/membershipOrg";
import { createToken } from "../../helpers/auth";
import { updateSubscriptionOrgQuantity } from "../../helpers/organization";
@@ -110,6 +111,18 @@ export const inviteUserToOrganization = async (req: Request, res: Response) => {
}
const plan = await EELicenseService.getPlan(organizationId);
+
+ const ssoConfig = await SSOConfig.findOne({
+ organization: new Types.ObjectId(organizationId)
+ });
+
+ if (ssoConfig && ssoConfig.isActive) {
+ // case: SAML SSO is enabled for the organization
+ return res.status(400).send({
+ message:
+ "Failed to invite member due to SAML SSO configured for organization"
+ });
+ }
if (plan.memberLimit !== null) {
// case: limit imposed on number of members allowed
diff --git a/backend/src/ee/controllers/v1/ssoController.ts b/backend/src/ee/controllers/v1/ssoController.ts
index 601d81de4d..4837dfd15b 100644
--- a/backend/src/ee/controllers/v1/ssoController.ts
+++ b/backend/src/ee/controllers/v1/ssoController.ts
@@ -10,6 +10,7 @@ import { getSSOConfigHelper } from "../../helpers/organizations";
import { client } from "../../../config";
import { ResourceNotFoundError } from "../../../utils/errors";
import { getSiteURL } from "../../../config";
+import { EELicenseService } from "../../services";
/**
* Redirect user to appropriate SSO endpoint after successful authentication
@@ -58,6 +59,12 @@ export const updateSSOConfig = async (req: Request, res: Response) => {
cert,
audience
} = req.body;
+
+ const plan = await EELicenseService.getPlan(organizationId);
+
+ if (!plan.samlSSO) return res.status(400).send({
+ message: "Failed to update SAML SSO configuration due to plan restriction. Upgrade plan to update SSO configuration."
+ });
interface PatchUpdate {
authProvider?: string;
@@ -203,6 +210,12 @@ export const createSSOConfig = async (req: Request, res: Response) => {
cert,
audience
} = req.body;
+
+ const plan = await EELicenseService.getPlan(organizationId);
+
+ if (!plan.samlSSO) return res.status(400).send({
+ message: "Failed to create SAML SSO configuration due to plan restriction. Upgrade plan to add SSO configuration."
+ });
const key = await BotOrgService.getSymmetricKey(
new Types.ObjectId(organizationId)
diff --git a/frontend/src/pages/project/[id]/members/index.tsx b/frontend/src/pages/project/[id]/members/index.tsx
index e3284ae9e5..471c1bca7e 100644
--- a/frontend/src/pages/project/[id]/members/index.tsx
+++ b/frontend/src/pages/project/[id]/members/index.tsx
@@ -183,7 +183,9 @@ export default function Users() {