diff --git a/src/XML/fed/Realm.php b/src/XML/fed/Realm.php new file mode 100644 index 00000000..4e6e93c1 --- /dev/null +++ b/src/XML/fed/Realm.php @@ -0,0 +1,44 @@ +setContent($content); + } + + + /** + * Validate the content of the element. + * + * @param string $content The value to go in the XML textContent + * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure + * @return void + */ + protected function validateContent(string $content): void + { + Assert::validURI($content, SchemaViolationException::class); + } +} diff --git a/src/XML/sp/IssuerName.php b/src/XML/sp/IssuerName.php index da22541f..1172d9dc 100644 --- a/src/XML/sp/IssuerName.php +++ b/src/XML/sp/IssuerName.php @@ -5,6 +5,7 @@ namespace SimpleSAML\WSSecurity\XML\sp; use SimpleSAML\Assert\Assert; +use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\StringElementTrait; /** @@ -38,6 +39,6 @@ public function __construct( */ protected function validateContent(string $content): void { - Assert::validURI($content); + Assert::validURI($content, SchemaViolationException::class); } } diff --git a/tests/WSSecurity/XML/fed/RealmTest.php b/tests/WSSecurity/XML/fed/RealmTest.php new file mode 100644 index 00000000..7bc7a186 --- /dev/null +++ b/tests/WSSecurity/XML/fed/RealmTest.php @@ -0,0 +1,59 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($realm), + ); + } +} diff --git a/tests/resources/xml/fed_Realm.xml b/tests/resources/xml/fed_Realm.xml new file mode 100644 index 00000000..b065de94 --- /dev/null +++ b/tests/resources/xml/fed_Realm.xml @@ -0,0 +1 @@ +urn:x-simplesamlphp:namespace