Skip to content

Commit a08dbd8

Browse files
committed
Improved error handling: test entityIDs
1 parent 6479382 commit a08dbd8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
"require": {
3838
"php": "^8.1",
39-
"simplesamlphp/assert": "^1.0",
39+
"simplesamlphp/saml2": "~5.0.2",
4040
"simplesamlphp/simplesamlphp": "^2.1",
4141
"symfony/http-foundation": "^6.4"
4242
},

src/Auth/Process/Authorize.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace SimpleSAML\Module\authorize\Auth\Process;
66

7-
use SimpleSAML\Assert\Assert;
87
use SimpleSAML\Auth;
98
use SimpleSAML\Error;
109
use SimpleSAML\Module;
10+
use SimpleSAML\SAML2\Assert\Assert;
1111
use SimpleSAML\Utils;
1212

1313
use function array_diff;
@@ -141,12 +141,16 @@ public function __construct(array $config, $reserved)
141141
// Extract spEntityIDs if present
142142
$spEntityIDs = null;
143143
if (isset($values['spEntityIDs'])) {
144-
if (!is_array($values['spEntityIDs'])) {
145-
throw new Error\Exception(sprintf(
144+
Assert::isArray(
145+
$values['spEntityIDs'],
146+
sprintf(
146147
'Filter Authorize: spEntityIDs must be an array for attribute: %s',
147148
var_export($attribute, true),
148-
));
149-
}
149+
),
150+
Error\Exception::class,
151+
);
152+
Assert::allValidEntityID($values['spEntityIDs']);
153+
150154
$spEntityIDs = $values['spEntityIDs'];
151155
unset($values['spEntityIDs']);
152156
}

0 commit comments

Comments
 (0)