From 17b7becfdf755a0783f37b89a1ebb25488bfa932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Jes=C3=BAs=20Pe=C3=B1a=20Rodr=C3=ADguez?= Date: Tue, 1 Jul 2025 12:03:20 +0200 Subject: [PATCH] fix(saml): limit attributes length to satisfy the socialapp restriction (#8145) --- api/src/backend/api/models.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/src/backend/api/models.py b/api/src/backend/api/models.py index a91948c43d..4d56135f2a 100644 --- a/api/src/backend/api/models.py +++ b/api/src/backend/api/models.py @@ -1589,18 +1589,21 @@ class SAMLConfiguration(RowLevelSecurityProtectedModel): provider="saml", client_id=previous_email_domain or self.email_domain ) + client_id = self.email_domain[:191] + name = f"SAML-{self.email_domain}"[:40] + if social_app_qs.exists(): social_app = social_app_qs.first() - social_app.client_id = self.email_domain - social_app.name = f"{self.tenant.name} SAML ({self.email_domain})" + social_app.client_id = client_id + social_app.name = name social_app.settings = settings_dict social_app.save() social_app.sites.set([current_site]) else: social_app = SocialApp.objects.create( provider="saml", - client_id=self.email_domain, - name=f"{self.tenant.name} SAML ({self.email_domain})", + client_id=client_id, + name=name, settings=settings_dict, ) social_app.sites.set([current_site])