Skip to content
Snippets Groups Projects
Commit 3ae9b30b authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Add assertions

parent 7f8fd4c0
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "628d965ff7eff1289f11a49069eb444a", "content-hash": "75291382c13b5ddc539af6b2c03fbbc1",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
...@@ -1407,16 +1407,16 @@ ...@@ -1407,16 +1407,16 @@
}, },
{ {
"name": "simplesamlphp/saml2", "name": "simplesamlphp/saml2",
"version": "v4.6.1", "version": "v4.6.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/simplesamlphp/saml2.git", "url": "https://github.com/simplesamlphp/saml2.git",
"reference": "5e46819fdb76657f13e05a8f264d06efd9163c3d" "reference": "22e06ef0081de210e2a7b45b563fd3cccb9feee6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/5e46819fdb76657f13e05a8f264d06efd9163c3d", "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/22e06ef0081de210e2a7b45b563fd3cccb9feee6",
"reference": "5e46819fdb76657f13e05a8f264d06efd9163c3d", "reference": "22e06ef0081de210e2a7b45b563fd3cccb9feee6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1424,7 +1424,7 @@ ...@@ -1424,7 +1424,7 @@
"ext-openssl": "*", "ext-openssl": "*",
"ext-zlib": "*", "ext-zlib": "*",
"php": ">=7.1 || ^8.0", "php": ">=7.1 || ^8.0",
"psr/log": "~1.1", "psr/log": "~1.1 || ^2.0 || ^3.0",
"robrichards/xmlseclibs": "^3.1.1", "robrichards/xmlseclibs": "^3.1.1",
"webmozart/assert": "^1.9" "webmozart/assert": "^1.9"
}, },
...@@ -1459,9 +1459,9 @@ ...@@ -1459,9 +1459,9 @@
"description": "SAML2 PHP library from SimpleSAMLphp", "description": "SAML2 PHP library from SimpleSAMLphp",
"support": { "support": {
"issues": "https://github.com/simplesamlphp/saml2/issues", "issues": "https://github.com/simplesamlphp/saml2/issues",
"source": "https://github.com/simplesamlphp/saml2/tree/v4.6.1" "source": "https://github.com/simplesamlphp/saml2/tree/v4.6.2"
}, },
"time": "2022-05-23T20:49:55+00:00" "time": "2022-06-11T19:47:27+00:00"
}, },
{ {
"name": "symfony/cache", "name": "symfony/cache",
......
...@@ -5,6 +5,7 @@ declare(strict_types=1); ...@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace SimpleSAML\Module\admin\Controller; namespace SimpleSAML\Module\admin\Controller;
use Exception; use Exception;
use SAML2\Constants as C;
use SimpleSAML\Assert\Assert; use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth; use SimpleSAML\Auth;
use SimpleSAML\Configuration; use SimpleSAML\Configuration;
...@@ -195,7 +196,7 @@ class Federation ...@@ -195,7 +196,7 @@ class Federation
$idps = $this->mdHandler->getList('saml20-idp-hosted'); $idps = $this->mdHandler->getList('saml20-idp-hosted');
$saml2entities = []; $saml2entities = [];
$httpUtils = new Utils\HTTP(); $httpUtils = new Utils\HTTP();
$metadataBase = $httpUtils->getBaseURL() . 'saml2/idp/metadata.php'; $metadataBase = Module::getModuleURL('saml/idp/metadata');
if (count($idps) > 1) { if (count($idps) > 1) {
foreach ($idps as $index => $idp) { foreach ($idps as $index => $idp) {
$idp['url'] = $metadataBase . '?idpentityid=' . urlencode($idp['entityid']); $idp['url'] = $metadataBase . '?idpentityid=' . urlencode($idp['entityid']);
...@@ -213,6 +214,9 @@ class Federation ...@@ -213,6 +214,9 @@ class Federation
} }
foreach ($saml2entities as $index => $entity) { foreach ($saml2entities as $index => $entity) {
Assert::stringNotEmpty($entity['entityid'], 'The entityID must be a non-empty string.');
Assert::maxLength($entity['entityid'], C::ENTITYID_MAX_LENGTH, 'The entityID cannot be longer than 1024 characters.');
$builder = new SAMLBuilder($entity['entityid']); $builder = new SAMLBuilder($entity['entityid']);
$builder->addMetadataIdP20($entity['metadata_array']); $builder->addMetadataIdP20($entity['metadata_array']);
$builder->addOrganizationInfo($entity['metadata_array']); $builder->addOrganizationInfo($entity['metadata_array']);
...@@ -252,6 +256,9 @@ class Federation ...@@ -252,6 +256,9 @@ class Federation
} }
foreach ($adfsentities as $index => $entity) { foreach ($adfsentities as $index => $entity) {
Assert::stringNotEmpty($entity['entityid'], 'The entityID must be a non-empty string.');
Assert::maxLength($entity['entityid'], C::ENTITYID_MAX_LENGTH, 'The entityID cannot be longer than 1024 characters.');
$builder = new SAMLBuilder($entity['entityid']); $builder = new SAMLBuilder($entity['entityid']);
$builder->addSecurityTokenServiceType($entity['metadata_array']); $builder->addSecurityTokenServiceType($entity['metadata_array']);
$builder->addOrganizationInfo($entity['metadata_array']); $builder->addOrganizationInfo($entity['metadata_array']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment