From 623956203460abd77c24a05cea1e7fd260da740e Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Mon, 13 Jun 2022 16:07:45 +0200
Subject: [PATCH] Use SAML2INT limits for entityid

---
 composer.lock                               | 12 ++++++------
 modules/admin/src/Controller/Federation.php |  8 ++++----
 modules/saml/src/Auth/Source/SP.php         |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/composer.lock b/composer.lock
index b07e18744..9868e2154 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1412,16 +1412,16 @@
         },
         {
             "name": "simplesamlphp/saml2",
-            "version": "v4.6.2",
+            "version": "v4.6.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/simplesamlphp/saml2.git",
-                "reference": "22e06ef0081de210e2a7b45b563fd3cccb9feee6"
+                "reference": "bfc9c79dd6b728a41d1de988f545f6e64728a51d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/22e06ef0081de210e2a7b45b563fd3cccb9feee6",
-                "reference": "22e06ef0081de210e2a7b45b563fd3cccb9feee6",
+                "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/bfc9c79dd6b728a41d1de988f545f6e64728a51d",
+                "reference": "bfc9c79dd6b728a41d1de988f545f6e64728a51d",
                 "shasum": ""
             },
             "require": {
@@ -1464,9 +1464,9 @@
             "description": "SAML2 PHP library from SimpleSAMLphp",
             "support": {
                 "issues": "https://github.com/simplesamlphp/saml2/issues",
-                "source": "https://github.com/simplesamlphp/saml2/tree/v4.6.2"
+                "source": "https://github.com/simplesamlphp/saml2/tree/v4.6.3"
             },
-            "time": "2022-06-11T19:47:27+00:00"
+            "time": "2022-06-13T14:04:10+00:00"
         },
         {
             "name": "symfony/cache",
diff --git a/modules/admin/src/Controller/Federation.php b/modules/admin/src/Controller/Federation.php
index ce3b27314..43cbb00fa 100644
--- a/modules/admin/src/Controller/Federation.php
+++ b/modules/admin/src/Controller/Federation.php
@@ -217,8 +217,8 @@ class Federation
                     Assert::validURI($entity['entityid']);
                     Assert::maxLength(
                         $entity['entityid'],
-                        C::ENTITYID_MAX_LENGTH,
-                        'The entityID cannot be longer than 1024 characters.'
+                        C::SAML2INT_ENTITYID_MAX_LENGTH,
+                        sprintf('The entityID cannot be longer than %d characters.', C::SAML2INT_ENTITYID_MAX_LENGTH)
                     );
 
                     $builder = new SAMLBuilder($entity['entityid']);
@@ -263,8 +263,8 @@ class Federation
                     Assert::validURI($entity['entityid']);
                     Assert::maxLength(
                         $entity['entityid'],
-                        C::ENTITYID_MAX_LENGTH,
-                        'The entityID cannot be longer than 1024 characters.'
+                        C::SAML2INT_ENTITYID_MAX_LENGTH,
+                        sprintf('The entityID cannot be longer than %d characters.', C::SAML2INT_ENTITYID_MAX_LENGTH)
                     );
 
                     $builder = new SAMLBuilder($entity['entityid']);
diff --git a/modules/saml/src/Auth/Source/SP.php b/modules/saml/src/Auth/Source/SP.php
index 4b22aba53..9e0f5882d 100644
--- a/modules/saml/src/Auth/Source/SP.php
+++ b/modules/saml/src/Auth/Source/SP.php
@@ -90,8 +90,8 @@ class SP extends \SimpleSAML\Auth\Source
         Assert::validURI($entityId);
         Assert::maxLength(
             $entityId,
-            Constants::ENTITYID_MAX_LENGTH,
-            'The entityID cannot be longer than 1024 characters.'
+            Constants::SAML2INT_ENTITYID_MAX_LENGTH,
+            sprintf('The entityID cannot be longer than %d characters.', Constants::SAML2INT_ENTITYID_MAX_LENGTH)
         );
 
         $this->entityId = $entityId;
-- 
GitLab