diff --git a/.gitattributes b/.gitattributes index 3b911a49..90edfbd5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,8 +5,10 @@ codecov.yml export-ignore .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore -psalm.xml export-ignore -psalm-dev.xml export-ignore +phpstan-baseline.neon export-ignore +phpstan-baseline-dev.neon export-ignore +phpstan.neon export-ignore +phpstan-dev.neon export-ignore phpcs.xml export-ignore phpunit.xml export-ignore .php_cs.dist export-ignore diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 8c9be625..edec41af 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.1', '8.2', '8.3', '8.4'] + php-version: ['8.2', '8.3', '8.4', '8.5'] uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.6 with: @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.1', '8.2', '8.3', '8.4'] + php-versions: ['8.2', '8.3', '8.4', '8.5'] steps: - name: Setup PHP, with composer and extensions @@ -85,15 +85,15 @@ jobs: run: composer install --no-progress --prefer-dist --optimize-autoloader - name: Run unit tests with coverage - if: ${{ matrix.php-versions == '8.4' }} + if: ${{ matrix.php-versions == '8.5' }} run: vendor/bin/phpunit - name: Run unit tests (no coverage) - if: ${{ matrix.php-versions != '8.4' }} + if: ${{ matrix.php-versions != '8.5' }} run: vendor/bin/phpunit --no-coverage - name: Save coverage data - if: ${{ matrix.php-versions == '8.4' }} + if: ${{ matrix.php-versions == '8.5' }} uses: actions/upload-artifact@v5 with: name: coverage-data @@ -107,7 +107,7 @@ jobs: fail-fast: true matrix: operating-system: [windows-latest] - php-versions: ['8.1', '8.2', '8.3', '8.4'] + php-versions: ['8.2', '8.3', '8.4', '8.5'] steps: - name: Setup PHP, with composer and extensions @@ -151,6 +151,7 @@ jobs: quality: name: Quality control + needs: [unit-tests-linux] runs-on: [ubuntu-latest] steps: @@ -160,7 +161,7 @@ jobs: uses: shivammathur/setup-php@v2 with: # Should be the higest supported version, so we can use the newest tools - php-version: '8.4' + php-version: '8.5' tools: composer, composer-require-checker, composer-unused, phpcs extensions: ctype, date, dom, filter, pcre, soap, spl, xml coverage: none @@ -193,7 +194,7 @@ jobs: run: composer-unused - name: PHP Code Sniffer - run: phpcs + run: vendor/bin/phpcs - name: PHPStan run: | @@ -205,14 +206,16 @@ jobs: security: name: Security checks + needs: [unit-tests-linux] runs-on: [ubuntu-latest] + steps: - name: Setup PHP, with composer and extensions # https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v2 with: # Should be the lowest supported version - php-version: '8.1' + php-version: '8.2' extensions: ctype, date, dom, filter, pcre, soap, spl, xml tools: composer coverage: none diff --git a/src/XML/element.registry.php b/classes/element.registry.php similarity index 100% rename from src/XML/element.registry.php rename to classes/element.registry.php diff --git a/codecov.yml b/codecov.yml index fe6a1cf9..4affc05c 100644 --- a/codecov.yml +++ b/codecov.yml @@ -17,4 +17,4 @@ comment: github_checks: annotations: false ignore: - - 'src/XML/element.registry.php' + - 'classes/element.registry.php' diff --git a/composer.json b/composer.json index 2989451c..c2fca837 100644 --- a/composer.json +++ b/composer.json @@ -10,17 +10,18 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "ext-dom": "*", "ext-spl": "*", - "simplesamlphp/assert": "~1.8.1", - "simplesamlphp/saml2": "^5.0", - "simplesamlphp/xml-security": "~1.13.0", - "simplesamlphp/xml-common": "~1.25.0" + "simplesamlphp/assert": "~1.9", + "simplesamlphp/saml2": "~6.0", + "simplesamlphp/xml-common": "~2.4", + "simplesamlphp/xml-security": "~2.0", + "simplesamlphp/xml-soap": "~2.0" }, "require-dev": { - "simplesamlphp/simplesamlphp-test-framework": "~1.9.2" + "simplesamlphp/simplesamlphp-test-framework": "~1.10" }, "autoload": { "psr-4": { diff --git a/resources/schemas/ws-authorization.xsd b/resources/schemas/ws-authorization.xsd index f83faaa9..8766e3b2 100644 --- a/resources/schemas/ws-authorization.xsd +++ b/resources/schemas/ws-authorization.xsd @@ -45,8 +45,8 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - - + + @@ -57,16 +57,16 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - + - - + + - - - + + + diff --git a/src/Assert/Assert.php b/src/Assert/Assert.php index eafe62fb..6d0b9456 100644 --- a/src/Assert/Assert.php +++ b/src/Assert/Assert.php @@ -8,7 +8,12 @@ /** * @package simplesamlphp/ws-security + * + * @method static void validWSUDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void allWSUDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void nullOrValueWSUDateTime(mixed $value, string $message = '', string $exception = '') */ class Assert extends BaseAssert { + use WSUDateTimeTrait; } diff --git a/src/Assert/WSUDateTimeTrait.php b/src/Assert/WSUDateTimeTrait.php new file mode 100644 index 00000000..5b93a883 --- /dev/null +++ b/src/Assert/WSUDateTimeTrait.php @@ -0,0 +1,33 @@ +getMessage()); + } + } +} diff --git a/src/Constants.php b/src/Constants.php index f52b9f69..1be4a3c7 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -16,6 +16,7 @@ class Constants extends \SimpleSAML\SAML2\Constants * The namespace for WS-Addressing protocol. */ public const NS_ADDR_200408 = 'http://schemas.xmlsoap.org/ws/2004/08/addressing'; + public const NS_ADDR_200508 = 'http://www.w3.org/2005/08/addressing'; /** @@ -37,6 +38,7 @@ class Constants extends \SimpleSAML\SAML2\Constants * The namespace for WS-Trust protocol. */ public const NS_TRUST_200502 = 'http://schemas.xmlsoap.org/ws/2005/02/trust'; + public const NS_TRUST_200512 = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/'; /** @@ -48,6 +50,7 @@ class Constants extends \SimpleSAML\SAML2\Constants * The namespace for the Web Service Security Policy protocol. */ public const NS_SEC_POLICY_11 = 'http://schemas.xmlsoap.org/ws/2005/07/securitypolicy'; + public const NS_SEC_POLICY_12 = 'http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702'; /** @@ -79,15 +82,25 @@ class Constants extends \SimpleSAML\SAML2\Constants * The schema-defined wsa fault codes */ public const WSA_FAULT_INVALID_ADDRESSING_HEADER = 'InvalidAddressingHeader'; + public const WSA_FAULT_INVALID_ADDRESS = 'InvalidAddress'; + public const WSA_FAULT_INVALID_EPR = 'InvalidEPR'; + public const WSA_FAULT_INVALID_CARDINALITY = 'InvalidCardinality'; + public const WSA_FAULT_MISSING_ADDRESS_IN_EPR = 'MissingAddressInEPR'; + public const WSA_FAULT_DUPLICATE_MESSAGEID = 'DupicateMessageID'; + public const WSA_FAULT_ACTION_MISMATCH = 'ActionMismatch'; + public const WSA_FAULT_MESSAGE_ADDRESSING_HEADER_REQUIRED = 'MessageAddressingHeaderRequired'; + public const WSA_FAULT_DESTINATION_UNREACHABLE = 'DestinationUnreachable'; + public const WSA_FAULT_ACTION_NOT_SUPPORTED = 'ActionNotSupported'; + public const WSA_FAULT_ENDPOINT_UNAVAILABLE = 'EndpointUnavailable'; public const FAULT_CODES = [ @@ -107,6 +120,7 @@ class Constants extends \SimpleSAML\SAML2\Constants /** */ public const WST_REFID_PIN = 'http://docs.oasis-open.org/ws-sx/ws-trust/200802/challenge/PIN'; + public const WST_REFID_OTP = 'http://docs.oasis-open.org/ws-sx/ws-trust/200802/challenge/OTP'; /** diff --git a/src/Utils/XPath.php b/src/Utils/XPath.php index b8597854..15304bb9 100644 --- a/src/Utils/XPath.php +++ b/src/Utils/XPath.php @@ -19,13 +19,14 @@ class XPath extends \SimpleSAML\XMLSecurity\Utils\XPath * Get a DOMXPath object that can be used to search for WS Security elements. * * @param \DOMNode $node The document to associate to the DOMXPath object. + * @param bool $autoregister Whether to auto-register all namespaces used in the document * * @return \DOMXPath A DOMXPath object ready to use in the given document, with several * ws-related namespaces already registered. */ - public static function getXPath(DOMNode $node): DOMXPath + public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath { - $xp = parent::getXPath($node); + $xp = parent::getXPath($node, $autoregister); $xp->registerNamespace('wsa', C::NS_ADDR_200508); $xp->registerNamespace('wsa', C::NS_ADDR_200408); diff --git a/src/XML/ReferenceIdentifierTrait.php b/src/XML/ReferenceIdentifierTrait.php index 5f7e049a..b61121af 100644 --- a/src/XML/ReferenceIdentifierTrait.php +++ b/src/XML/ReferenceIdentifierTrait.php @@ -4,33 +4,33 @@ namespace SimpleSAML\WSSecurity\XML; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * @package simplesamlphp/ws-security + * + * @phpstan-ignore trait.unused */ trait ReferenceIdentifierTrait { - /** @var string */ - protected string $refId; + /** @var \SimpleSAML\XMLSchema\Type\AnyURIValue */ + protected AnyURIValue $refId; /** - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getRefId(): string + public function getRefId(): AnyURIValue { return $this->refId; } /** - * @param string $refId + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $refId */ - private function setRefId(string $refId): void + private function setRefId(AnyURIValue $refId): void { - Assert::validURI($refId, SchemaViolationException::class); $this->refId = $refId; } } diff --git a/src/XML/auth/AbstractAdditionalContextType.php b/src/XML/auth/AbstractAdditionalContextType.php index 92eec23c..0e3ffd23 100644 --- a/src/XML/auth/AbstractAdditionalContextType.php +++ b/src/XML/auth/AbstractAdditionalContextType.php @@ -7,10 +7,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\auth\ContextItem; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the AdditionalContextType element @@ -22,6 +22,7 @@ abstract class AbstractAdditionalContextType extends AbstractAuthElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -63,7 +64,7 @@ public function getContextItem(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/auth/AbstractClaimType.php b/src/XML/auth/AbstractClaimType.php index 998ee119..fa02b798 100644 --- a/src/XML/auth/AbstractClaimType.php +++ b/src/XML/auth/AbstractClaimType.php @@ -14,15 +14,18 @@ use SimpleSAML\WSSecurity\XML\auth\StructuredValue; use SimpleSAML\WSSecurity\XML\auth\Value; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; -use function array_filter; use function array_merge; use function array_pop; +use function var_export; /** * Class defining the ClaimType element @@ -32,16 +35,21 @@ abstract class AbstractClaimType extends AbstractAuthElement { use ExtendableAttributesTrait; + use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + /** The namespace-attribute for the xs:any element */ + public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + /** * AbstractClaimType constructor * - * @param string $uri - * @param bool|null $optional + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $uri + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $optional * @param \SimpleSAML\WSSecurity\XML\auth\DisplayName|null $displayName * @param \SimpleSAML\WSSecurity\XML\auth\Description|null $description * @param \SimpleSAML\WSSecurity\XML\auth\DisplayValue|null $displayValue @@ -56,15 +64,14 @@ abstract class AbstractClaimType extends AbstractAuthElement * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected string $uri, - protected ?bool $optional = null, + protected AnyURIValue $uri, + protected ?BooleanValue $optional = null, protected ?DisplayName $displayName = null, protected ?Description $description = null, protected ?DisplayValue $displayValue = null, protected null|Value|EncryptedValue|StructuredValue|ConstrainedValue|SerializableElementInterface $value = null, array $namespacedAttributes = [], ) { - Assert::validURI($uri); if ( !($value === null || $value instanceof Value || @@ -72,8 +79,11 @@ final public function __construct( $value instanceof StructuredValue || $value instanceof EncryptedValue) ) { - /** @psalm-var \SimpleSAML\XML\AbstractElement|\SimpleSAML\XML\Chunk $value */ - Assert::notSame($value->getNamespaceURI(), static::NS); + /** @var \SimpleSAML\XML\Chunk|\SimpleSAML\XML\AbstractElement $value */ + Assert::notSame( + $value instanceof Chunk ? $value->getNamespaceURI() : $value::getNamespaceURI(), + static::NS, + ); } $this->setAttributesNS($namespacedAttributes); } @@ -133,9 +143,9 @@ public function getDescription(): ?Description /** * Get the value of the uri property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getURI(): string + public function getURI(): AnyURIValue { return $this->uri; } @@ -144,9 +154,9 @@ public function getURI(): string /** * Get the value of the optional property. * - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getOptional(): ?bool + public function getOptional(): ?BooleanValue { return $this->optional; } @@ -158,7 +168,7 @@ public function getOptional(): ?bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -179,28 +189,20 @@ public static function fromXML(DOMElement $xml): static $structuredValue = StructuredValue::getChildrenOfClass($xml); $encryptedValue = EncryptedValue::getChildrenOfClass($xml); $constrainedValue = ConstrainedValue::getChildrenOfClass($xml); + $otherValue = self::getChildElementsFromXML($xml); - $otherValue = []; - foreach ($xml->childNodes as $child) { - if (!($child instanceof DOMElement)) { - continue; - } elseif ($child->namespaceURI !== static::NS) { - $otherValue[] = new Chunk($child); - } - } - - $value = array_filter(array_merge( + $value = array_merge( $simpleValue, $structuredValue, $encryptedValue, $constrainedValue, $otherValue, - )); + ); Assert::maxCount($value, 1, TooManyElementsException::class); return new static( - self::getAttribute($xml, 'Uri'), - self::getOptionalBooleanAttribute($xml, 'Optional', null), + self::getAttribute($xml, 'Uri', AnyURIValue::class), + self::getOptionalAttribute($xml, 'Optional', BooleanValue::class, null), array_pop($displayName), array_pop($description), array_pop($displayValue), @@ -220,9 +222,9 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Uri', $this->getURI()); + $e->setAttribute('Uri', $this->getURI()->getValue()); if ($this->getOptional() !== null) { - $e->setAttribute('Optional', $this->getOptional() ? 'true' : 'false'); + $e->setAttribute('Optional', var_export($this->getOptional()->toBoolean(), true)); } $this->getDisplayName()?->toXML($e); diff --git a/src/XML/auth/AbstractConstrainedManyValueType.php b/src/XML/auth/AbstractConstrainedManyValueType.php index af274230..be47a326 100644 --- a/src/XML/auth/AbstractConstrainedManyValueType.php +++ b/src/XML/auth/AbstractConstrainedManyValueType.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class representing WS-authorization ConstrainedManyValueType. @@ -72,7 +72,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/auth/AbstractConstrainedSingleValueType.php b/src/XML/auth/AbstractConstrainedSingleValueType.php index eb4af4b9..fc10a7c6 100644 --- a/src/XML/auth/AbstractConstrainedSingleValueType.php +++ b/src/XML/auth/AbstractConstrainedSingleValueType.php @@ -6,8 +6,8 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; @@ -75,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/auth/AbstractConstrainedValueType.php b/src/XML/auth/AbstractConstrainedValueType.php index a2939ca9..69d94846 100644 --- a/src/XML/auth/AbstractConstrainedValueType.php +++ b/src/XML/auth/AbstractConstrainedValueType.php @@ -6,15 +6,16 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; -use function array_filter; use function array_merge; use function array_pop; +use function var_export; /** * Class defining the ConstrainedValueType element @@ -25,6 +26,7 @@ abstract class AbstractConstrainedValueType extends AbstractAuthElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -41,12 +43,12 @@ abstract class AbstractConstrainedValueType extends AbstractAuthElement * \SimpleSAML\WSSecurity\XML\auth\ValueOneOf * ) $value * @param \SimpleSAML\XML\SerializableElementInterface[] $children - * @param bool|null $assertConstraint + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $assertConstraint */ final public function __construct( protected ValueLessThan|ValueLessThanOrEqual|ValueGreaterThan|ValueGreaterThanOrEqual|ValueInRangen|ValueOneOf $value, array $children = [], - protected ?bool $assertConstraint = null, + protected ?BooleanValue $assertConstraint = null, ) { $this->setElements($children); } @@ -73,9 +75,9 @@ public function getValue(): ValueLessThan|ValueLessThanOrEqual|ValueGreaterThan| /** * Get the value of the assertConstraint property. * - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getAssertConstraint(): ?bool + public function getAssertConstraint(): ?BooleanValue { return $this->assertConstraint; } @@ -87,7 +89,7 @@ public function getAssertConstraint(): ?bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -102,21 +104,21 @@ public static function fromXML(DOMElement $xml): static $valueInRangen = ValueInRangen::getChildrenOfClass($xml); $valueOneOf = ValueOneOf::getChildrenOfClass($xml); - $value = array_filter(array_merge( + $value = array_merge( $valueLessThan, $valueLessThanOrEqual, $valueGreaterThan, $valueGreaterThanOrEqual, $valueInRangen, $valueOneOf, - )); + ); Assert::minCount($value, 1, MissingElementException::class); Assert::maxCount($value, 1, TooManyElementsException::class); return new static( array_pop($value), self::getChildElementsFromXML($xml), - self::getOptionalBooleanAttribute($xml, 'AssertConstraint', null), + self::getOptionalAttribute($xml, 'AssertConstraint', BooleanValue::class, null), ); } @@ -132,12 +134,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getAssertConstraint() !== null) { - $e->setAttribute('AssertConstraint', $this->getAssertConstraint() ? 'true' : 'false'); + $e->setAttribute('AssertConstraint', var_export($this->getAssertConstraint()->toBoolean(), true)); } $this->getValue()->toXML($e); - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/auth/AbstractContextItemType.php b/src/XML/auth/AbstractContextItemType.php index eac4f84a..de0e6486 100644 --- a/src/XML/auth/AbstractContextItemType.php +++ b/src/XML/auth/AbstractContextItemType.php @@ -6,13 +6,14 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -26,6 +27,7 @@ abstract class AbstractContextItemType extends AbstractAuthElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -36,22 +38,19 @@ abstract class AbstractContextItemType extends AbstractAuthElement /** * AbstractContextItemType constructor * - * @param string $Name - * @param string|null $Scope + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $Name + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Scope * @param \SimpleSAML\WSSecurity\XML\auth\Value|null $value * @param \SimpleSAML\XML\SerializableElementInterface|null $child * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected string $Name, - protected ?string $Scope = null, + protected AnyURIValue $Name, + protected ?AnyURIValue $Scope = null, protected ?Value $value = null, ?SerializableElementInterface $child = null, array $namespacedAttributes = [], ) { - Assert::validURI($Name); - Assert::nullOrValidURI($Scope); - // One of both must exist, they can't be both null Assert::inArray(null, [$value, $child], SchemaViolationException::class); Assert::notSame($value, $child, SchemaViolationException::class); @@ -77,9 +76,9 @@ public function getValue(): ?Value /** * Get the value of the Name property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getName(): string + public function getName(): AnyURIValue { return $this->Name; } @@ -88,9 +87,9 @@ public function getName(): string /** * Get the value of the Scope property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getScope(): ?string + public function getScope(): ?AnyURIValue { return $this->Scope; } @@ -102,7 +101,7 @@ public function getScope(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -117,8 +116,8 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($children, 1, TooManyElementsException::class); return new static( - self::getAttribute($xml, 'Name'), - self::getOptionalAttribute($xml, 'Scope'), + self::getAttribute($xml, 'Name', AnyURIValue::class), + self::getOptionalAttribute($xml, 'Scope', AnyURIValue::class, null), array_pop($value), array_pop($children), self::getAttributesNSFromXML($xml), @@ -136,9 +135,9 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Name', $this->getName()); + $e->setAttribute('Name', $this->getName()->getValue()); if ($this->getScope() !== null) { - $e->setAttribute('Scope', $this->getScope()); + $e->setAttribute('Scope', $this->getScope()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/auth/AbstractDescriptionType.php b/src/XML/auth/AbstractDescriptionType.php index 624228d1..b10a2de7 100644 --- a/src/XML/auth/AbstractDescriptionType.php +++ b/src/XML/auth/AbstractDescriptionType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-authorization DescriptionType. @@ -19,7 +20,11 @@ abstract class AbstractDescriptionType extends AbstractAuthElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -28,10 +33,10 @@ abstract class AbstractDescriptionType extends AbstractAuthElement /** * AbstractDescriptionType constructor. * - * @param string $value The value string. + * @param \SimpleSAML\XMLSchema\Type\StringValue $value The value string. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(StringValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); @@ -44,7 +49,7 @@ final public function __construct(string $value, array $namespacedAttributes = [ * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -52,7 +57,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(StringValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml)); } @@ -65,7 +70,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/auth/AbstractDisplayNameType.php b/src/XML/auth/AbstractDisplayNameType.php index 28bdb85a..8f064ee3 100644 --- a/src/XML/auth/AbstractDisplayNameType.php +++ b/src/XML/auth/AbstractDisplayNameType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-authorization DisplayNameType. @@ -19,7 +20,11 @@ abstract class AbstractDisplayNameType extends AbstractAuthElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -28,10 +33,10 @@ abstract class AbstractDisplayNameType extends AbstractAuthElement /** * AbstractDisplayNameType constructor. * - * @param string $value The value string. + * @param \SimpleSAML\XMLSchema\Type\StringValue $value The value string. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(StringValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); @@ -44,7 +49,7 @@ final public function __construct(string $value, array $namespacedAttributes = [ * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -52,7 +57,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(StringValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml)); } @@ -65,7 +70,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/auth/AbstractDisplayValueType.php b/src/XML/auth/AbstractDisplayValueType.php index 77118adf..a9805c99 100644 --- a/src/XML/auth/AbstractDisplayValueType.php +++ b/src/XML/auth/AbstractDisplayValueType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-authorization DisplayValueType. @@ -19,7 +20,11 @@ abstract class AbstractDisplayValueType extends AbstractAuthElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -28,10 +33,10 @@ abstract class AbstractDisplayValueType extends AbstractAuthElement /** * AbstractDisplayValueType constructor. * - * @param string $value The value string. + * @param \SimpleSAML\XMLSchema\Type\StringValue $value The value string. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(StringValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); @@ -44,7 +49,7 @@ final public function __construct(string $value, array $namespacedAttributes = [ * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -52,7 +57,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(StringValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml)); } @@ -65,7 +70,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/auth/AbstractEncryptedValueType.php b/src/XML/auth/AbstractEncryptedValueType.php index caaa1b73..5946632c 100644 --- a/src/XML/auth/AbstractEncryptedValueType.php +++ b/src/XML/auth/AbstractEncryptedValueType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use SimpleSAML\XMLSecurity\XML\xenc\EncryptedData; use function array_pop; @@ -25,22 +25,21 @@ abstract class AbstractEncryptedValueType extends AbstractAuthElement * AbstractEncryptedValueType constructor. * * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedData $encryptedData - * @param string|null $descriptionCondition + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $descriptionCondition */ final public function __construct( protected EncryptedData $encryptedData, - protected ?string $descriptionCondition = null, + protected ?AnyURIValue $descriptionCondition = null, ) { - Assert::nullOrValidURI($descriptionCondition, SchemaViolationException::class); } /** * Get the value of the $descriptionCondition property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getDescriptionCondition(): ?string + public function getDescriptionCondition(): ?AnyURIValue { return $this->descriptionCondition; } @@ -63,7 +62,7 @@ public function getEncryptedData(): EncryptedData * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -77,7 +76,7 @@ public static function fromXML(DOMElement $xml): static return new static( array_pop($encryptedData), - self::getOptionalAttribute($xml, 'DescriptionCondition', null), + self::getOptionalAttribute($xml, 'DescriptionCondition', AnyURIValue::class, null), ); } @@ -91,7 +90,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('DescriptionCondition', $this->getDescriptionCondition()); + $e->setAttribute('DescriptionCondition', $this->getDescriptionCondition()->getValue()); $this->getEncryptedData()->toXML($e); diff --git a/src/XML/auth/AbstractStructuredValueType.php b/src/XML/auth/AbstractStructuredValueType.php index fd7c93ab..e11c7b98 100644 --- a/src/XML/auth/AbstractStructuredValueType.php +++ b/src/XML/auth/AbstractStructuredValueType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the StructuredValueType element @@ -21,6 +21,7 @@ abstract class AbstractStructuredValueType extends AbstractAuthElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -52,7 +53,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -81,7 +82,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/auth/AbstractValueInRangeType.php b/src/XML/auth/AbstractValueInRangeType.php index e7bd0b48..678cb095 100644 --- a/src/XML/auth/AbstractValueInRangeType.php +++ b/src/XML/auth/AbstractValueInRangeType.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_pop; @@ -36,7 +36,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/auth/AdditionalContext.php b/src/XML/auth/AdditionalContext.php index 3947be4c..d7441da8 100644 --- a/src/XML/auth/AdditionalContext.php +++ b/src/XML/auth/AdditionalContext.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\auth; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing WS-authorization AdditionalContext. diff --git a/src/XML/auth/ClaimType.php b/src/XML/auth/ClaimType.php index 46662f70..5ec7d3e9 100644 --- a/src/XML/auth/ClaimType.php +++ b/src/XML/auth/ClaimType.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\auth; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing WS-authorization ClaimType. diff --git a/src/XML/auth/Value.php b/src/XML/auth/Value.php index 8d7c745e..2dd7dd04 100644 --- a/src/XML/auth/Value.php +++ b/src/XML/auth/Value.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\auth; -use SimpleSAML\XML\StringElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; /** * Class representing WS-authorization Value. @@ -13,14 +14,9 @@ */ final class Value extends AbstractAuthElement { - use StringElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; } diff --git a/src/XML/fed/AbstractApplicationServiceType.php b/src/XML/fed/AbstractApplicationServiceType.php index e94b34a0..a7202ec6 100644 --- a/src/XML/fed/AbstractApplicationServiceType.php +++ b/src/XML/fed/AbstractApplicationServiceType.php @@ -4,14 +4,20 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use DateTimeImmutable; use DOMElement; +use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\Extensions; use SimpleSAML\SAML2\XML\md\Organization; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * A ApplicationServiceType @@ -33,12 +39,17 @@ abstract class AbstractApplicationServiceType extends AbstractWebServiceDescript /** * ApplicationServiceType constructor. * - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi-type of the element + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * Unix time of validity for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration + * Maximum time this document can be cached. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL + * An URI where to redirect users for support. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -53,19 +64,20 @@ abstract class AbstractApplicationServiceType extends AbstractWebServiceDescript * @param \SimpleSAML\WSSecurity\XML\fed\ClaimTypesRequested|null $claimTypesRequested * @param \SimpleSAML\WSSecurity\XML\fed\AutomaticPseudonyms|null $automaticPseudonyms * @param \SimpleSAML\WSSecurity\XML\fed\TargetScopes|null $targetScopes - * @param string|null $serviceDisplayName - * @param string|null $serviceDescription + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDisplayName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDescription * @param \SimpleSAML\WSSecurity\XML\fed\ApplicationServiceEndpoint[] $applicationServiceEndpoint * @param \SimpleSAML\WSSecurity\XML\fed\SingleSignOutNotificationEndpoint[] $singleSignOutNotificationEndpoint * @param \SimpleSAML\WSSecurity\XML\fed\PassiveRequestorEndpoint[] $passiveRequestorEndpoint */ final public function __construct( - array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + QNameValue $type, + SAMLAnyURIListValue $protocolSupportEnumeration, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptor = [], ?Organization $organization = null, array $contact = [], @@ -77,8 +89,8 @@ final public function __construct( ?ClaimTypesRequested $claimTypesRequested = null, ?AutomaticPseudonyms $automaticPseudonyms = null, ?TargetScopes $targetScopes = null, - ?string $serviceDisplayName = null, - ?string $serviceDescription = null, + ?SAMLStringValue $serviceDisplayName = null, + ?SAMLStringValue $serviceDescription = null, protected array $applicationServiceEndpoint = [], protected array $singleSignOutNotificationEndpoint = [], protected array $passiveRequestorEndpoint = [], @@ -101,7 +113,7 @@ final public function __construct( ); parent::__construct( - static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME, + $type, $protocolSupportEnumeration, $ID, $validUntil, diff --git a/src/XML/fed/AbstractAssertionType.php b/src/XML/fed/AbstractAssertionType.php index 90be0b69..8cca9e49 100644 --- a/src/XML/fed/AbstractAssertionType.php +++ b/src/XML/fed/AbstractAssertionType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the AssertionType element @@ -21,6 +21,7 @@ abstract class AbstractAssertionType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -61,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -90,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractAttributeExtensibleString.php b/src/XML/fed/AbstractAttributeExtensibleString.php index d54cdd6f..f84018b8 100644 --- a/src/XML/fed/AbstractAttributeExtensibleString.php +++ b/src/XML/fed/AbstractAttributeExtensibleString.php @@ -5,11 +5,10 @@ namespace SimpleSAML\WSSecurity\XML\fed; use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * An AbstractAttributeExtensibleString element @@ -19,41 +18,27 @@ abstract class AbstractAttributeExtensibleString extends AbstractFedElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** - * @param string $content + * @param \SimpleSAML\XMLSchema\Type\StringValue $content * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ - final public function __construct(string $content, array $namespacedAttributes = []) + public function __construct(StringValue $content, array $namespacedAttributes = []) { $this->setContent($content); $this->setAttributesNS($namespacedAttributes); } - /** - * Create a class from XML - * - * @param \DOMElement $xml - * @return static - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - - return new static( - $xml->textContent, - self::getAttributesNSFromXML($xml), - ); - } - - /** * Create XML from this class * @@ -63,7 +48,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/fed/AbstractAttributeExtensibleURI.php b/src/XML/fed/AbstractAttributeExtensibleURI.php index a7498fc5..edd6c7d8 100644 --- a/src/XML/fed/AbstractAttributeExtensibleURI.php +++ b/src/XML/fed/AbstractAttributeExtensibleURI.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\URIElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * An AbstractAttributeExtensibleURI element @@ -18,18 +19,22 @@ */ abstract class AbstractAttributeExtensibleURI extends AbstractFedElement { - use URIElementTrait; + use TypedTextContentTrait; use ExtendableAttributesTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** - * @param string $content + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $content * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ - final public function __construct(string $content, array $namespacedAttributes = []) + final public function __construct(AnyURIValue $content, array $namespacedAttributes = []) { $this->setContent($content); $this->setAttributesNS($namespacedAttributes); @@ -48,7 +53,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, + AnyURIValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml), ); } @@ -63,7 +68,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/fed/AbstractAttributeServiceType.php b/src/XML/fed/AbstractAttributeServiceType.php index c3b4274a..0708a9d3 100644 --- a/src/XML/fed/AbstractAttributeServiceType.php +++ b/src/XML/fed/AbstractAttributeServiceType.php @@ -4,14 +4,20 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use DateTimeImmutable; use DOMElement; +use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\Extensions; use SimpleSAML\SAML2\XML\md\Organization; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * A AttributeServiceType @@ -33,12 +39,17 @@ abstract class AbstractAttributeServiceType extends AbstractWebServiceDescriptor /** * AttributeServiceType constructor. * - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi-type of the element + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * Unix time of validity for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration + * Maximum time this document can be cached. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL + * An URI where to redirect users for support. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -53,18 +64,19 @@ abstract class AbstractAttributeServiceType extends AbstractWebServiceDescriptor * @param \SimpleSAML\WSSecurity\XML\fed\ClaimTypesRequested|null $claimTypesRequested * @param \SimpleSAML\WSSecurity\XML\fed\AutomaticPseudonyms|null $automaticPseudonyms * @param \SimpleSAML\WSSecurity\XML\fed\TargetScopes|null $targetScopes - * @param string|null $serviceDisplayName - * @param string|null $serviceDescription + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDisplayName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDescription * @param \SimpleSAML\WSSecurity\XML\fed\AttributeServiceEndpoint[] $attributeServiceEndpoint * @param \SimpleSAML\WSSecurity\XML\fed\SingleSignOutNotificationEndpoint[] $singleSignOutNotificationEndpoint */ final public function __construct( - array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + QNameValue $type, + SAMLAnyURIListValue $protocolSupportEnumeration, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptor = [], ?Organization $organization = null, array $contact = [], @@ -76,8 +88,8 @@ final public function __construct( ?ClaimTypesRequested $claimTypesRequested = null, ?AutomaticPseudonyms $automaticPseudonyms = null, ?TargetScopes $targetScopes = null, - ?string $serviceDisplayName = null, - ?string $serviceDescription = null, + ?SAMLStringValue $serviceDisplayName = null, + ?SAMLStringValue $serviceDescription = null, protected array $attributeServiceEndpoint = [], protected array $singleSignOutNotificationEndpoint = [], ) { @@ -94,7 +106,7 @@ final public function __construct( ); parent::__construct( - static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME, + $type, $protocolSupportEnumeration, $ID, $validUntil, diff --git a/src/XML/fed/AbstractClaimDialectType.php b/src/XML/fed/AbstractClaimDialectType.php index 77f38ad5..fd9f4134 100644 --- a/src/XML/fed/AbstractClaimDialectType.php +++ b/src/XML/fed/AbstractClaimDialectType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ClaimDialectType element @@ -22,6 +22,7 @@ abstract class AbstractClaimDialectType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -32,16 +33,15 @@ abstract class AbstractClaimDialectType extends AbstractFedElement /** * AbstractClaimDialectType constructor * - * @param string|null $Uri + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Uri * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $Uri = null, + protected ?AnyURIValue $Uri = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($Uri, SchemaViolationException::class); // Next one is debatable since the schema allows an empty element, but that makes zero sense Assert::allNotEmpty([$Uri, $children, $namespacedAttributes]); @@ -51,9 +51,9 @@ final public function __construct( /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getUri(): ?string + public function getUri(): ?AnyURIValue { return $this->Uri; } @@ -65,7 +65,7 @@ public function getUri(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -74,7 +74,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Uri', null), + self::getOptionalAttribute($xml, 'Uri', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -92,14 +92,13 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getUri() !== null) { - $e->setAttribute('Uri', $this->getUri()); + $e->setAttribute('Uri', $this->getUri()->getValue()); } foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractClaimDialectsOfferedType.php b/src/XML/fed/AbstractClaimDialectsOfferedType.php index 0d81f62b..b5853d5e 100644 --- a/src/XML/fed/AbstractClaimDialectsOfferedType.php +++ b/src/XML/fed/AbstractClaimDialectsOfferedType.php @@ -7,11 +7,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\fed\ClaimDialect; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ClaimDialectsOfferedType element @@ -22,6 +22,7 @@ abstract class AbstractClaimDialectsOfferedType extends AbstractFedElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -58,7 +59,7 @@ public function getClaimDialect(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractClaimTypesOfferedType.php b/src/XML/fed/AbstractClaimTypesOfferedType.php index 76222811..31176725 100644 --- a/src/XML/fed/AbstractClaimTypesOfferedType.php +++ b/src/XML/fed/AbstractClaimTypesOfferedType.php @@ -7,11 +7,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\auth\ClaimType; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ClaimTypesOfferedType element @@ -22,6 +22,7 @@ abstract class AbstractClaimTypesOfferedType extends AbstractFedElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -58,7 +59,7 @@ public function getClaimType(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractClaimTypesRequestedType.php b/src/XML/fed/AbstractClaimTypesRequestedType.php index 36ae5a75..e61a9c39 100644 --- a/src/XML/fed/AbstractClaimTypesRequestedType.php +++ b/src/XML/fed/AbstractClaimTypesRequestedType.php @@ -7,11 +7,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\auth\ClaimType; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ClaimTypesRequestedType element @@ -22,6 +22,7 @@ abstract class AbstractClaimTypesRequestedType extends AbstractFedElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -58,7 +59,7 @@ public function getClaimType(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractClientPseudonymType.php b/src/XML/fed/AbstractClientPseudonymType.php index 252e35cb..e04face0 100644 --- a/src/XML/fed/AbstractClientPseudonymType.php +++ b/src/XML/fed/AbstractClientPseudonymType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractClientPseudonymType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -100,7 +101,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -145,7 +146,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractEndpointType.php b/src/XML/fed/AbstractEndpointType.php index 119158ef..a1e3b777 100644 --- a/src/XML/fed/AbstractEndpointType.php +++ b/src/XML/fed/AbstractEndpointType.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\wsa_200508\EndpointReference; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; /** * An EndpointType @@ -45,7 +45,7 @@ public function getEndpointReference(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractFederationMetadataHandlerType.php b/src/XML/fed/AbstractFederationMetadataHandlerType.php index a73b9567..dfb5ef1e 100644 --- a/src/XML/fed/AbstractFederationMetadataHandlerType.php +++ b/src/XML/fed/AbstractFederationMetadataHandlerType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the FederationMetadataHandlerType element @@ -19,6 +19,7 @@ abstract class AbstractFederationMetadataHandlerType extends AbstractFedElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -52,7 +53,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractFederationMetadataType.php b/src/XML/fed/AbstractFederationMetadataType.php index 90a1d27f..fb3f2e7b 100644 --- a/src/XML/fed/AbstractFederationMetadataType.php +++ b/src/XML/fed/AbstractFederationMetadataType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the FederationMetadataType element @@ -21,6 +21,7 @@ abstract class AbstractFederationMetadataType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -61,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -90,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractFederationType.php b/src/XML/fed/AbstractFederationType.php index 95f3e38a..5da7f2d7 100644 --- a/src/XML/fed/AbstractFederationType.php +++ b/src/XML/fed/AbstractFederationType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the FederationType element @@ -22,6 +22,7 @@ abstract class AbstractFederationType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -32,26 +33,24 @@ abstract class AbstractFederationType extends AbstractFedElement /** * AbstractFederationType constructor * - * @param string|null $FederationID + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $FederationID * @param list<\SimpleSAML\XML\SerializableElementInterface> $children * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $FederationID = null, + protected ?AnyURIValue $FederationID = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($FederationID, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getFederationID(): ?string + public function getFederationID(): ?AnyURIValue { return $this->FederationID; } @@ -76,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,7 +84,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'FederationID', null), + self::getOptionalAttribute($xml, 'FederationID', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -103,14 +102,13 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getFederationID() !== null) { - $e->setAttribute('FederationID', $this->getFederationID()); + $e->setAttribute('FederationID', $this->getFederationID()->getValue()); } foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractFilterPseudonymsType.php b/src/XML/fed/AbstractFilterPseudonymsType.php index 72899a71..71f2bc4e 100644 --- a/src/XML/fed/AbstractFilterPseudonymsType.php +++ b/src/XML/fed/AbstractFilterPseudonymsType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A FilterPseudonymsType @@ -22,6 +22,7 @@ abstract class AbstractFilterPseudonymsType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -90,7 +91,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractFreshnessType.php b/src/XML/fed/AbstractFreshnessType.php index 46f72196..a5e55993 100644 --- a/src/XML/fed/AbstractFreshnessType.php +++ b/src/XML/fed/AbstractFreshnessType.php @@ -6,15 +6,14 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\UnsignedIntValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; -use function intval; -use function sprintf; -use function strval; +use function var_export; /** * Class defining the FreshnessType element @@ -23,9 +22,13 @@ */ abstract class AbstractFreshnessType extends AbstractFedElement { - use StringElementTrait; + use TypedTextContentTrait; use ExtendableAttributesTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = UnsignedIntValue::class; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -33,46 +36,24 @@ abstract class AbstractFreshnessType extends AbstractFedElement /** * AbstractFreshnessType constructor * - * @param int $content - * @param bool|null $AllowCache + * @param \SimpleSAML\XMLSchema\Type\UnsignedIntValue $content + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $AllowCache * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - int $content, - protected ?bool $AllowCache = null, + UnsignedIntValue $content, + protected ?BooleanValue $AllowCache = null, array $namespacedAttributes = [], ) { - $this->setContent(strval($content)); + $this->setContent($content); $this->setAttributesNS($namespacedAttributes); } /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - Assert::natural( - intval($content), - sprintf( - 'The value \'%s\' of an %s:%s element must an unsigned integer.', - $content, - static::NS_PREFIX, - static::getLocalName(), - ), - SchemaViolationException::class, - ); - } - - - /** - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getAllowCache(): ?bool + public function getAllowCache(): ?BooleanValue { return $this->AllowCache; } @@ -84,18 +65,17 @@ public function getAllowCache(): ?bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static { Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - Assert::integerish($xml->textContent, SchemaViolationException::class); return new static( - intval($xml->textContent), - self::getOptionalBooleanAttribute($xml, 'AllowCache', null), + UnsignedIntValue::fromString($xml->textContent), + self::getOptionalAttribute($xml, 'AllowCache', BooleanValue::class, null), self::getAttributesNSFromXML($xml), ); } @@ -110,10 +90,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = parent::instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); if ($this->getAllowCache() !== null) { - $e->setAttribute('AllowCache', $this->getAllowCache() ? 'true' : 'false'); + $e->setAttribute('AllowCache', var_export($this->getAllowCache()->toBoolean(), true)); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/fed/AbstractIssuerNameType.php b/src/XML/fed/AbstractIssuerNameType.php index 7e893b60..52e5df09 100644 --- a/src/XML/fed/AbstractIssuerNameType.php +++ b/src/XML/fed/AbstractIssuerNameType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the IssuerNameType element @@ -20,6 +20,7 @@ abstract class AbstractIssuerNameType extends AbstractFedElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -27,23 +28,21 @@ abstract class AbstractIssuerNameType extends AbstractFedElement /** * AbstractIssuerNameType constructor * - * @param string $Uri + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $Uri * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected string $Uri, + protected AnyURIValue $Uri, array $namespacedAttributes = [], ) { - Assert::validURI($Uri, SchemaViolationException::class); - $this->setAttributesNS($namespacedAttributes); } /** - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getUri(): string + public function getUri(): AnyURIValue { return $this->Uri; } @@ -55,7 +54,7 @@ public function getUri(): string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -64,7 +63,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getAttribute($xml, 'Uri'), + self::getAttribute($xml, 'Uri', AnyURIValue::class), self::getAttributesNSFromXML($xml), ); } @@ -79,7 +78,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = parent::instantiateParentElement($parent); - $e->setAttribute('Uri', $this->getUri()); + $e->setAttribute('Uri', $this->getUri()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/fed/AbstractLogicalServiceNamesOfferedType.php b/src/XML/fed/AbstractLogicalServiceNamesOfferedType.php index 99e1833d..5e63dfb8 100644 --- a/src/XML/fed/AbstractLogicalServiceNamesOfferedType.php +++ b/src/XML/fed/AbstractLogicalServiceNamesOfferedType.php @@ -7,11 +7,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\fed\IssuerName; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the LogicalServiceNamesOfferedType element @@ -22,6 +21,7 @@ abstract class AbstractLogicalServiceNamesOfferedType extends AbstractFedElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -36,7 +36,7 @@ final public function __construct( protected array $issuerName, array $namespacedAttributes = [], ) { - Assert::notEmpty($issuerName, SchemaViolationException::class); + Assert::minCount($issuerName, 1, MissingElementException::class); Assert::allIsInstanceOf($issuerName, IssuerName::class); $this->setAttributesNS($namespacedAttributes); @@ -58,7 +58,7 @@ public function getIssuerName(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractProofTokenType.php b/src/XML/fed/AbstractProofTokenType.php index ae5ef5ad..7ac99638 100644 --- a/src/XML/fed/AbstractProofTokenType.php +++ b/src/XML/fed/AbstractProofTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ProofTokenType element @@ -23,6 +23,7 @@ abstract class AbstractProofTokenType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -51,7 +52,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -84,7 +85,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractPseudonymBasisType.php b/src/XML/fed/AbstractPseudonymBasisType.php index 816c9d0f..2544ce4c 100644 --- a/src/XML/fed/AbstractPseudonymBasisType.php +++ b/src/XML/fed/AbstractPseudonymBasisType.php @@ -6,13 +6,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -26,6 +26,7 @@ abstract class AbstractPseudonymBasisType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -54,7 +55,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -87,7 +88,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractPseudonymServiceType.php b/src/XML/fed/AbstractPseudonymServiceType.php index b2cc1344..ff2637b2 100644 --- a/src/XML/fed/AbstractPseudonymServiceType.php +++ b/src/XML/fed/AbstractPseudonymServiceType.php @@ -4,14 +4,20 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use DateTimeImmutable; use DOMElement; +use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\Extensions; use SimpleSAML\SAML2\XML\md\Organization; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * A PseudonymServiceType @@ -33,12 +39,17 @@ abstract class AbstractPseudonymServiceType extends AbstractWebServiceDescriptor /** * PseudonymServiceType constructor. * - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * Unix time of validity for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration + * Maximum time this document can be cached. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL + * An URI where to redirect users for support. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -53,18 +64,19 @@ abstract class AbstractPseudonymServiceType extends AbstractWebServiceDescriptor * @param \SimpleSAML\WSSecurity\XML\fed\ClaimTypesRequested|null $claimTypesRequested * @param \SimpleSAML\WSSecurity\XML\fed\AutomaticPseudonyms|null $automaticPseudonyms * @param \SimpleSAML\WSSecurity\XML\fed\TargetScopes|null $targetScopes - * @param string|null $serviceDisplayName - * @param string|null $serviceDescription + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDisplayName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDescription * @param \SimpleSAML\WSSecurity\XML\fed\PseudonymServiceEndpoint[] $pseudonymServiceEndpoint * @param \SimpleSAML\WSSecurity\XML\fed\SingleSignOutNotificationEndpoint[] $singleSignOutNotificationEndpoint */ final public function __construct( - array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + QNameValue $type, + SAMLAnyURIListValue $protocolSupportEnumeration, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptor = [], ?Organization $organization = null, array $contact = [], @@ -76,8 +88,8 @@ final public function __construct( ?ClaimTypesRequested $claimTypesRequested = null, ?AutomaticPseudonyms $automaticPseudonyms = null, ?TargetScopes $targetScopes = null, - ?string $serviceDisplayName = null, - ?string $serviceDescription = null, + ?SAMLStringValue $serviceDisplayName = null, + ?SAMLStringValue $serviceDescription = null, protected array $pseudonymServiceEndpoint = [], protected array $singleSignOutNotificationEndpoint = [], ) { @@ -94,7 +106,7 @@ final public function __construct( ); parent::__construct( - static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME, + $type, $protocolSupportEnumeration, $ID, $validUntil, diff --git a/src/XML/fed/AbstractPseudonymType.php b/src/XML/fed/AbstractPseudonymType.php index 20955d4e..0a82f649 100644 --- a/src/XML/fed/AbstractPseudonymType.php +++ b/src/XML/fed/AbstractPseudonymType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A PseudonymType @@ -22,6 +22,7 @@ abstract class AbstractPseudonymType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -82,7 +83,7 @@ public function getRelativeTo(): RelativeTo * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractReferenceDigestType.php b/src/XML/fed/AbstractReferenceDigestType.php index ba478a8d..03403066 100644 --- a/src/XML/fed/AbstractReferenceDigestType.php +++ b/src/XML/fed/AbstractReferenceDigestType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Base64ElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * An AbstractReferenceDigestType element @@ -19,17 +20,21 @@ abstract class AbstractReferenceDigestType extends AbstractFedElement { use ExtendableAttributesTrait; - use Base64ElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = Base64BinaryValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** - * @param string $content + * @param \SimpleSAML\XMLSchema\Type\Base64BinaryValue $content * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ - final public function __construct(string $content, array $namespacedAttributes) + final public function __construct(Base64BinaryValue $content, array $namespacedAttributes) { $this->setContent($content); $this->setAttributesNS($namespacedAttributes); @@ -48,7 +53,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, + Base64BinaryValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml), ); } @@ -63,7 +68,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/fed/AbstractReferenceTokenType.php b/src/XML/fed/AbstractReferenceTokenType.php index 615863c7..7c318baf 100644 --- a/src/XML/fed/AbstractReferenceTokenType.php +++ b/src/XML/fed/AbstractReferenceTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A ReferenceTokenType @@ -23,6 +23,7 @@ abstract class AbstractReferenceTokenType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -110,7 +111,7 @@ public function getSerialNo(): ?SerialNo * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -156,7 +157,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractRelativeToType.php b/src/XML/fed/AbstractRelativeToType.php index e0d16515..02f02412 100644 --- a/src/XML/fed/AbstractRelativeToType.php +++ b/src/XML/fed/AbstractRelativeToType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RelativeToType element @@ -21,6 +21,7 @@ abstract class AbstractRelativeToType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -61,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -90,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractRequestProofTokenType.php b/src/XML/fed/AbstractRequestProofTokenType.php index a273d8ad..51615a8d 100644 --- a/src/XML/fed/AbstractRequestProofTokenType.php +++ b/src/XML/fed/AbstractRequestProofTokenType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RequestProofTokenType element @@ -21,6 +21,7 @@ abstract class AbstractRequestProofTokenType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; @@ -61,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -90,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractRequestPseudonymType.php b/src/XML/fed/AbstractRequestPseudonymType.php index 60006485..442d0a24 100644 --- a/src/XML/fed/AbstractRequestPseudonymType.php +++ b/src/XML/fed/AbstractRequestPseudonymType.php @@ -6,10 +6,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; + +use function var_export; /** * Class defining the RequestPseudonymType element @@ -21,6 +24,7 @@ abstract class AbstractRequestPseudonymType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -31,14 +35,14 @@ abstract class AbstractRequestPseudonymType extends AbstractFedElement /** * AbstractRequestPseudonymType constructor * - * @param bool|null $SingleUse - * @param bool|null $Lookup + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $SingleUse + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $Lookup * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?bool $SingleUse = null, - protected ?bool $Lookup = null, + protected ?BooleanValue $SingleUse = null, + protected ?BooleanValue $Lookup = null, array $children = [], array $namespacedAttributes = [], ) { @@ -48,18 +52,18 @@ final public function __construct( /** - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getSingleUse(): ?bool + public function getSingleUse(): ?BooleanValue { return $this->SingleUse; } /** - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getLookup(): ?bool + public function getLookup(): ?BooleanValue { return $this->Lookup; } @@ -85,7 +89,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -94,8 +98,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalBooleanAttribute($xml, 'SingleUse', null), - self::getOptionalBooleanAttribute($xml, 'Lookup', null), + self::getOptionalAttribute($xml, 'SingleUse', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'Lookup', BooleanValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -114,19 +118,18 @@ public function toXML(?DOMElement $parent = null): DOMElement $singleUse = $this->getSingleUse(); if ($singleUse !== null) { - $e->setAttribute('SingleUse', $singleUse ? 'true' : 'false'); + $e->setAttribute('SingleUse', var_export($singleUse->toBoolean(), true)); } $lookup = $this->getLookup(); if ($lookup !== null) { - $e->setAttribute('Lookup', $lookup ? 'true' : 'false'); + $e->setAttribute('Lookup', var_export($lookup->toBoolean(), true)); } foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractSecurityTokenServiceType.php b/src/XML/fed/AbstractSecurityTokenServiceType.php index 95481422..da0dbe7d 100644 --- a/src/XML/fed/AbstractSecurityTokenServiceType.php +++ b/src/XML/fed/AbstractSecurityTokenServiceType.php @@ -4,14 +4,20 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use DateTimeImmutable; use DOMElement; +use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\Extensions; use SimpleSAML\SAML2\XML\md\Organization; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * A SecurityTokenServiceType @@ -33,12 +39,17 @@ abstract class AbstractSecurityTokenServiceType extends AbstractWebServiceDescri /** * SecurityTokenServiceType constructor. * - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * Unix time of validity for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration + * Maximum time this document can be cached. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL + * An URI where to redirect users for support. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptors An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -53,20 +64,21 @@ abstract class AbstractSecurityTokenServiceType extends AbstractWebServiceDescri * @param \SimpleSAML\WSSecurity\XML\fed\ClaimTypesRequested|null $claimTypesRequested * @param \SimpleSAML\WSSecurity\XML\fed\AutomaticPseudonyms|null $automaticPseudonyms * @param \SimpleSAML\WSSecurity\XML\fed\TargetScopes|null $targetScopes - * @param string|null $serviceDisplayName - * @param string|null $serviceDescription + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDisplayName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDescription * @param \SimpleSAML\WSSecurity\XML\fed\SecurityTokenServiceEndpoint[] $securityTokenServiceEndpoint * @param \SimpleSAML\WSSecurity\XML\fed\SingleSignOutSubscriptionEndpoint[] $singleSignOutSubscriptionEndpoint * @param \SimpleSAML\WSSecurity\XML\fed\SingleSignOutNotificationEndpoint[] $singleSignOutNotificationEndpoint * @param \SimpleSAML\WSSecurity\XML\fed\PassiveRequestorEndpoint[] $passiveRequestorEndpoint */ final public function __construct( - array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + QNameValue $type, + SAMLAnyURIListValue $protocolSupportEnumeration, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptors = [], ?Organization $organization = null, array $contacts = [], @@ -78,8 +90,8 @@ final public function __construct( ?ClaimTypesRequested $claimTypesRequested = null, ?AutomaticPseudonyms $automaticPseudonyms = null, ?TargetScopes $targetScopes = null, - ?string $serviceDisplayName = null, - ?string $serviceDescription = null, + ?SAMLStringValue $serviceDisplayName = null, + ?SAMLStringValue $serviceDescription = null, protected array $securityTokenServiceEndpoint = [], protected array $singleSignOutSubscriptionEndpoint = [], protected array $singleSignOutNotificationEndpoint = [], @@ -108,7 +120,7 @@ final public function __construct( ); parent::__construct( - static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME, + $type, $protocolSupportEnumeration, $ID, $validUntil, diff --git a/src/XML/fed/AbstractSecurityTokenType.php b/src/XML/fed/AbstractSecurityTokenType.php index 5f434392..08fa4750 100644 --- a/src/XML/fed/AbstractSecurityTokenType.php +++ b/src/XML/fed/AbstractSecurityTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the SecurityTokenType element @@ -23,6 +23,7 @@ abstract class AbstractSecurityTokenType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -51,7 +52,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -84,7 +85,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractSignOutBasisType.php b/src/XML/fed/AbstractSignOutBasisType.php index 6ec44b4b..0c2d4ae5 100644 --- a/src/XML/fed/AbstractSignOutBasisType.php +++ b/src/XML/fed/AbstractSignOutBasisType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A SignOutBasisType @@ -22,6 +22,7 @@ abstract class AbstractSignOutBasisType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -52,7 +53,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/fed/AbstractSignOutType.php b/src/XML/fed/AbstractSignOutType.php index 6d43496c..98ca933e 100644 --- a/src/XML/fed/AbstractSignOutType.php +++ b/src/XML/fed/AbstractSignOutType.php @@ -8,12 +8,13 @@ use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A SignOutType @@ -25,6 +26,7 @@ abstract class AbstractSignOutType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -44,19 +46,17 @@ abstract class AbstractSignOutType extends AbstractFedElement * * @param \SimpleSAML\WSSecurity\XML\fed\SignOutBasis $signOutBasis * @param \SimpleSAML\WSSecurity\XML\fed\Realm|null $realm - * @param string|null $Id + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $Id * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected SignOutBasis $signOutBasis, protected ?Realm $realm = null, - protected ?string $Id = null, + protected ?NCNameValue $Id = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($Id); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } @@ -87,9 +87,9 @@ public function getRealm(): ?Realm /** * Collect the value of the Id-property * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\NCNameValue|null */ - public function getId(): ?string + public function getId(): ?NCNameValue { return $this->Id; } @@ -101,7 +101,7 @@ public function getId(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -119,7 +119,9 @@ public static function fromXML(DOMElement $xml): static return new static( array_pop($signOutBasis), array_pop($realm), - $xml->hasAttributeNS(C::NS_SEC_UTIL, 'Id') ? $xml->getAttributeNS(C::NS_SEC_UTIL, 'Id') : null, + $xml->hasAttributeNS(C::NS_SEC_UTIL, 'Id') + ? NCNameValue::fromString($xml->getAttributeNS(C::NS_SEC_UTIL, 'Id')) + : null, self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); diff --git a/src/XML/fed/AbstractTokenType.php b/src/XML/fed/AbstractTokenType.php index 53e5ecbc..acac67b8 100644 --- a/src/XML/fed/AbstractTokenType.php +++ b/src/XML/fed/AbstractTokenType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the TokenType element @@ -22,6 +22,7 @@ abstract class AbstractTokenType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -32,26 +33,24 @@ abstract class AbstractTokenType extends AbstractFedElement /** * AbstractTokenType constructor * - * @param string|null $Uri + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Uri * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $Uri = null, + protected ?AnyURIValue $Uri = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($Uri, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getUri(): ?string + public function getUri(): ?AnyURIValue { return $this->Uri; } @@ -76,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,7 +84,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Uri', null), + self::getOptionalAttribute($xml, 'Uri', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -103,14 +102,13 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getUri() !== null) { - $e->setAttribute('Uri', $this->getUri()); + $e->setAttribute('Uri', $this->getUri()->getValue()); } foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractTokenTypesOfferedType.php b/src/XML/fed/AbstractTokenTypesOfferedType.php index 0adc1803..db9e0df1 100644 --- a/src/XML/fed/AbstractTokenTypesOfferedType.php +++ b/src/XML/fed/AbstractTokenTypesOfferedType.php @@ -7,12 +7,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\fed\TokenType; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the TokenTypesOffered element @@ -24,6 +24,7 @@ abstract class AbstractTokenTypesOfferedType extends AbstractFedElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -66,7 +67,7 @@ public function getTokenType(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -108,7 +109,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $tokenType->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/fed/AbstractWebServiceDescriptorType.php b/src/XML/fed/AbstractWebServiceDescriptorType.php index 64946ab0..0c27f022 100644 --- a/src/XML/fed/AbstractWebServiceDescriptorType.php +++ b/src/XML/fed/AbstractWebServiceDescriptorType.php @@ -4,11 +4,17 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use DateTimeImmutable; use DOMElement; +use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; use SimpleSAML\SAML2\XML\md\Extensions; use SimpleSAML\SAML2\XML\md\Organization; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * An WebServiceDescriptorType @@ -20,13 +26,17 @@ abstract class AbstractWebServiceDescriptorType extends AbstractRoleDescriptor /** * WebServiceDescriptorType constructor. * - * @param string $type The xsi-type of the element - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi-type of the element + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * Unix time of validity for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration + * Maximum time this document can be cached. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL + * An URI where to redirect users for support. Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptors An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -41,17 +51,17 @@ abstract class AbstractWebServiceDescriptorType extends AbstractRoleDescriptor * @param \SimpleSAML\WSSecurity\XML\fed\ClaimTypesRequested|null $claimTypesRequested * @param \SimpleSAML\WSSecurity\XML\fed\AutomaticPseudonyms|null $automaticPseudonyms * @param \SimpleSAML\WSSecurity\XML\fed\TargetScopes|null $targetScopes - * @param string|null $serviceDisplayName - * @param string|null $serviceDescription + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDisplayName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $serviceDescription */ protected function __construct( - string $type, - array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + QNameValue $type, + SAMLAnyURIListValue $protocolSupportEnumeration, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptors = [], ?Organization $organization = null, array $contacts = [], @@ -63,8 +73,8 @@ protected function __construct( protected ?ClaimTypesRequested $claimTypesRequested = null, protected ?AutomaticPseudonyms $automaticPseudonyms = null, protected ?TargetScopes $targetScopes = null, - protected ?string $serviceDisplayName = null, - protected ?string $serviceDescription = null, + protected ?SAMLStringValue $serviceDisplayName = null, + protected ?SAMLStringValue $serviceDescription = null, ) { parent::__construct( $type, @@ -162,9 +172,9 @@ public function getTargetScopes(): ?TargetScopes /** * Collect the value of the serviceDisplayName-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getServiceDisplayName(): ?string + public function getServiceDisplayName(): ?SAMLStringValue { return $this->serviceDisplayName; } @@ -173,9 +183,9 @@ public function getServiceDisplayName(): ?string /** * Collect the value of the serviceDescription-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getServiceDescription(): ?string + public function getServiceDescription(): ?SAMLStringValue { return $this->serviceDescription; } @@ -201,12 +211,12 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement $serviceDisplayName = $this->getServiceDisplayName(); if ($serviceDisplayName !== null) { - $e->setAttribute('ServiceDisplayName', $serviceDisplayName); + $e->setAttribute('ServiceDisplayName', $serviceDisplayName->getValue()); } $serviceDescription = $this->getServiceDescription(); if ($serviceDescription !== null) { - $e->setAttribute('ServiceDescription', $serviceDescription); + $e->setAttribute('ServiceDescription', $serviceDescription->getValue()); } return $e; diff --git a/src/XML/fed/AdditionalContextProcessed.php b/src/XML/fed/AdditionalContextProcessed.php index a29ca741..12396490 100644 --- a/src/XML/fed/AdditionalContextProcessed.php +++ b/src/XML/fed/AdditionalContextProcessed.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An AdditionalContextProcessed element diff --git a/src/XML/fed/ApplicationServiceEndpoint.php b/src/XML/fed/ApplicationServiceEndpoint.php index 681ba8b7..c10dc617 100644 --- a/src/XML/fed/ApplicationServiceEndpoint.php +++ b/src/XML/fed/ApplicationServiceEndpoint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the ApplicationServiceEndpoint element diff --git a/src/XML/fed/AttributeServiceEndpoint.php b/src/XML/fed/AttributeServiceEndpoint.php index 366a9756..8b06c505 100644 --- a/src/XML/fed/AttributeServiceEndpoint.php +++ b/src/XML/fed/AttributeServiceEndpoint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the AttributeServiceEndpoint element diff --git a/src/XML/fed/AttributeServiceEndpoints.php b/src/XML/fed/AttributeServiceEndpoints.php index a6764a20..8f417f0b 100644 --- a/src/XML/fed/AttributeServiceEndpoints.php +++ b/src/XML/fed/AttributeServiceEndpoints.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the AttributeServiceEndpoints element diff --git a/src/XML/fed/AuthenticationToken.php b/src/XML/fed/AuthenticationToken.php index 683ac5a5..67950cef 100644 --- a/src/XML/fed/AuthenticationToken.php +++ b/src/XML/fed/AuthenticationToken.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractNestedPolicyType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An AuthenticationToken element @@ -16,6 +17,7 @@ final class AuthenticationToken extends AbstractNestedPolicyType implements Sche { use SchemaValidatableElementTrait; + /** @var string */ public const NS = AbstractFedElement::NS; diff --git a/src/XML/fed/AutomaticPseudonyms.php b/src/XML/fed/AutomaticPseudonyms.php index ca6fe420..d4511c23 100644 --- a/src/XML/fed/AutomaticPseudonyms.php +++ b/src/XML/fed/AutomaticPseudonyms.php @@ -4,14 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\StringElementTrait; - -use function in_array; -use function sprintf; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * A AutomaticPseudonyms element @@ -21,43 +17,9 @@ final class AutomaticPseudonyms extends AbstractFedElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; - - - /** - * @param bool $content - */ - public function __construct(bool $content) - { - $this->setContent($content ? 'true' : 'false'); - } - - - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); + use TypedTextContentTrait; - Assert::oneOf( - $xml->textContent, - ['0', '1', 'false', 'true'], - sprintf( - 'The value \'%s\' of an %s:%s element must be a boolean.', - $xml->textContent, - static::NS_PREFIX, - static::getLocalName(), - ), - ); - return new static(in_array($xml->textContent, ['1', 'true'], true)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = BooleanValue::class; } diff --git a/src/XML/fed/ClaimDialectsOffered.php b/src/XML/fed/ClaimDialectsOffered.php index ccead457..2b67d2c8 100644 --- a/src/XML/fed/ClaimDialectsOffered.php +++ b/src/XML/fed/ClaimDialectsOffered.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the ClaimDialectsOffered element diff --git a/src/XML/fed/ClaimTypesOffered.php b/src/XML/fed/ClaimTypesOffered.php index 0f28c931..50c4e32c 100644 --- a/src/XML/fed/ClaimTypesOffered.php +++ b/src/XML/fed/ClaimTypesOffered.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ClaimTypesOffered element diff --git a/src/XML/fed/ClaimTypesRequested.php b/src/XML/fed/ClaimTypesRequested.php index f1c19af1..39fd9c2e 100644 --- a/src/XML/fed/ClaimTypesRequested.php +++ b/src/XML/fed/ClaimTypesRequested.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ClaimTypesRequested element diff --git a/src/XML/fed/ClientPseudonym.php b/src/XML/fed/ClientPseudonym.php index 64f6b687..f1c66faa 100644 --- a/src/XML/fed/ClientPseudonym.php +++ b/src/XML/fed/ClientPseudonym.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ClientPseudonym element diff --git a/src/XML/fed/DisplayName.php b/src/XML/fed/DisplayName.php index 9f0fec6a..b749b847 100644 --- a/src/XML/fed/DisplayName.php +++ b/src/XML/fed/DisplayName.php @@ -4,6 +4,11 @@ namespace SimpleSAML\WSSecurity\XML\fed; +use DOMElement; +use SimpleSAML\WSSecurity\Assert\Assert; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\StringValue; + /** * A DisplayName element * @@ -11,4 +16,20 @@ */ final class DisplayName extends AbstractAttributeExtensibleString { + /** + * Create a class from XML + * + * @param \DOMElement $xml + * @return static + */ + public static function fromXML(DOMElement $xml): static + { + Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); + Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); + + return new static( + StringValue::fromString($xml->textContent), + self::getAttributesNSFromXML($xml), + ); + } } diff --git a/src/XML/fed/EMail.php b/src/XML/fed/EMail.php index 74c7d9c3..53e32802 100644 --- a/src/XML/fed/EMail.php +++ b/src/XML/fed/EMail.php @@ -4,6 +4,11 @@ namespace SimpleSAML\WSSecurity\XML\fed; +use DOMElement; +use SimpleSAML\WSSecurity\Assert\Assert; +use SimpleSAML\WSSecurity\XML\fed\Type\EmailAddressValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; + /** * An EMail element * @@ -11,4 +16,30 @@ */ final class EMail extends AbstractAttributeExtensibleString { + /** + * @param \SimpleSAML\WSSecurity\XML\fed\Type\EmailAddressValue $content + * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes + */ + public function __construct(EmailAddressValue $content, array $namespacedAttributes = []) + { + parent::__construct($content, $namespacedAttributes); + } + + + /** + * Create a class from XML + * + * @param \DOMElement $xml + * @return static + */ + public static function fromXML(DOMElement $xml): static + { + Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); + Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); + + return new static( + EmailAddressValue::fromString($xml->textContent), + self::getAttributesNSFromXML($xml), + ); + } } diff --git a/src/XML/fed/FederationID.php b/src/XML/fed/FederationID.php index 4d675325..da4191e4 100644 --- a/src/XML/fed/FederationID.php +++ b/src/XML/fed/FederationID.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A FederationID element diff --git a/src/XML/fed/FederationMetadata.php b/src/XML/fed/FederationMetadata.php index b091e518..239392ee 100644 --- a/src/XML/fed/FederationMetadata.php +++ b/src/XML/fed/FederationMetadata.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A FederationMetadata element diff --git a/src/XML/fed/FederationMetadataHandler.php b/src/XML/fed/FederationMetadataHandler.php index 62073031..40b15ca4 100644 --- a/src/XML/fed/FederationMetadataHandler.php +++ b/src/XML/fed/FederationMetadataHandler.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A FederationMetadataHandler element diff --git a/src/XML/fed/FilterPseudonyms.php b/src/XML/fed/FilterPseudonyms.php index d5b1a02e..5eede0b9 100644 --- a/src/XML/fed/FilterPseudonyms.php +++ b/src/XML/fed/FilterPseudonyms.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A FilterPseudonyms element diff --git a/src/XML/fed/Freshness.php b/src/XML/fed/Freshness.php index 1c339dc7..80a3f6b7 100644 --- a/src/XML/fed/Freshness.php +++ b/src/XML/fed/Freshness.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Freshness element diff --git a/src/XML/fed/IssuesSpecificPolicyFault.php b/src/XML/fed/IssuesSpecificPolicyFault.php index 67294296..86cd31eb 100644 --- a/src/XML/fed/IssuesSpecificPolicyFault.php +++ b/src/XML/fed/IssuesSpecificPolicyFault.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\fed\AbstractAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A IssuesSpecificPolicyFault element diff --git a/src/XML/fed/LogicalServiceNamesOffered.php b/src/XML/fed/LogicalServiceNamesOffered.php index c3acd509..b839b333 100644 --- a/src/XML/fed/LogicalServiceNamesOffered.php +++ b/src/XML/fed/LogicalServiceNamesOffered.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the LogicalServiceNamesOffered element diff --git a/src/XML/fed/PPID.php b/src/XML/fed/PPID.php index 8634321f..5bbe9f74 100644 --- a/src/XML/fed/PPID.php +++ b/src/XML/fed/PPID.php @@ -4,6 +4,11 @@ namespace SimpleSAML\WSSecurity\XML\fed; +use DOMElement; +use SimpleSAML\WSSecurity\Assert\Assert; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\StringValue; + /** * A PPID element * @@ -11,4 +16,20 @@ */ final class PPID extends AbstractAttributeExtensibleString { + /** + * Create a class from XML + * + * @param \DOMElement $xml + * @return static + */ + public static function fromXML(DOMElement $xml): static + { + Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); + Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); + + return new static( + StringValue::fromString($xml->textContent), + self::getAttributesNSFromXML($xml), + ); + } } diff --git a/src/XML/fed/PassiveRequestorEndpoint.php b/src/XML/fed/PassiveRequestorEndpoint.php index 5dbe76a2..3b9f8cc3 100644 --- a/src/XML/fed/PassiveRequestorEndpoint.php +++ b/src/XML/fed/PassiveRequestorEndpoint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the PassiveRequestorEndpoint element diff --git a/src/XML/fed/PassiveRequestorEndpoints.php b/src/XML/fed/PassiveRequestorEndpoints.php index ad8c30eb..eb84daa7 100644 --- a/src/XML/fed/PassiveRequestorEndpoints.php +++ b/src/XML/fed/PassiveRequestorEndpoints.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the PassiveRequestorEndpoints element diff --git a/src/XML/fed/ProofToken.php b/src/XML/fed/ProofToken.php index 1e48028d..f44d5a91 100644 --- a/src/XML/fed/ProofToken.php +++ b/src/XML/fed/ProofToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ProofToken element diff --git a/src/XML/fed/Pseudonym.php b/src/XML/fed/Pseudonym.php index 9ec34f93..9d1ed1c6 100644 --- a/src/XML/fed/Pseudonym.php +++ b/src/XML/fed/Pseudonym.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Pseudonym element diff --git a/src/XML/fed/PseudonymBasis.php b/src/XML/fed/PseudonymBasis.php index 387d7b89..90147913 100644 --- a/src/XML/fed/PseudonymBasis.php +++ b/src/XML/fed/PseudonymBasis.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A PseudonymBasis element diff --git a/src/XML/fed/PseudonymServiceEndpoint.php b/src/XML/fed/PseudonymServiceEndpoint.php index 74758275..0650af5b 100644 --- a/src/XML/fed/PseudonymServiceEndpoint.php +++ b/src/XML/fed/PseudonymServiceEndpoint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the PseudonymServiceEndpoint element diff --git a/src/XML/fed/PseudonymServiceEndpoints.php b/src/XML/fed/PseudonymServiceEndpoints.php index 3df14229..33f8e3cc 100644 --- a/src/XML/fed/PseudonymServiceEndpoints.php +++ b/src/XML/fed/PseudonymServiceEndpoints.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the PseudonymServiceEndpointz element diff --git a/src/XML/fed/Realm.php b/src/XML/fed/Realm.php index c9e5e9c0..c413c094 100644 --- a/src/XML/fed/Realm.php +++ b/src/XML/fed/Realm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A Realm element @@ -15,14 +17,9 @@ final class Realm extends AbstractFedElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/fed/ReferenceToken.php b/src/XML/fed/ReferenceToken.php index 175782c7..b23fb679 100644 --- a/src/XML/fed/ReferenceToken.php +++ b/src/XML/fed/ReferenceToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ReferenceToken element diff --git a/src/XML/fed/ReferenceToken11.php b/src/XML/fed/ReferenceToken11.php index eddfba10..34f7e5db 100644 --- a/src/XML/fed/ReferenceToken11.php +++ b/src/XML/fed/ReferenceToken11.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\fed\AbstractAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ReferenceToken11 element diff --git a/src/XML/fed/RelativeTo.php b/src/XML/fed/RelativeTo.php index 3528ab86..5af82802 100644 --- a/src/XML/fed/RelativeTo.php +++ b/src/XML/fed/RelativeTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RelativeTo element diff --git a/src/XML/fed/RequestProofToken.php b/src/XML/fed/RequestProofToken.php index 34eda274..2d4c8100 100644 --- a/src/XML/fed/RequestProofToken.php +++ b/src/XML/fed/RequestProofToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestProofToken element diff --git a/src/XML/fed/RequestPseudonym.php b/src/XML/fed/RequestPseudonym.php index cf329d3e..5cd4be82 100644 --- a/src/XML/fed/RequestPseudonym.php +++ b/src/XML/fed/RequestPseudonym.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestPseudonym element diff --git a/src/XML/fed/RequireBearerTokens.php b/src/XML/fed/RequireBearerTokens.php index 1a339a4e..aa9d9e09 100644 --- a/src/XML/fed/RequireBearerTokens.php +++ b/src/XML/fed/RequireBearerTokens.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\fed\AbstractAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequireBearerTokens element diff --git a/src/XML/fed/RequireReferenceToken.php b/src/XML/fed/RequireReferenceToken.php index 0a848c80..2c21f660 100644 --- a/src/XML/fed/RequireReferenceToken.php +++ b/src/XML/fed/RequireReferenceToken.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireReferenceToken element @@ -16,6 +17,7 @@ final class RequireReferenceToken extends AbstractTokenAssertionType implements { use SchemaValidatableElementTrait; + /** @var string */ public const NS = AbstractFedElement::NS; diff --git a/src/XML/fed/RequireSharedCookies.php b/src/XML/fed/RequireSharedCookies.php index ed71afb2..af2516f1 100644 --- a/src/XML/fed/RequireSharedCookies.php +++ b/src/XML/fed/RequireSharedCookies.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\fed\AbstractAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequireSharedCookies element diff --git a/src/XML/fed/RequireSignedTokens.php b/src/XML/fed/RequireSignedTokens.php index c0cfe3ec..037a3b1e 100644 --- a/src/XML/fed/RequireSignedTokens.php +++ b/src/XML/fed/RequireSignedTokens.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\fed\AbstractAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequireSignedTokens element diff --git a/src/XML/fed/RequiresGenericClaimDialect.php b/src/XML/fed/RequiresGenericClaimDialect.php index 59e8be9b..37198cbe 100644 --- a/src/XML/fed/RequiresGenericClaimDialect.php +++ b/src/XML/fed/RequiresGenericClaimDialect.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\fed\AbstractAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequiresGenericClaimDialect element diff --git a/src/XML/fed/SecurityToken.php b/src/XML/fed/SecurityToken.php index d0e6ca4e..8c2a6374 100644 --- a/src/XML/fed/SecurityToken.php +++ b/src/XML/fed/SecurityToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SecurityToken element diff --git a/src/XML/fed/SecurityTokenServiceEndpoint.php b/src/XML/fed/SecurityTokenServiceEndpoint.php index 7744f530..9dac5e24 100644 --- a/src/XML/fed/SecurityTokenServiceEndpoint.php +++ b/src/XML/fed/SecurityTokenServiceEndpoint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the SecurityTokenServiceEndpoint element diff --git a/src/XML/fed/SecurityTokenServiceType.php b/src/XML/fed/SecurityTokenServiceType.php index b6f9693d..371bfaa5 100644 --- a/src/XML/fed/SecurityTokenServiceType.php +++ b/src/XML/fed/SecurityTokenServiceType.php @@ -4,19 +4,25 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\md\{ContactPerson, Extensions, KeyDescriptor, Organization}; +use SimpleSAML\SAML2\Type\SAMLAnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\ContactPerson; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\XML\md\Organization; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Constants as C; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; -use function preg_split; - /** * Class representing WS-federation SecurityTokenServiceType RoleDescriptor. * @@ -30,9 +36,9 @@ final class SecurityTokenServiceType extends AbstractSecurityTokenServiceType * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static @@ -46,13 +52,7 @@ public static function fromXML(DOMElement $xml): static SchemaViolationException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); - Assert::validQName($type, SchemaViolationException::class); - Assert::same($type, static::XSI_TYPE_PREFIX . ':' . static::XSI_TYPE_NAME,); - - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); + $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( @@ -135,12 +135,13 @@ public static function fromXML(DOMElement $xml): static ); $securityTokenServiceType = new static( - preg_split('/[\s]+/', trim($protocols)), - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + $type, + self::getAttribute($xml, 'protocolSupportEnumeration', SAMLAnyURIListValue::class), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), array_pop($extensions), - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), KeyDescriptor::getChildrenOfClass($xml), array_pop($orgs), ContactPerson::getChildrenOfClass($xml), @@ -152,8 +153,8 @@ public static function fromXML(DOMElement $xml): static array_pop($claimTypesRequested), array_pop($automaticPseudonyms), array_pop($targetScopes), - self::getOptionalAttribute($xml, 'ServiceDisplayName', null), - self::getOptionalAttribute($xml, 'ServiceDescription', null), + self::getOptionalAttribute($xml, 'ServiceDisplayName', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'ServiceDescription', SAMLStringValue::class, null), SecurityTokenServiceEndpoint::getChildrenOfClass($xml), SingleSignOutSubscriptionEndpoint::getChildrenOfClass($xml), SingleSignOutNotificationEndpoint::getChildrenOfClass($xml), diff --git a/src/XML/fed/SignOut.php b/src/XML/fed/SignOut.php index e56e41bc..70d94272 100644 --- a/src/XML/fed/SignOut.php +++ b/src/XML/fed/SignOut.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the SignOut element diff --git a/src/XML/fed/SingleSignOutNotificationEndpoint.php b/src/XML/fed/SingleSignOutNotificationEndpoint.php index 0920ba74..3842b979 100644 --- a/src/XML/fed/SingleSignOutNotificationEndpoint.php +++ b/src/XML/fed/SingleSignOutNotificationEndpoint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the SingleSignOutNotificationEndpoint element diff --git a/src/XML/fed/SingleSignOutNotificationEndpoints.php b/src/XML/fed/SingleSignOutNotificationEndpoints.php index 13d6e4f6..c6b6207c 100644 --- a/src/XML/fed/SingleSignOutNotificationEndpoints.php +++ b/src/XML/fed/SingleSignOutNotificationEndpoints.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the SingleSignOutNotificationEndpoints element diff --git a/src/XML/fed/SingleSignOutSubscriptionEndpoint.php b/src/XML/fed/SingleSignOutSubscriptionEndpoint.php index 132180cb..a6af9c88 100644 --- a/src/XML/fed/SingleSignOutSubscriptionEndpoint.php +++ b/src/XML/fed/SingleSignOutSubscriptionEndpoint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the SingleSignOutSubscriptionEndpoint element diff --git a/src/XML/fed/SingleSignOutSubscriptionEndpoints.php b/src/XML/fed/SingleSignOutSubscriptionEndpoints.php index a825cb08..a75c6010 100644 --- a/src/XML/fed/SingleSignOutSubscriptionEndpoints.php +++ b/src/XML/fed/SingleSignOutSubscriptionEndpoints.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the SingleSignOutSubscriptionEndpoints element diff --git a/src/XML/fed/TargetScopes.php b/src/XML/fed/TargetScopes.php index 53ee945d..f116ecf4 100644 --- a/src/XML/fed/TargetScopes.php +++ b/src/XML/fed/TargetScopes.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the TargetScopes element diff --git a/src/XML/fed/TokenTypesOffered.php b/src/XML/fed/TokenTypesOffered.php index fd8015fa..1ca09eef 100644 --- a/src/XML/fed/TokenTypesOffered.php +++ b/src/XML/fed/TokenTypesOffered.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the TokenTypesOffered element diff --git a/src/XML/fed/Type/EmailAddressValue.php b/src/XML/fed/Type/EmailAddressValue.php new file mode 100644 index 00000000..ba493fda --- /dev/null +++ b/src/XML/fed/Type/EmailAddressValue.php @@ -0,0 +1,44 @@ +sanitizeValue($value)); + } +} diff --git a/src/XML/fed/WebBinding.php b/src/XML/fed/WebBinding.php index 01becc66..c4c54454 100644 --- a/src/XML/fed/WebBinding.php +++ b/src/XML/fed/WebBinding.php @@ -5,7 +5,8 @@ namespace SimpleSAML\WSSecurity\XML\fed; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractNestedPolicyType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A WebBinding element @@ -16,6 +17,7 @@ final class WebBinding extends AbstractNestedPolicyType implements SchemaValidat { use SchemaValidatableElementTrait; + /** @var string */ public const NS = AbstractFedElement::NS; diff --git a/src/XML/mssp/MustNotSendCancel.php b/src/XML/mssp/MustNotSendCancel.php index 16da52ff..c6b8bcce 100644 --- a/src/XML/mssp/MustNotSendCancel.php +++ b/src/XML/mssp/MustNotSendCancel.php @@ -6,7 +6,8 @@ use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractQNameAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustNotSendCancel element @@ -17,6 +18,7 @@ final class MustNotSendCancel extends AbstractQNameAssertionType implements Sche { use SchemaValidatableElementTrait; + /** @var string */ public const NS = C::NS_MSSP; diff --git a/src/XML/mssp/RequireClientCertificate.php b/src/XML/mssp/RequireClientCertificate.php index aefb2fe2..b553ea0f 100644 --- a/src/XML/mssp/RequireClientCertificate.php +++ b/src/XML/mssp/RequireClientCertificate.php @@ -6,7 +6,8 @@ use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractQNameAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireClientCertificate element @@ -17,6 +18,7 @@ final class RequireClientCertificate extends AbstractQNameAssertionType implemen { use SchemaValidatableElementTrait; + /** @var string */ public const NS = C::NS_MSSP; diff --git a/src/XML/mssp/RsaToken.php b/src/XML/mssp/RsaToken.php index 3fc6d062..e0d1f105 100644 --- a/src/XML/mssp/RsaToken.php +++ b/src/XML/mssp/RsaToken.php @@ -6,7 +6,8 @@ use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RsaToken element @@ -17,6 +18,7 @@ final class RsaToken extends AbstractTokenAssertionType implements SchemaValidat { use SchemaValidatableElementTrait; + /** @var string */ public const NS = C::NS_MSSP; diff --git a/src/XML/mssp/SslContextToken.php b/src/XML/mssp/SslContextToken.php index ce028fa4..05f826e7 100644 --- a/src/XML/mssp/SslContextToken.php +++ b/src/XML/mssp/SslContextToken.php @@ -6,7 +6,8 @@ use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SslContextToken element @@ -17,6 +18,7 @@ final class SslContextToken extends AbstractTokenAssertionType implements Schema { use SchemaValidatableElementTrait; + /** @var string */ public const NS = C::NS_MSSP; diff --git a/src/XML/sp_200507/AbstractEmptyType.php b/src/XML/sp_200507/AbstractEmptyType.php index 9dd84312..71a0c3bc 100644 --- a/src/XML/sp_200507/AbstractEmptyType.php +++ b/src/XML/sp_200507/AbstractEmptyType.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function sprintf; @@ -33,7 +33,7 @@ final public function __construct() * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/sp_200507/AbstractHeaderType.php b/src/XML/sp_200507/AbstractHeaderType.php index 2bea742b..c9bca258 100644 --- a/src/XML/sp_200507/AbstractHeaderType.php +++ b/src/XML/sp_200507/AbstractHeaderType.php @@ -6,9 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -21,25 +23,29 @@ abstract class AbstractHeaderType extends AbstractSpElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; + /** The exclusions for the xs:anyAttribute element */ + public const XS_ANY_ATTR_EXCLUSIONS = [ + [null, 'Name'], + [null, 'Namespace'], + ]; + /** * AbstractHeaderType constructor. * - * @param string $namespace - * @param string|null $name + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $namespace + * @param \SimpleSAML\XMLSchema\Type\QNameValue|null $name * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected string $namespace, - protected ?string $name = null, + protected AnyURIValue $namespace, + protected ?QNameValue $name = null, array $namespacedAttributes = [], ) { - Assert::validURI($namespace); - Assert::nullOrValidQName($name); - $this->setAttributesNS($namespacedAttributes); } @@ -47,9 +53,9 @@ final public function __construct( /** * Collect the value of the Name property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\QNameValue|null */ - public function getName(): ?string + public function getName(): ?QNameValue { return $this->name; } @@ -58,9 +64,9 @@ public function getName(): ?string /** * Collect the value of the Namespace property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getNamespace(): string + public function getNamespace(): AnyURIValue { return $this->namespace; } @@ -74,7 +80,7 @@ public function getNamespace(): string * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -88,17 +94,11 @@ public static function fromXML(DOMElement $xml): static ); $namespacedAttributes = self::getAttributesNSFromXML($xml); - foreach ($namespacedAttributes as $i => $attr) { - if ($attr->getNamespaceURI() === null) { - if ($attr->getAttrName() === 'Name' || $attr->getAttrName() === 'Namespace') { - unset($namespacedAttributes[$i]); - } - } - } + $namespace = self::getAttribute($xml, 'Namespace', AnyURIValue::class); return new static( - self::getAttribute($xml, 'Namespace'), - self::getOptionalAttribute($xml, 'Name', null), + $namespace, + $xml->hasAttribute('Name') ? QNameValue::fromString($xml->getAttribute('Name')) : null, $namespacedAttributes, ); } @@ -115,10 +115,10 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getName() !== null) { - $e->setAttribute('Name', $this->getName()); + $e->setAttribute('Name', $this->getName()->getValue()); } - $e->setAttribute('Namespace', $this->getNamespace()); + $e->setAttribute('Namespace', $this->getNamespace()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/sp_200507/AbstractHttpsTokenType.php b/src/XML/sp_200507/AbstractHttpsTokenType.php index 304a957f..fad9d4fd 100644 --- a/src/XML/sp_200507/AbstractHttpsTokenType.php +++ b/src/XML/sp_200507/AbstractHttpsTokenType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -23,6 +24,7 @@ abstract class AbstractHttpsTokenType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -38,12 +40,12 @@ abstract class AbstractHttpsTokenType extends AbstractSpElement /** * HttpsTokenType constructor. * - * @param bool $requireClientCertificate + * @param \SimpleSAML\XMLSchema\Type\BooleanValue $requireClientCertificate * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected bool $requireClientCertificate, + protected BooleanValue $requireClientCertificate, array $elts = [], array $namespacedAttributes = [], ) { @@ -54,8 +56,10 @@ final public function __construct( /** * Get the value of the RequireClientCertificate-attribute + * + * @return \SimpleSAML\XMLSchema\Type\BooleanValue */ - public function getRequireClientCertificate(): bool + public function getRequireClientCertificate(): BooleanValue { return $this->requireClientCertificate; } @@ -67,7 +71,7 @@ public function getRequireClientCertificate(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -81,7 +85,7 @@ public static function fromXML(DOMElement $xml): static ); return new static( - self::getBooleanAttribute($xml, 'RequireClientCertificate'), + self::getAttribute($xml, 'RequireClientCertificate', BooleanValue::class), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -98,7 +102,10 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('RequireClientCertificate', $this->getRequireClientCertificate() ? 'true' : 'false'); + $e->setAttribute( + 'RequireClientCertificate', + $this->getRequireClientCertificate()->toBoolean() ? 'true' : 'false', + ); foreach ($this->getElements() as $elt) { $elt->toXML($e); diff --git a/src/XML/sp_200507/AbstractIssuedTokenType.php b/src/XML/sp_200507/AbstractIssuedTokenType.php index decb0316..a1c2a547 100644 --- a/src/XML/sp_200507/AbstractIssuedTokenType.php +++ b/src/XML/sp_200507/AbstractIssuedTokenType.php @@ -6,16 +6,15 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; -use ValueError; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; -use function is_string; use function sprintf; /** @@ -29,6 +28,7 @@ abstract class AbstractIssuedTokenType extends AbstractSpElement use ExtendableElementTrait; use IncludeTokenTypeTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -37,7 +37,7 @@ abstract class AbstractIssuedTokenType extends AbstractSpElement /** The exclusions for the xs:anyAttribute element */ public const XS_ANY_ATTR_EXCLUSIONS = [ - [null, 'IncludeToken'], + ['http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702', 'IncludeToken'], ]; @@ -46,14 +46,14 @@ abstract class AbstractIssuedTokenType extends AbstractSpElement * * @param \SimpleSAML\WSSecurity\XML\sp_200507\RequestSecurityTokenTemplate $requestSecurityTokenTemplate * @param \SimpleSAML\WSSecurity\XML\sp_200507\Issuer|null $issuer - * @param \SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken|string|null $includeToken + * @param \SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue|null $includeToken * @param list<\SimpleSAML\XML\SerializableElementInterface> $elts * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected RequestSecurityTokenTemplate $requestSecurityTokenTemplate, protected ?Issuer $issuer = null, - IncludeToken|string|null $includeToken = null, + ?IncludeTokenValue $includeToken = null, array $elts = [], array $namespacedAttributes = [], ) { @@ -93,7 +93,7 @@ public function getRequestSecurityTokenTemplate(): RequestSecurityTokenTemplate * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -112,16 +112,10 @@ public static function fromXML(DOMElement $xml): static Assert::minCount($requestSecurityTokenTemplate, 1, MissingElementException::class); Assert::maxCount($requestSecurityTokenTemplate, 1, TooManyElementsException::class); - $includeToken = self::getOptionalAttribute($xml, 'IncludeToken', null); - try { - $includeToken = IncludeToken::from($includeToken); - } catch (ValueError) { - } - return new static( $requestSecurityTokenTemplate[0], array_pop($issuer), - $includeToken, + self::getOptionalAttribute($xml, 'IncludeToken', IncludeTokenValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -139,10 +133,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getIncludeToken() !== null) { - $e->setAttribute( - 'IncludeToken', - is_string($this->getIncludeToken()) ? $this->getIncludeToken() : $this->getIncludeToken()->value, - ); + $e->setAttribute('IncludeToken', $this->getIncludeToken()->getValue()); } if ($this->getIssuer() !== null) { @@ -152,7 +143,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $this->getRequestSecurityTokenTemplate()->toXML($e); foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); } diff --git a/src/XML/sp_200507/AbstractNestedPolicyType.php b/src/XML/sp_200507/AbstractNestedPolicyType.php index 15588da5..24f6ab2d 100644 --- a/src/XML/sp_200507/AbstractNestedPolicyType.php +++ b/src/XML/sp_200507/AbstractNestedPolicyType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing sp:NestedPolicyType @@ -21,6 +21,7 @@ abstract class AbstractNestedPolicyType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -49,7 +50,7 @@ final public function __construct( * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/sp_200507/AbstractQNameAssertionType.php b/src/XML/sp_200507/AbstractQNameAssertionType.php index e85200ee..836d8eb9 100644 --- a/src/XML/sp_200507/AbstractQNameAssertionType.php +++ b/src/XML/sp_200507/AbstractQNameAssertionType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -21,6 +21,7 @@ abstract class AbstractQNameAssertionType extends AbstractSpElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; @@ -45,7 +46,7 @@ final public function __construct( * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/sp_200507/AbstractRequestSecurityTokenTemplateType.php b/src/XML/sp_200507/AbstractRequestSecurityTokenTemplateType.php index 3cba15e5..d544411e 100644 --- a/src/XML/sp_200507/AbstractRequestSecurityTokenTemplateType.php +++ b/src/XML/sp_200507/AbstractRequestSecurityTokenTemplateType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -23,6 +24,7 @@ abstract class AbstractRequestSecurityTokenTemplateType extends AbstractSpElemen use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -38,17 +40,15 @@ abstract class AbstractRequestSecurityTokenTemplateType extends AbstractSpElemen /** * AbstractRequestSecurityTokenTemplateType constructor. * - * @param string|null $trustVersion + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $trustVersion * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $trustVersion = null, + protected ?AnyURIValue $trustVersion = null, array $elts = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($trustVersion); - $this->setElements($elts); $this->setAttributesNS($namespacedAttributes); } @@ -57,9 +57,9 @@ final public function __construct( /** * Collect the value of the trustVersion property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getTrustVersion(): ?string + public function getTrustVersion(): ?AnyURIValue { return $this->trustVersion; } @@ -84,7 +84,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -102,7 +102,7 @@ public static function fromXML(DOMElement $xml): static ); return new static( - self::getOptionalAttribute($xml, 'TrustVersion', null), + self::getOptionalAttribute($xml, 'TrustVersion', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -120,11 +120,10 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getTrustVersion() !== null) { - $e->setAttribute('TrustVersion', $this->getTrustVersion()); + $e->setAttribute('TrustVersion', $this->getTrustVersion()->getValue()); } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); } diff --git a/src/XML/sp_200507/AbstractSePartsType.php b/src/XML/sp_200507/AbstractSePartsType.php index 24bdbda5..7258e051 100644 --- a/src/XML/sp_200507/AbstractSePartsType.php +++ b/src/XML/sp_200507/AbstractSePartsType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function sprintf; @@ -25,6 +25,7 @@ abstract class AbstractSePartsType extends AbstractSpElement use ExtendableElementTrait; use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -95,7 +96,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -141,7 +142,6 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); } diff --git a/src/XML/sp_200507/AbstractSecureConversationTokenType.php b/src/XML/sp_200507/AbstractSecureConversationTokenType.php index 8a5944ca..619b8cc3 100644 --- a/src/XML/sp_200507/AbstractSecureConversationTokenType.php +++ b/src/XML/sp_200507/AbstractSecureConversationTokenType.php @@ -6,14 +6,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; -use ValueError; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; -use function is_string; use function sprintf; /** @@ -27,6 +26,7 @@ abstract class AbstractSecureConversationTokenType extends AbstractSpElement use ExtendableElementTrait; use IncludeTokenTypeTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -35,7 +35,7 @@ abstract class AbstractSecureConversationTokenType extends AbstractSpElement /** The exclusions for the xs:anyAttribute element */ public const XS_ANY_ATTR_EXCLUSIONS = [ - [null, 'IncludeToken'], + ['http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702', 'IncludeToken'], ]; @@ -43,13 +43,13 @@ abstract class AbstractSecureConversationTokenType extends AbstractSpElement * SecureConversationTokenType constructor. * * @param \SimpleSAML\WSSecurity\XML\sp_200507\Issuer|null $issuer - * @param \SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken|string|null $includeToken + * @param \SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue|null $includeToken * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected ?Issuer $issuer, - IncludeToken|string|null $includeToken = null, + ?IncludeTokenValue $includeToken = null, array $elts = [], array $namespacedAttributes = [], ) { @@ -92,7 +92,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -107,15 +107,9 @@ public static function fromXML(DOMElement $xml): static $issuer = Issuer::getChildrenOfClass($xml); - $includeToken = self::getOptionalAttribute($xml, 'IncludeToken', null); - try { - $includeToken = IncludeToken::from($includeToken); - } catch (ValueError) { - } - return new static( array_pop($issuer), - $includeToken, + self::getOptionalAttribute($xml, 'IncludeToken', IncludeTokenValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -133,10 +127,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getIncludeToken() !== null) { - $e->setAttribute( - 'IncludeToken', - is_string($this->getIncludeToken()) ? $this->getIncludeToken() : $this->getIncludeToken()->value, - ); + $e->setAttribute('IncludeToken', $this->getIncludeToken()->getValue()); } if ($this->getIssuer() !== null) { @@ -144,7 +135,6 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); } diff --git a/src/XML/sp_200507/AbstractSerElementsType.php b/src/XML/sp_200507/AbstractSerElementsType.php index 54ab0ca1..efb777e4 100644 --- a/src/XML/sp_200507/AbstractSerElementsType.php +++ b/src/XML/sp_200507/AbstractSerElementsType.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -24,6 +25,7 @@ abstract class AbstractSerElementsType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -40,18 +42,17 @@ abstract class AbstractSerElementsType extends AbstractSpElement * AbstractSerElementsType constructor. * * @param list<\SimpleSAML\WSSecurity\XML\sp_200507\XPath> $xpath - * @param string|null $xpathVersion + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $xpathVersion * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected array $xpath, - protected ?string $xpathVersion = null, + protected ?AnyURIValue $xpathVersion = null, array $elts = [], array $namespacedAttributes = [], ) { Assert::minCount($xpath, 1, SchemaViolationException::class); - Assert::nullOrValidURI($xpathVersion); $this->setElements($elts); $this->setAttributesNS($namespacedAttributes); @@ -72,9 +73,9 @@ public function getXPath(): array /** * Collect the value of the XPathVersion property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getXPathVersion(): ?string + public function getXPathVersion(): ?AnyURIValue { return $this->xpathVersion; } @@ -88,7 +89,7 @@ public function getXPathVersion(): ?string * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -103,7 +104,7 @@ public static function fromXML(DOMElement $xml): static return new static( XPath::getChildrenOfClass($xml), - self::getOptionalAttribute($xml, 'XPathVersion', null), + self::getOptionalAttribute($xml, 'XPathVersion', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -121,7 +122,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getXPathVersion() !== null) { - $e->setAttribute('XPathVersion', $this->getXPathVersion()); + $e->setAttribute('XPathVersion', $this->getXPathVersion()->getValue()); } foreach ($this->getXPath() as $xpath) { @@ -129,7 +130,6 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); } diff --git a/src/XML/sp_200507/AbstractSpnegoContextTokenType.php b/src/XML/sp_200507/AbstractSpnegoContextTokenType.php index 84ca9d95..c0767f5e 100644 --- a/src/XML/sp_200507/AbstractSpnegoContextTokenType.php +++ b/src/XML/sp_200507/AbstractSpnegoContextTokenType.php @@ -6,14 +6,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; -use ValueError; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; -use function is_string; use function sprintf; /** @@ -27,6 +26,7 @@ abstract class AbstractSpnegoContextTokenType extends AbstractSpElement use ExtendableElementTrait; use IncludeTokenTypeTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -35,7 +35,7 @@ abstract class AbstractSpnegoContextTokenType extends AbstractSpElement /** The exclusions for the xs:anyAttribute element */ public const XS_ANY_ATTR_EXCLUSIONS = [ - [null, 'IncludeToken'], + ['http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702', 'IncludeToken'], ]; @@ -43,13 +43,13 @@ abstract class AbstractSpnegoContextTokenType extends AbstractSpElement * SpnegoContextTokenType constructor. * * @param \SimpleSAML\WSSecurity\XML\sp_200507\Issuer|null $issuer - * @param \SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken|string|null $includeToken + * @param \SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue|null $includeToken * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected ?Issuer $issuer, - IncludeToken|string|null $includeToken = null, + ?IncludeTokenValue $includeToken = null, array $elts = [], array $namespacedAttributes = [], ) { @@ -92,7 +92,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -107,15 +107,9 @@ public static function fromXML(DOMElement $xml): static $issuer = Issuer::getChildrenOfClass($xml); - $includeToken = self::getOptionalAttribute($xml, 'IncludeToken', null); - try { - $includeToken = IncludeToken::from($includeToken); - } catch (ValueError) { - } - return new static( array_pop($issuer), - $includeToken, + self::getOptionalAttribute($xml, 'IncludeToken', IncludeTokenValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -133,10 +127,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getIncludeToken() !== null) { - $e->setAttribute( - 'IncludeToken', - is_string($this->getIncludeToken()) ? $this->getIncludeToken() : $this->getIncludeToken()->value, - ); + $e->setAttribute('IncludeToken', $this->getIncludeToken()->getValue()); } if ($this->getIssuer() !== null) { @@ -144,7 +135,6 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); } diff --git a/src/XML/sp_200507/AbstractTokenAssertionType.php b/src/XML/sp_200507/AbstractTokenAssertionType.php index b6564da5..7130db10 100644 --- a/src/XML/sp_200507/AbstractTokenAssertionType.php +++ b/src/XML/sp_200507/AbstractTokenAssertionType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -23,6 +23,7 @@ abstract class AbstractTokenAssertionType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -65,7 +66,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -96,7 +97,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); } diff --git a/src/XML/sp_200507/AlgorithmSuite.php b/src/XML/sp_200507/AlgorithmSuite.php index c5baabcd..e6907db5 100644 --- a/src/XML/sp_200507/AlgorithmSuite.php +++ b/src/XML/sp_200507/AlgorithmSuite.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An AlgorithmSuite element diff --git a/src/XML/sp_200507/AsymmetricBinding.php b/src/XML/sp_200507/AsymmetricBinding.php index ed61b160..de1a8276 100644 --- a/src/XML/sp_200507/AsymmetricBinding.php +++ b/src/XML/sp_200507/AsymmetricBinding.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An AsymmetricBinding element diff --git a/src/XML/sp_200507/Basic128.php b/src/XML/sp_200507/Basic128.php index ed4d69d1..5762fe7f 100644 --- a/src/XML/sp_200507/Basic128.php +++ b/src/XML/sp_200507/Basic128.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128 element diff --git a/src/XML/sp_200507/Basic128Rsa15.php b/src/XML/sp_200507/Basic128Rsa15.php index 8e329d29..a30f18bd 100644 --- a/src/XML/sp_200507/Basic128Rsa15.php +++ b/src/XML/sp_200507/Basic128Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128Rsa15 element diff --git a/src/XML/sp_200507/Basic128Sha256.php b/src/XML/sp_200507/Basic128Sha256.php index 55589af6..39ebe27f 100644 --- a/src/XML/sp_200507/Basic128Sha256.php +++ b/src/XML/sp_200507/Basic128Sha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128Sha256 element diff --git a/src/XML/sp_200507/Basic128Sha256Rsa15.php b/src/XML/sp_200507/Basic128Sha256Rsa15.php index 5e12ef78..565dc3cd 100644 --- a/src/XML/sp_200507/Basic128Sha256Rsa15.php +++ b/src/XML/sp_200507/Basic128Sha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128Sha256Rsa15 element diff --git a/src/XML/sp_200507/Basic192.php b/src/XML/sp_200507/Basic192.php index 029184bf..33edb32d 100644 --- a/src/XML/sp_200507/Basic192.php +++ b/src/XML/sp_200507/Basic192.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192 element diff --git a/src/XML/sp_200507/Basic192Rsa15.php b/src/XML/sp_200507/Basic192Rsa15.php index 336cb5eb..d35496f5 100644 --- a/src/XML/sp_200507/Basic192Rsa15.php +++ b/src/XML/sp_200507/Basic192Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192Rsa15 element diff --git a/src/XML/sp_200507/Basic192Sha256.php b/src/XML/sp_200507/Basic192Sha256.php index a96027bb..a3a3fd98 100644 --- a/src/XML/sp_200507/Basic192Sha256.php +++ b/src/XML/sp_200507/Basic192Sha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192Sha256 element diff --git a/src/XML/sp_200507/Basic192Sha256Rsa15.php b/src/XML/sp_200507/Basic192Sha256Rsa15.php index 701eff63..26b9a9ef 100644 --- a/src/XML/sp_200507/Basic192Sha256Rsa15.php +++ b/src/XML/sp_200507/Basic192Sha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192Sha256Rsa15 element diff --git a/src/XML/sp_200507/Basic256.php b/src/XML/sp_200507/Basic256.php index 4204b042..73ca1632 100644 --- a/src/XML/sp_200507/Basic256.php +++ b/src/XML/sp_200507/Basic256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256 element diff --git a/src/XML/sp_200507/Basic256Rsa15.php b/src/XML/sp_200507/Basic256Rsa15.php index ffb87370..d1380b5f 100644 --- a/src/XML/sp_200507/Basic256Rsa15.php +++ b/src/XML/sp_200507/Basic256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256Rsa15 element diff --git a/src/XML/sp_200507/Basic256Sha256.php b/src/XML/sp_200507/Basic256Sha256.php index 00ac7468..3e74c8fc 100644 --- a/src/XML/sp_200507/Basic256Sha256.php +++ b/src/XML/sp_200507/Basic256Sha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256Sha256 element diff --git a/src/XML/sp_200507/Basic256Sha256Rsa15.php b/src/XML/sp_200507/Basic256Sha256Rsa15.php index 2d4a19d2..62dce9ce 100644 --- a/src/XML/sp_200507/Basic256Sha256Rsa15.php +++ b/src/XML/sp_200507/Basic256Sha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256Sha256Rsa15 element diff --git a/src/XML/sp_200507/BootstrapPolicy.php b/src/XML/sp_200507/BootstrapPolicy.php index 7185fc5c..86639114 100644 --- a/src/XML/sp_200507/BootstrapPolicy.php +++ b/src/XML/sp_200507/BootstrapPolicy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A BootstrapPolicy element diff --git a/src/XML/sp_200507/EncryptBeforeSigning.php b/src/XML/sp_200507/EncryptBeforeSigning.php index 2ea8bfb7..fcdfdc8b 100644 --- a/src/XML/sp_200507/EncryptBeforeSigning.php +++ b/src/XML/sp_200507/EncryptBeforeSigning.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptBeforeSigning element diff --git a/src/XML/sp_200507/EncryptSignature.php b/src/XML/sp_200507/EncryptSignature.php index 7d1b3191..a22e5351 100644 --- a/src/XML/sp_200507/EncryptSignature.php +++ b/src/XML/sp_200507/EncryptSignature.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptSignature element diff --git a/src/XML/sp_200507/EncryptedElements.php b/src/XML/sp_200507/EncryptedElements.php index 84d67630..ee300025 100644 --- a/src/XML/sp_200507/EncryptedElements.php +++ b/src/XML/sp_200507/EncryptedElements.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptedElements element diff --git a/src/XML/sp_200507/EncryptedParts.php b/src/XML/sp_200507/EncryptedParts.php index 87dede98..53c42eb5 100644 --- a/src/XML/sp_200507/EncryptedParts.php +++ b/src/XML/sp_200507/EncryptedParts.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptedParts element diff --git a/src/XML/sp_200507/EncryptionToken.php b/src/XML/sp_200507/EncryptionToken.php index 4e220049..41351ba4 100644 --- a/src/XML/sp_200507/EncryptionToken.php +++ b/src/XML/sp_200507/EncryptionToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A EncryptionToken element diff --git a/src/XML/sp_200507/EndorsingSupportingTokens.php b/src/XML/sp_200507/EndorsingSupportingTokens.php index f5530d5c..0bfb781c 100644 --- a/src/XML/sp_200507/EndorsingSupportingTokens.php +++ b/src/XML/sp_200507/EndorsingSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A EndorsingSupportingTokens element diff --git a/src/XML/sp_200507/HttpsToken.php b/src/XML/sp_200507/HttpsToken.php index 44d685e1..600d231c 100644 --- a/src/XML/sp_200507/HttpsToken.php +++ b/src/XML/sp_200507/HttpsToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An HttpsToken element diff --git a/src/XML/sp_200507/IncludeTimestamp.php b/src/XML/sp_200507/IncludeTimestamp.php index 4454fc32..fabf0d91 100644 --- a/src/XML/sp_200507/IncludeTimestamp.php +++ b/src/XML/sp_200507/IncludeTimestamp.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An IncludeTimestamp element diff --git a/src/XML/sp_200507/IncludeTokenTypeTrait.php b/src/XML/sp_200507/IncludeTokenTypeTrait.php index 770f9954..ff2b43cb 100644 --- a/src/XML/sp_200507/IncludeTokenTypeTrait.php +++ b/src/XML/sp_200507/IncludeTokenTypeTrait.php @@ -4,9 +4,7 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\WSSecurity\Assert\Assert; - -use function is_string; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; /** * Trait grouping common functionality for elements that can hold IncludeToken attributes. @@ -18,17 +16,17 @@ trait IncludeTokenTypeTrait /** * The included token. * - * @var \SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken|string|null + * @var \SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue|null */ - protected IncludeToken|string|null $includeToken; + protected ?IncludeTokenValue $includeToken; /** * Collect the value of the includeToken-property * - * @return \SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken|string|null + * @return \SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue|null */ - public function getIncludeToken(): IncludeToken|string|null + public function getIncludeToken(): ?IncludeTokenValue { return $this->includeToken; } @@ -37,14 +35,10 @@ public function getIncludeToken(): IncludeToken|string|null /** * Set the value of the includeToken-property * - * @param \SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken|string|null $includeToken + * @param \SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue|null $includeToken */ - protected function setIncludeToken(IncludeToken|string|null $includeToken): void + protected function setIncludeToken(?IncludeTokenValue $includeToken = null): void { - if (is_string($includeToken)) { - Assert::validURI($includeToken); - } - $this->includeToken = $includeToken; } } diff --git a/src/XML/sp_200507/InclusiveC14N.php b/src/XML/sp_200507/InclusiveC14N.php index dc8e5250..31f9a38a 100644 --- a/src/XML/sp_200507/InclusiveC14N.php +++ b/src/XML/sp_200507/InclusiveC14N.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An InclusiveC14N element diff --git a/src/XML/sp_200507/InitiatorToken.php b/src/XML/sp_200507/InitiatorToken.php index a46fb613..0e7202f7 100644 --- a/src/XML/sp_200507/InitiatorToken.php +++ b/src/XML/sp_200507/InitiatorToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An InitiatorToken element diff --git a/src/XML/sp_200507/IssuedToken.php b/src/XML/sp_200507/IssuedToken.php index 1fb725e0..e368f98a 100644 --- a/src/XML/sp_200507/IssuedToken.php +++ b/src/XML/sp_200507/IssuedToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An IssuedToken element diff --git a/src/XML/sp_200507/KerberosToken.php b/src/XML/sp_200507/KerberosToken.php index d5cdaf4e..5e582a3c 100644 --- a/src/XML/sp_200507/KerberosToken.php +++ b/src/XML/sp_200507/KerberosToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An KerberosToken element diff --git a/src/XML/sp_200507/Lax.php b/src/XML/sp_200507/Lax.php index 532ad0c2..87783856 100644 --- a/src/XML/sp_200507/Lax.php +++ b/src/XML/sp_200507/Lax.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Lax element diff --git a/src/XML/sp_200507/LaxTsFirst.php b/src/XML/sp_200507/LaxTsFirst.php index 377e0b17..95c710d4 100644 --- a/src/XML/sp_200507/LaxTsFirst.php +++ b/src/XML/sp_200507/LaxTsFirst.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An LaxTsFirst element diff --git a/src/XML/sp_200507/LaxTsLast.php b/src/XML/sp_200507/LaxTsLast.php index 8ca9099b..b128f754 100644 --- a/src/XML/sp_200507/LaxTsLast.php +++ b/src/XML/sp_200507/LaxTsLast.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An LaxTsLast element diff --git a/src/XML/sp_200507/Layout.php b/src/XML/sp_200507/Layout.php index ee6e19ec..2c2266b7 100644 --- a/src/XML/sp_200507/Layout.php +++ b/src/XML/sp_200507/Layout.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Layout element diff --git a/src/XML/sp_200507/MustSupportClientChallenge.php b/src/XML/sp_200507/MustSupportClientChallenge.php index 90386a2b..11c5adfd 100644 --- a/src/XML/sp_200507/MustSupportClientChallenge.php +++ b/src/XML/sp_200507/MustSupportClientChallenge.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportClientChallenge element diff --git a/src/XML/sp_200507/MustSupportIssuedTokens.php b/src/XML/sp_200507/MustSupportIssuedTokens.php index 2032156a..7271d885 100644 --- a/src/XML/sp_200507/MustSupportIssuedTokens.php +++ b/src/XML/sp_200507/MustSupportIssuedTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportIssuedTokens element diff --git a/src/XML/sp_200507/MustSupportRefEmbeddedToken.php b/src/XML/sp_200507/MustSupportRefEmbeddedToken.php index 18f8eac0..3ee88db6 100644 --- a/src/XML/sp_200507/MustSupportRefEmbeddedToken.php +++ b/src/XML/sp_200507/MustSupportRefEmbeddedToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefEmbeddedToken element diff --git a/src/XML/sp_200507/MustSupportRefEncryptedKey.php b/src/XML/sp_200507/MustSupportRefEncryptedKey.php index b320ed68..506ca9c5 100644 --- a/src/XML/sp_200507/MustSupportRefEncryptedKey.php +++ b/src/XML/sp_200507/MustSupportRefEncryptedKey.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefEncryptedKey element diff --git a/src/XML/sp_200507/MustSupportRefExternalURI.php b/src/XML/sp_200507/MustSupportRefExternalURI.php index 4579e2a0..290ab241 100644 --- a/src/XML/sp_200507/MustSupportRefExternalURI.php +++ b/src/XML/sp_200507/MustSupportRefExternalURI.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefExternalURI element diff --git a/src/XML/sp_200507/MustSupportRefIssuerSerial.php b/src/XML/sp_200507/MustSupportRefIssuerSerial.php index 5f545541..0f73622e 100644 --- a/src/XML/sp_200507/MustSupportRefIssuerSerial.php +++ b/src/XML/sp_200507/MustSupportRefIssuerSerial.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefIssuerSerial element diff --git a/src/XML/sp_200507/MustSupportRefKeyIdentifier.php b/src/XML/sp_200507/MustSupportRefKeyIdentifier.php index fcc731ba..d86a5de5 100644 --- a/src/XML/sp_200507/MustSupportRefKeyIdentifier.php +++ b/src/XML/sp_200507/MustSupportRefKeyIdentifier.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefKeyIdentifier element diff --git a/src/XML/sp_200507/MustSupportRefThumbprint.php b/src/XML/sp_200507/MustSupportRefThumbprint.php index 22c5db21..fa643fb5 100644 --- a/src/XML/sp_200507/MustSupportRefThumbprint.php +++ b/src/XML/sp_200507/MustSupportRefThumbprint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefThumbprint element diff --git a/src/XML/sp_200507/MustSupportServerChallenge.php b/src/XML/sp_200507/MustSupportServerChallenge.php index 09119092..3a141588 100644 --- a/src/XML/sp_200507/MustSupportServerChallenge.php +++ b/src/XML/sp_200507/MustSupportServerChallenge.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportServerChallenge element diff --git a/src/XML/sp_200507/OnlySignEntireHeadersAndBody.php b/src/XML/sp_200507/OnlySignEntireHeadersAndBody.php index 230af489..febb3b4f 100644 --- a/src/XML/sp_200507/OnlySignEntireHeadersAndBody.php +++ b/src/XML/sp_200507/OnlySignEntireHeadersAndBody.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An OnlySignEntireHeadersAndBody element diff --git a/src/XML/sp_200507/ProtectTokens.php b/src/XML/sp_200507/ProtectTokens.php index d594a708..38a569c7 100644 --- a/src/XML/sp_200507/ProtectTokens.php +++ b/src/XML/sp_200507/ProtectTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ProtectTokens element diff --git a/src/XML/sp_200507/ProtectionToken.php b/src/XML/sp_200507/ProtectionToken.php index 25fac113..66351577 100644 --- a/src/XML/sp_200507/ProtectionToken.php +++ b/src/XML/sp_200507/ProtectionToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ProtectionToken element diff --git a/src/XML/sp_200507/RecipientToken.php b/src/XML/sp_200507/RecipientToken.php index 99c3caf9..e211cee7 100644 --- a/src/XML/sp_200507/RecipientToken.php +++ b/src/XML/sp_200507/RecipientToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RecipientToken element diff --git a/src/XML/sp_200507/RelToken.php b/src/XML/sp_200507/RelToken.php index a68795b7..97af3c18 100644 --- a/src/XML/sp_200507/RelToken.php +++ b/src/XML/sp_200507/RelToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RelToken element diff --git a/src/XML/sp_200507/RequireClientEntropy.php b/src/XML/sp_200507/RequireClientEntropy.php index b9c3eebb..7a0266bc 100644 --- a/src/XML/sp_200507/RequireClientEntropy.php +++ b/src/XML/sp_200507/RequireClientEntropy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireClientEntropy element diff --git a/src/XML/sp_200507/RequireDerivedKeys.php b/src/XML/sp_200507/RequireDerivedKeys.php index 45720fb7..ea8f6504 100644 --- a/src/XML/sp_200507/RequireDerivedKeys.php +++ b/src/XML/sp_200507/RequireDerivedKeys.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireDerivedKeys element diff --git a/src/XML/sp_200507/RequireEmbeddedTokenReference.php b/src/XML/sp_200507/RequireEmbeddedTokenReference.php index 5ce9e9b1..27ff7b31 100644 --- a/src/XML/sp_200507/RequireEmbeddedTokenReference.php +++ b/src/XML/sp_200507/RequireEmbeddedTokenReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireEmbeddedTokenReference element diff --git a/src/XML/sp_200507/RequireExternalReference.php b/src/XML/sp_200507/RequireExternalReference.php index 5aa98cf2..1ee31678 100644 --- a/src/XML/sp_200507/RequireExternalReference.php +++ b/src/XML/sp_200507/RequireExternalReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireExternalReference element diff --git a/src/XML/sp_200507/RequireExternalUriReference.php b/src/XML/sp_200507/RequireExternalUriReference.php index 1b2ab722..990b638a 100644 --- a/src/XML/sp_200507/RequireExternalUriReference.php +++ b/src/XML/sp_200507/RequireExternalUriReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireExternalUriReference element diff --git a/src/XML/sp_200507/RequireInternalReference.php b/src/XML/sp_200507/RequireInternalReference.php index ff12cd64..1c7809e1 100644 --- a/src/XML/sp_200507/RequireInternalReference.php +++ b/src/XML/sp_200507/RequireInternalReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireInternalReference element diff --git a/src/XML/sp_200507/RequireIssuerSerialReference.php b/src/XML/sp_200507/RequireIssuerSerialReference.php index 1937a770..ebf99426 100644 --- a/src/XML/sp_200507/RequireIssuerSerialReference.php +++ b/src/XML/sp_200507/RequireIssuerSerialReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireIssuerSerialReference element diff --git a/src/XML/sp_200507/RequireKeyIdentifierReference.php b/src/XML/sp_200507/RequireKeyIdentifierReference.php index 49d0b487..fdaae7e3 100644 --- a/src/XML/sp_200507/RequireKeyIdentifierReference.php +++ b/src/XML/sp_200507/RequireKeyIdentifierReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireKeyIdentifierReference element diff --git a/src/XML/sp_200507/RequireServerEntropy.php b/src/XML/sp_200507/RequireServerEntropy.php index ea8a59c5..b13f0036 100644 --- a/src/XML/sp_200507/RequireServerEntropy.php +++ b/src/XML/sp_200507/RequireServerEntropy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireServerEntropy element diff --git a/src/XML/sp_200507/RequireSignatureConfirmation.php b/src/XML/sp_200507/RequireSignatureConfirmation.php index ddd932dd..fa6ac491 100644 --- a/src/XML/sp_200507/RequireSignatureConfirmation.php +++ b/src/XML/sp_200507/RequireSignatureConfirmation.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireSignatureConfirmation element diff --git a/src/XML/sp_200507/RequireThumbprintReference.php b/src/XML/sp_200507/RequireThumbprintReference.php index e42354ad..98607155 100644 --- a/src/XML/sp_200507/RequireThumbprintReference.php +++ b/src/XML/sp_200507/RequireThumbprintReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireThumbprintReference element diff --git a/src/XML/sp_200507/RequiredElements.php b/src/XML/sp_200507/RequiredElements.php index 61c83bb1..5237cdc4 100644 --- a/src/XML/sp_200507/RequiredElements.php +++ b/src/XML/sp_200507/RequiredElements.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequiredElements element diff --git a/src/XML/sp_200507/SC10SecurityContextToken.php b/src/XML/sp_200507/SC10SecurityContextToken.php index e1787896..ce663120 100644 --- a/src/XML/sp_200507/SC10SecurityContextToken.php +++ b/src/XML/sp_200507/SC10SecurityContextToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SC10SecurityContextToken element diff --git a/src/XML/sp_200507/SOAPNormalization10.php b/src/XML/sp_200507/SOAPNormalization10.php index 07383a34..e2f57654 100644 --- a/src/XML/sp_200507/SOAPNormalization10.php +++ b/src/XML/sp_200507/SOAPNormalization10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SOAPNormalization10 element diff --git a/src/XML/sp_200507/STRTransform10.php b/src/XML/sp_200507/STRTransform10.php index c8177d44..db16acc6 100644 --- a/src/XML/sp_200507/STRTransform10.php +++ b/src/XML/sp_200507/STRTransform10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An STRTransform10 element diff --git a/src/XML/sp_200507/SamlToken.php b/src/XML/sp_200507/SamlToken.php index 9a0cc723..da0c4a86 100644 --- a/src/XML/sp_200507/SamlToken.php +++ b/src/XML/sp_200507/SamlToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SamlToken element diff --git a/src/XML/sp_200507/SecureConversationToken.php b/src/XML/sp_200507/SecureConversationToken.php index 83134061..88f66f41 100644 --- a/src/XML/sp_200507/SecureConversationToken.php +++ b/src/XML/sp_200507/SecureConversationToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SecureConversationToken element diff --git a/src/XML/sp_200507/SecurityContextToken.php b/src/XML/sp_200507/SecurityContextToken.php index 6d0a6ed5..1252e7b1 100644 --- a/src/XML/sp_200507/SecurityContextToken.php +++ b/src/XML/sp_200507/SecurityContextToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SecurityContextToken element diff --git a/src/XML/sp_200507/SignatureToken.php b/src/XML/sp_200507/SignatureToken.php index a542aaa5..7382823c 100644 --- a/src/XML/sp_200507/SignatureToken.php +++ b/src/XML/sp_200507/SignatureToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignatureToken element diff --git a/src/XML/sp_200507/SignedElements.php b/src/XML/sp_200507/SignedElements.php index 8668dd8d..68a2d85c 100644 --- a/src/XML/sp_200507/SignedElements.php +++ b/src/XML/sp_200507/SignedElements.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignedElements element diff --git a/src/XML/sp_200507/SignedEndorsingSupportingTokens.php b/src/XML/sp_200507/SignedEndorsingSupportingTokens.php index 13d76dd1..9c0e1d8d 100644 --- a/src/XML/sp_200507/SignedEndorsingSupportingTokens.php +++ b/src/XML/sp_200507/SignedEndorsingSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignedEndorsingSupportingTokens element diff --git a/src/XML/sp_200507/SignedParts.php b/src/XML/sp_200507/SignedParts.php index 3392ef8d..d1b598cf 100644 --- a/src/XML/sp_200507/SignedParts.php +++ b/src/XML/sp_200507/SignedParts.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignedParts element diff --git a/src/XML/sp_200507/SignedSupportingTokens.php b/src/XML/sp_200507/SignedSupportingTokens.php index 5400dac5..583bb917 100644 --- a/src/XML/sp_200507/SignedSupportingTokens.php +++ b/src/XML/sp_200507/SignedSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignedSupportingTokens element diff --git a/src/XML/sp_200507/SpnegoContextToken.php b/src/XML/sp_200507/SpnegoContextToken.php index 8ed617b1..652b04c7 100644 --- a/src/XML/sp_200507/SpnegoContextToken.php +++ b/src/XML/sp_200507/SpnegoContextToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SpnegoContextToken element diff --git a/src/XML/sp_200507/Strict.php b/src/XML/sp_200507/Strict.php index 032a1cd8..cb211b77 100644 --- a/src/XML/sp_200507/Strict.php +++ b/src/XML/sp_200507/Strict.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Strict element diff --git a/src/XML/sp_200507/SupportingTokens.php b/src/XML/sp_200507/SupportingTokens.php index e6ed2286..6ad28ef8 100644 --- a/src/XML/sp_200507/SupportingTokens.php +++ b/src/XML/sp_200507/SupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SupportingTokens element diff --git a/src/XML/sp_200507/SymmetricBinding.php b/src/XML/sp_200507/SymmetricBinding.php index 21fcd57d..0225ccfc 100644 --- a/src/XML/sp_200507/SymmetricBinding.php +++ b/src/XML/sp_200507/SymmetricBinding.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SymmetricBinding element diff --git a/src/XML/sp_200507/TransportBinding.php b/src/XML/sp_200507/TransportBinding.php index 9b42884e..dc2c0147 100644 --- a/src/XML/sp_200507/TransportBinding.php +++ b/src/XML/sp_200507/TransportBinding.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A TransportBinding element diff --git a/src/XML/sp_200507/TransportToken.php b/src/XML/sp_200507/TransportToken.php index 915beb06..160306d7 100644 --- a/src/XML/sp_200507/TransportToken.php +++ b/src/XML/sp_200507/TransportToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A TransportToken element diff --git a/src/XML/sp_200507/TripleDes.php b/src/XML/sp_200507/TripleDes.php index 2f6c2c48..27dc3c18 100644 --- a/src/XML/sp_200507/TripleDes.php +++ b/src/XML/sp_200507/TripleDes.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDes element diff --git a/src/XML/sp_200507/TripleDesRsa15.php b/src/XML/sp_200507/TripleDesRsa15.php index 7974b5b4..34946455 100644 --- a/src/XML/sp_200507/TripleDesRsa15.php +++ b/src/XML/sp_200507/TripleDesRsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDesRsa15 element diff --git a/src/XML/sp_200507/TripleDesSha256.php b/src/XML/sp_200507/TripleDesSha256.php index fa9ea2e5..052f03cd 100644 --- a/src/XML/sp_200507/TripleDesSha256.php +++ b/src/XML/sp_200507/TripleDesSha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDesSha256 element diff --git a/src/XML/sp_200507/TripleDesSha256Rsa15.php b/src/XML/sp_200507/TripleDesSha256Rsa15.php index 9d89b7e4..2a7d9fe4 100644 --- a/src/XML/sp_200507/TripleDesSha256Rsa15.php +++ b/src/XML/sp_200507/TripleDesSha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDesSha256Rsa15 element diff --git a/src/XML/sp_200507/Trust10.php b/src/XML/sp_200507/Trust10.php index 602b1e10..139f90ed 100644 --- a/src/XML/sp_200507/Trust10.php +++ b/src/XML/sp_200507/Trust10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Trust10 element diff --git a/src/XML/sp_200507/Type/IncludeTokenValue.php b/src/XML/sp_200507/Type/IncludeTokenValue.php new file mode 100644 index 00000000..c3e63a19 --- /dev/null +++ b/src/XML/sp_200507/Type/IncludeTokenValue.php @@ -0,0 +1,36 @@ +value); + } +} diff --git a/src/XML/sp_200507/UsernameToken.php b/src/XML/sp_200507/UsernameToken.php index 206b7ac7..a18c5ac5 100644 --- a/src/XML/sp_200507/UsernameToken.php +++ b/src/XML/sp_200507/UsernameToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An UsernameToken element diff --git a/src/XML/sp_200507/Wss10.php b/src/XML/sp_200507/Wss10.php index 09590de3..e15b3914 100644 --- a/src/XML/sp_200507/Wss10.php +++ b/src/XML/sp_200507/Wss10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Wss10 element diff --git a/src/XML/sp_200507/Wss11.php b/src/XML/sp_200507/Wss11.php index 69de71a5..eb365715 100644 --- a/src/XML/sp_200507/Wss11.php +++ b/src/XML/sp_200507/Wss11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Wss11 element diff --git a/src/XML/sp_200507/WssGssKerberosV5ApReqToken11.php b/src/XML/sp_200507/WssGssKerberosV5ApReqToken11.php index d16bcd8b..fe9db0f9 100644 --- a/src/XML/sp_200507/WssGssKerberosV5ApReqToken11.php +++ b/src/XML/sp_200507/WssGssKerberosV5ApReqToken11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssGssKerberosV5ApReqToken11 element diff --git a/src/XML/sp_200507/WssKerberosV5ApReqToken11.php b/src/XML/sp_200507/WssKerberosV5ApReqToken11.php index 7f2631c5..56189b75 100644 --- a/src/XML/sp_200507/WssKerberosV5ApReqToken11.php +++ b/src/XML/sp_200507/WssKerberosV5ApReqToken11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssKerberosV5ApReqToken11 element diff --git a/src/XML/sp_200507/WssRelV10Token10.php b/src/XML/sp_200507/WssRelV10Token10.php index 359951b5..069cb801 100644 --- a/src/XML/sp_200507/WssRelV10Token10.php +++ b/src/XML/sp_200507/WssRelV10Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV10Token10 element diff --git a/src/XML/sp_200507/WssRelV10Token11.php b/src/XML/sp_200507/WssRelV10Token11.php index d117c8f4..a97d21c1 100644 --- a/src/XML/sp_200507/WssRelV10Token11.php +++ b/src/XML/sp_200507/WssRelV10Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV10Token11 element diff --git a/src/XML/sp_200507/WssRelV20Token10.php b/src/XML/sp_200507/WssRelV20Token10.php index c220b4d6..9a6ab6b9 100644 --- a/src/XML/sp_200507/WssRelV20Token10.php +++ b/src/XML/sp_200507/WssRelV20Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV20Token10 element diff --git a/src/XML/sp_200507/WssRelV20Token11.php b/src/XML/sp_200507/WssRelV20Token11.php index c737d803..f7289a62 100644 --- a/src/XML/sp_200507/WssRelV20Token11.php +++ b/src/XML/sp_200507/WssRelV20Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV20Token11 element diff --git a/src/XML/sp_200507/WssSamlV10Token10.php b/src/XML/sp_200507/WssSamlV10Token10.php index 38d9b194..cb9289a9 100644 --- a/src/XML/sp_200507/WssSamlV10Token10.php +++ b/src/XML/sp_200507/WssSamlV10Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV10Token10 element diff --git a/src/XML/sp_200507/WssSamlV10Token11.php b/src/XML/sp_200507/WssSamlV10Token11.php index 155fc87e..89b38263 100644 --- a/src/XML/sp_200507/WssSamlV10Token11.php +++ b/src/XML/sp_200507/WssSamlV10Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV10Token11 element diff --git a/src/XML/sp_200507/WssSamlV11Token10.php b/src/XML/sp_200507/WssSamlV11Token10.php index be0fce0e..550b7bf7 100644 --- a/src/XML/sp_200507/WssSamlV11Token10.php +++ b/src/XML/sp_200507/WssSamlV11Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV11Token10 element diff --git a/src/XML/sp_200507/WssSamlV11Token11.php b/src/XML/sp_200507/WssSamlV11Token11.php index 5635c545..c3af0fe1 100644 --- a/src/XML/sp_200507/WssSamlV11Token11.php +++ b/src/XML/sp_200507/WssSamlV11Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV11Token11 element diff --git a/src/XML/sp_200507/WssSamlV20Token11.php b/src/XML/sp_200507/WssSamlV20Token11.php index 8913665c..272ce3c3 100644 --- a/src/XML/sp_200507/WssSamlV20Token11.php +++ b/src/XML/sp_200507/WssSamlV20Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV20Token11 element diff --git a/src/XML/sp_200507/WssUsernameToken10.php b/src/XML/sp_200507/WssUsernameToken10.php index 2731ac58..1204bc1c 100644 --- a/src/XML/sp_200507/WssUsernameToken10.php +++ b/src/XML/sp_200507/WssUsernameToken10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssUsernameToken10 element diff --git a/src/XML/sp_200507/WssUsernameToken11.php b/src/XML/sp_200507/WssUsernameToken11.php index 40390cb8..e3d5f280 100644 --- a/src/XML/sp_200507/WssUsernameToken11.php +++ b/src/XML/sp_200507/WssUsernameToken11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssUsernameToken11 element diff --git a/src/XML/sp_200507/WssX509Pkcs7Token10.php b/src/XML/sp_200507/WssX509Pkcs7Token10.php index e414057f..e4cf6be7 100644 --- a/src/XML/sp_200507/WssX509Pkcs7Token10.php +++ b/src/XML/sp_200507/WssX509Pkcs7Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509Pkcs7Token10 element diff --git a/src/XML/sp_200507/WssX509Pkcs7Token11.php b/src/XML/sp_200507/WssX509Pkcs7Token11.php index b44e9a77..98f10c44 100644 --- a/src/XML/sp_200507/WssX509Pkcs7Token11.php +++ b/src/XML/sp_200507/WssX509Pkcs7Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509Pkcs7Token11 element diff --git a/src/XML/sp_200507/WssX509PkiPathV1Token10.php b/src/XML/sp_200507/WssX509PkiPathV1Token10.php index 18ef864e..4d51cc1c 100644 --- a/src/XML/sp_200507/WssX509PkiPathV1Token10.php +++ b/src/XML/sp_200507/WssX509PkiPathV1Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509PkiPathV1Token10 element diff --git a/src/XML/sp_200507/WssX509PkiPathV1Token11.php b/src/XML/sp_200507/WssX509PkiPathV1Token11.php index f5d4dbe7..7c1c41d6 100644 --- a/src/XML/sp_200507/WssX509PkiPathV1Token11.php +++ b/src/XML/sp_200507/WssX509PkiPathV1Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509PkiPathV1Token11 element diff --git a/src/XML/sp_200507/WssX509V1Token10.php b/src/XML/sp_200507/WssX509V1Token10.php index 593dd4c8..9cafe0d9 100644 --- a/src/XML/sp_200507/WssX509V1Token10.php +++ b/src/XML/sp_200507/WssX509V1Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509V1Token10 element diff --git a/src/XML/sp_200507/WssX509V1Token11.php b/src/XML/sp_200507/WssX509V1Token11.php index 0e6609e0..46846303 100644 --- a/src/XML/sp_200507/WssX509V1Token11.php +++ b/src/XML/sp_200507/WssX509V1Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509V1Token11 element diff --git a/src/XML/sp_200507/WssX509V3Token10.php b/src/XML/sp_200507/WssX509V3Token10.php index f0b48357..37bc6d05 100644 --- a/src/XML/sp_200507/WssX509V3Token10.php +++ b/src/XML/sp_200507/WssX509V3Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509V3Token10 element diff --git a/src/XML/sp_200507/WssX509V3Token11.php b/src/XML/sp_200507/WssX509V3Token11.php index 07577407..dfd1f731 100644 --- a/src/XML/sp_200507/WssX509V3Token11.php +++ b/src/XML/sp_200507/WssX509V3Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509V3Token11 element diff --git a/src/XML/sp_200507/X509Token.php b/src/XML/sp_200507/X509Token.php index ba36fb0a..15d7dd5e 100644 --- a/src/XML/sp_200507/X509Token.php +++ b/src/XML/sp_200507/X509Token.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An X509Token element diff --git a/src/XML/sp_200507/XPath.php b/src/XML/sp_200507/XPath.php index 0d5e56c0..0b186d5f 100644 --- a/src/XML/sp_200507/XPath.php +++ b/src/XML/sp_200507/XPath.php @@ -8,7 +8,8 @@ use DOMXPath; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\StringElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; /** * An XPath element @@ -17,26 +18,18 @@ */ final class XPath extends AbstractSpElement { - use StringElementTrait; + use TypedTextContentTrait; - /** - * Initialize an XPath. - * - * @param string $content - */ - public function __construct( - string $content, - ) { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; /** * Validate the content of the element. * * @param string $content The value to go in the XML textContent - * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure + * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure * @return void */ protected function validateContent(string $content): void diff --git a/src/XML/sp_200507/XPathFilter20.php b/src/XML/sp_200507/XPathFilter20.php index 03933dc5..6b8f7496 100644 --- a/src/XML/sp_200507/XPathFilter20.php +++ b/src/XML/sp_200507/XPathFilter20.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200507; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An XPathFilter20 element diff --git a/src/XML/sp_200702/AbsXPath.php b/src/XML/sp_200702/AbsXPath.php index 74fd88e1..939dc546 100644 --- a/src/XML/sp_200702/AbsXPath.php +++ b/src/XML/sp_200702/AbsXPath.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An AbsXPath element diff --git a/src/XML/sp_200702/AbstractEmptyType.php b/src/XML/sp_200702/AbstractEmptyType.php index 5b1f8b43..4e674979 100644 --- a/src/XML/sp_200702/AbstractEmptyType.php +++ b/src/XML/sp_200702/AbstractEmptyType.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function sprintf; @@ -33,7 +33,7 @@ final public function __construct() * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/sp_200702/AbstractHeaderType.php b/src/XML/sp_200702/AbstractHeaderType.php index e5c5543c..a5dc195c 100644 --- a/src/XML/sp_200702/AbstractHeaderType.php +++ b/src/XML/sp_200702/AbstractHeaderType.php @@ -6,9 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -21,25 +23,29 @@ abstract class AbstractHeaderType extends AbstractSpElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; + /** The exclusions for the xs:anyAttribute element */ + public const XS_ANY_ATTR_EXCLUSIONS = [ + [null, 'Name'], + [null, 'Namespace'], + ]; + /** * AbstractHeaderType constructor. * - * @param string $namespace - * @param string|null $name + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $namespace + * @param \SimpleSAML\XMLSchema\Type\QNameValue|null $name * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected string $namespace, - protected ?string $name = null, + protected AnyURIValue $namespace, + protected ?QNameValue $name = null, array $namespacedAttributes = [], ) { - Assert::validURI($namespace); - Assert::nullOrValidQName($name); - $this->setAttributesNS($namespacedAttributes); } @@ -47,9 +53,9 @@ final public function __construct( /** * Collect the value of the Name property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\QNameValue|null */ - public function getName(): ?string + public function getName(): ?QNameValue { return $this->name; } @@ -58,9 +64,9 @@ public function getName(): ?string /** * Collect the value of the Namespace property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getNamespace(): string + public function getNamespace(): AnyURIValue { return $this->namespace; } @@ -74,7 +80,7 @@ public function getNamespace(): string * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -88,17 +94,11 @@ public static function fromXML(DOMElement $xml): static ); $namespacedAttributes = self::getAttributesNSFromXML($xml); - foreach ($namespacedAttributes as $i => $attr) { - if ($attr->getNamespaceURI() === null) { - if ($attr->getAttrName() === 'Name' || $attr->getAttrName() === 'Namespace') { - unset($namespacedAttributes[$i]); - } - } - } + $namespace = self::getAttribute($xml, 'Namespace', AnyURIValue::class); return new static( - self::getAttribute($xml, 'Namespace'), - self::getOptionalAttribute($xml, 'Name', null), + $namespace, + $xml->hasAttribute('Name') ? QNameValue::fromString($xml->getAttribute('Name')) : null, $namespacedAttributes, ); } @@ -115,10 +115,10 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getName() !== null) { - $e->setAttribute('Name', $this->getName()); + $e->setAttribute('Name', $this->getName()->getValue()); } - $e->setAttribute('Namespace', $this->getNamespace()); + $e->setAttribute('Namespace', $this->getNamespace()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/sp_200702/AbstractIssuedTokenType.php b/src/XML/sp_200702/AbstractIssuedTokenType.php index b6bcf3bb..a9456ddd 100644 --- a/src/XML/sp_200702/AbstractIssuedTokenType.php +++ b/src/XML/sp_200702/AbstractIssuedTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function sprintf; @@ -26,6 +26,7 @@ abstract class AbstractIssuedTokenType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -82,7 +83,7 @@ public function getRequestSecurityTokenTemplate(): RequestSecurityTokenTemplate * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -129,8 +130,9 @@ public function toXML(?DOMElement $parent = null): DOMElement $this->getRequestSecurityTokenTemplate()->toXML($e); foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractKeyValueTokenType.php b/src/XML/sp_200702/AbstractKeyValueTokenType.php index b651fc5b..b95b3dbf 100644 --- a/src/XML/sp_200702/AbstractKeyValueTokenType.php +++ b/src/XML/sp_200702/AbstractKeyValueTokenType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -23,6 +23,7 @@ abstract class AbstractKeyValueTokenType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -65,7 +66,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -96,8 +97,9 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractNestedPolicyType.php b/src/XML/sp_200702/AbstractNestedPolicyType.php index c2a81c3f..811af280 100644 --- a/src/XML/sp_200702/AbstractNestedPolicyType.php +++ b/src/XML/sp_200702/AbstractNestedPolicyType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing sp:NestedPolicyType @@ -21,6 +21,7 @@ abstract class AbstractNestedPolicyType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -41,7 +42,6 @@ final public function __construct(array $elements = [], array $attributes = []) } - /** * Test if an object, at the state it's in, would produce an empty XML-element * @@ -60,7 +60,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -90,8 +90,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $element) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $element */ - $element->toXML($e); + if (!$element->isEmptyElement()) { + $element->toXML($e); + } } return $e; diff --git a/src/XML/sp_200702/AbstractQNameAssertionType.php b/src/XML/sp_200702/AbstractQNameAssertionType.php index 0146e597..2dc13196 100644 --- a/src/XML/sp_200702/AbstractQNameAssertionType.php +++ b/src/XML/sp_200702/AbstractQNameAssertionType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -21,6 +21,7 @@ abstract class AbstractQNameAssertionType extends AbstractSpElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; @@ -45,7 +46,7 @@ final public function __construct( * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/sp_200702/AbstractReqPartsType.php b/src/XML/sp_200702/AbstractReqPartsType.php index 7b262796..e3c246fa 100644 --- a/src/XML/sp_200702/AbstractReqPartsType.php +++ b/src/XML/sp_200702/AbstractReqPartsType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -24,6 +24,7 @@ abstract class AbstractReqPartsType extends AbstractSpElement use ExtendableElementTrait; use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -80,7 +81,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -120,8 +121,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractRequestSecurityTokenTemplateType.php b/src/XML/sp_200702/AbstractRequestSecurityTokenTemplateType.php index 654dada5..54ada26c 100644 --- a/src/XML/sp_200702/AbstractRequestSecurityTokenTemplateType.php +++ b/src/XML/sp_200702/AbstractRequestSecurityTokenTemplateType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -23,6 +24,7 @@ abstract class AbstractRequestSecurityTokenTemplateType extends AbstractSpElemen use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -38,17 +40,15 @@ abstract class AbstractRequestSecurityTokenTemplateType extends AbstractSpElemen /** * AbstractRequestSecurityTokenTemplateType constructor. * - * @param string|null $trustVersion + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $trustVersion * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $trustVersion = null, + protected ?AnyURIValue $trustVersion = null, array $elts = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($trustVersion); - $this->setElements($elts); $this->setAttributesNS($namespacedAttributes); } @@ -57,9 +57,9 @@ final public function __construct( /** * Collect the value of the trustVersion property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getTrustVersion(): ?string + public function getTrustVersion(): ?AnyURIValue { return $this->trustVersion; } @@ -72,7 +72,9 @@ public function getTrustVersion(): ?string */ public function isEmptyElement(): bool { - return empty($this->trustVersion) && empty($this->elements) && empty($this->namespacedAttributes); + return empty($this->getTrustVersion()) + && empty($this->getElements()) + && empty($this->getAttributesNS()); } @@ -84,7 +86,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -102,7 +104,7 @@ public static function fromXML(DOMElement $xml): static ); return new static( - self::getOptionalAttribute($xml, 'TrustVersion', null), + self::getOptionalAttribute($xml, 'TrustVersion', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -120,11 +122,13 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getTrustVersion() !== null) { - $e->setAttribute('TrustVersion', $this->getTrustVersion()); + $e->setAttribute('TrustVersion', $this->getTrustVersion()->getValue()); } foreach ($this->getElements() as $elt) { - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractSePartsType.php b/src/XML/sp_200702/AbstractSePartsType.php index 8f2992aa..4089415a 100644 --- a/src/XML/sp_200702/AbstractSePartsType.php +++ b/src/XML/sp_200702/AbstractSePartsType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function sprintf; @@ -25,6 +25,7 @@ abstract class AbstractSePartsType extends AbstractSpElement use ExtendableElementTrait; use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -109,7 +110,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -162,8 +163,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractSecureConversationTokenType.php b/src/XML/sp_200702/AbstractSecureConversationTokenType.php index dad6cb20..9b67d0a4 100644 --- a/src/XML/sp_200702/AbstractSecureConversationTokenType.php +++ b/src/XML/sp_200702/AbstractSecureConversationTokenType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function sprintf; @@ -24,6 +24,7 @@ abstract class AbstractSecureConversationTokenType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -80,7 +81,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -120,7 +121,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractSerElementsType.php b/src/XML/sp_200702/AbstractSerElementsType.php index ff2b65c8..faa4e0df 100644 --- a/src/XML/sp_200702/AbstractSerElementsType.php +++ b/src/XML/sp_200702/AbstractSerElementsType.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -24,6 +25,7 @@ abstract class AbstractSerElementsType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -40,18 +42,17 @@ abstract class AbstractSerElementsType extends AbstractSpElement * AbstractSerElementsType constructor. * * @param list<\SimpleSAML\WSSecurity\XML\sp_200702\XPath> $xpath - * @param string|null $xpathVersion + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $xpathVersion * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected array $xpath, - protected ?string $xpathVersion = null, + protected ?AnyURIValue $xpathVersion = null, array $elts = [], array $namespacedAttributes = [], ) { Assert::minCount($xpath, 1, SchemaViolationException::class); - Assert::nullOrValidURI($xpathVersion); $this->setElements($elts); $this->setAttributesNS($namespacedAttributes); @@ -72,9 +73,9 @@ public function getXPath(): array /** * Collect the value of the XPathVersion property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getXPathVersion(): ?string + public function getXPathVersion(): ?AnyURIValue { return $this->xpathVersion; } @@ -88,7 +89,7 @@ public function getXPathVersion(): ?string * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -103,7 +104,9 @@ public static function fromXML(DOMElement $xml): static return new static( XPath::getChildrenOfClass($xml), - $xml->hasAttributeNS(self::NS, 'XPathVersion') ? $xml->getAttributeNS(self::NS, 'XPathVersion') : null, + $xml->hasAttributeNS(self::NS, 'XPathVersion') + ? AnyURIValue::fromString($xml->getAttributeNS(self::NS, 'XPathVersion')) + : null, self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -121,7 +124,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getXPathVersion() !== null) { - $e->setAttributeNS(self::NS, 'sp:XPathVersion', $this->getXPathVersion()); + $e->setAttributeNS(self::NS, 'sp:XPathVersion', $this->getXPathVersion()->getValue()); } foreach ($this->getXPath() as $xpath) { @@ -129,8 +132,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractSpnegoContextTokenType.php b/src/XML/sp_200702/AbstractSpnegoContextTokenType.php index 179dfa07..4a107386 100644 --- a/src/XML/sp_200702/AbstractSpnegoContextTokenType.php +++ b/src/XML/sp_200702/AbstractSpnegoContextTokenType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function sprintf; @@ -24,6 +24,7 @@ abstract class AbstractSpnegoContextTokenType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -80,7 +81,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -120,7 +121,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $elt) { - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AbstractTokenAssertionType.php b/src/XML/sp_200702/AbstractTokenAssertionType.php index e58f2e03..6a6c94b4 100644 --- a/src/XML/sp_200702/AbstractTokenAssertionType.php +++ b/src/XML/sp_200702/AbstractTokenAssertionType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function sprintf; @@ -23,6 +23,7 @@ abstract class AbstractTokenAssertionType extends AbstractSpElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -65,7 +66,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -96,7 +97,9 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); foreach ($this->getElements() as $elt) { - $elt->toXML($e); + if (!$elt->isEmptyElement()) { + $elt->toXML($e); + } } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/sp_200702/AlgorithmSuite.php b/src/XML/sp_200702/AlgorithmSuite.php index d10d3761..1e501df6 100644 --- a/src/XML/sp_200702/AlgorithmSuite.php +++ b/src/XML/sp_200702/AlgorithmSuite.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An AlgorithmSuite element diff --git a/src/XML/sp_200702/AsymmetricBinding.php b/src/XML/sp_200702/AsymmetricBinding.php index e4ef6ba1..667cbd38 100644 --- a/src/XML/sp_200702/AsymmetricBinding.php +++ b/src/XML/sp_200702/AsymmetricBinding.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An AsymmetricBinding element diff --git a/src/XML/sp_200702/Basic128.php b/src/XML/sp_200702/Basic128.php index e8923626..146d9de9 100644 --- a/src/XML/sp_200702/Basic128.php +++ b/src/XML/sp_200702/Basic128.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128 element diff --git a/src/XML/sp_200702/Basic128Rsa15.php b/src/XML/sp_200702/Basic128Rsa15.php index 6a0039ad..01ca249f 100644 --- a/src/XML/sp_200702/Basic128Rsa15.php +++ b/src/XML/sp_200702/Basic128Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128Rsa15 element diff --git a/src/XML/sp_200702/Basic128Sha256.php b/src/XML/sp_200702/Basic128Sha256.php index d999bbe9..b232a0b3 100644 --- a/src/XML/sp_200702/Basic128Sha256.php +++ b/src/XML/sp_200702/Basic128Sha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128Sha256 element diff --git a/src/XML/sp_200702/Basic128Sha256Rsa15.php b/src/XML/sp_200702/Basic128Sha256Rsa15.php index 06a0d411..d73f0bf2 100644 --- a/src/XML/sp_200702/Basic128Sha256Rsa15.php +++ b/src/XML/sp_200702/Basic128Sha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic128Sha256Rsa15 element diff --git a/src/XML/sp_200702/Basic192.php b/src/XML/sp_200702/Basic192.php index e6470e4e..ac44223d 100644 --- a/src/XML/sp_200702/Basic192.php +++ b/src/XML/sp_200702/Basic192.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192 element diff --git a/src/XML/sp_200702/Basic192Rsa15.php b/src/XML/sp_200702/Basic192Rsa15.php index 9e7d732a..6b6cc050 100644 --- a/src/XML/sp_200702/Basic192Rsa15.php +++ b/src/XML/sp_200702/Basic192Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192Rsa15 element diff --git a/src/XML/sp_200702/Basic192Sha256.php b/src/XML/sp_200702/Basic192Sha256.php index e07803f2..585cbf7e 100644 --- a/src/XML/sp_200702/Basic192Sha256.php +++ b/src/XML/sp_200702/Basic192Sha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192Sha256 element diff --git a/src/XML/sp_200702/Basic192Sha256Rsa15.php b/src/XML/sp_200702/Basic192Sha256Rsa15.php index fade6bc0..59edad9a 100644 --- a/src/XML/sp_200702/Basic192Sha256Rsa15.php +++ b/src/XML/sp_200702/Basic192Sha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic192Sha256Rsa15 element diff --git a/src/XML/sp_200702/Basic256.php b/src/XML/sp_200702/Basic256.php index 7bef9238..a24308c0 100644 --- a/src/XML/sp_200702/Basic256.php +++ b/src/XML/sp_200702/Basic256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256 element diff --git a/src/XML/sp_200702/Basic256Rsa15.php b/src/XML/sp_200702/Basic256Rsa15.php index 82efbff6..6881adc7 100644 --- a/src/XML/sp_200702/Basic256Rsa15.php +++ b/src/XML/sp_200702/Basic256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256Rsa15 element diff --git a/src/XML/sp_200702/Basic256Sha256.php b/src/XML/sp_200702/Basic256Sha256.php index 3d8656e9..ef419b14 100644 --- a/src/XML/sp_200702/Basic256Sha256.php +++ b/src/XML/sp_200702/Basic256Sha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256Sha256 element diff --git a/src/XML/sp_200702/Basic256Sha256Rsa15.php b/src/XML/sp_200702/Basic256Sha256Rsa15.php index 566ce942..da4079bd 100644 --- a/src/XML/sp_200702/Basic256Sha256Rsa15.php +++ b/src/XML/sp_200702/Basic256Sha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Basic256Sha256Rsa15 element diff --git a/src/XML/sp_200702/BootstrapPolicy.php b/src/XML/sp_200702/BootstrapPolicy.php index 01e2adc0..fd0ba2ef 100644 --- a/src/XML/sp_200702/BootstrapPolicy.php +++ b/src/XML/sp_200702/BootstrapPolicy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A BootstrapPolicy element diff --git a/src/XML/sp_200702/ContentEncryptedElements.php b/src/XML/sp_200702/ContentEncryptedElements.php index d9dd1183..c1f8be68 100644 --- a/src/XML/sp_200702/ContentEncryptedElements.php +++ b/src/XML/sp_200702/ContentEncryptedElements.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An ContentEncryptedElements element diff --git a/src/XML/sp_200702/EncryptBeforeSigning.php b/src/XML/sp_200702/EncryptBeforeSigning.php index 5bd6103c..dc2f7589 100644 --- a/src/XML/sp_200702/EncryptBeforeSigning.php +++ b/src/XML/sp_200702/EncryptBeforeSigning.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptBeforeSigning element diff --git a/src/XML/sp_200702/EncryptSignature.php b/src/XML/sp_200702/EncryptSignature.php index de2b6af8..821cd459 100644 --- a/src/XML/sp_200702/EncryptSignature.php +++ b/src/XML/sp_200702/EncryptSignature.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptSignature element diff --git a/src/XML/sp_200702/EncryptedElements.php b/src/XML/sp_200702/EncryptedElements.php index 73c178c0..80575100 100644 --- a/src/XML/sp_200702/EncryptedElements.php +++ b/src/XML/sp_200702/EncryptedElements.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptedElements element diff --git a/src/XML/sp_200702/EncryptedParts.php b/src/XML/sp_200702/EncryptedParts.php index a378282b..674fefd9 100644 --- a/src/XML/sp_200702/EncryptedParts.php +++ b/src/XML/sp_200702/EncryptedParts.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptedParts element diff --git a/src/XML/sp_200702/EncryptedSupportingTokens.php b/src/XML/sp_200702/EncryptedSupportingTokens.php index a2c4f8bb..5aa984fd 100644 --- a/src/XML/sp_200702/EncryptedSupportingTokens.php +++ b/src/XML/sp_200702/EncryptedSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A EncryptedSupportingTokens element diff --git a/src/XML/sp_200702/EncryptionToken.php b/src/XML/sp_200702/EncryptionToken.php index ff221e15..11837a15 100644 --- a/src/XML/sp_200702/EncryptionToken.php +++ b/src/XML/sp_200702/EncryptionToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An EncryptionToken element diff --git a/src/XML/sp_200702/EndorsingEncryptedSupportingTokens.php b/src/XML/sp_200702/EndorsingEncryptedSupportingTokens.php index 1a410982..229d97db 100644 --- a/src/XML/sp_200702/EndorsingEncryptedSupportingTokens.php +++ b/src/XML/sp_200702/EndorsingEncryptedSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A EndorsingEncryptedSupportingTokens element diff --git a/src/XML/sp_200702/EndorsingSupportingTokens.php b/src/XML/sp_200702/EndorsingSupportingTokens.php index faece866..43a69b71 100644 --- a/src/XML/sp_200702/EndorsingSupportingTokens.php +++ b/src/XML/sp_200702/EndorsingSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A EndorsingSupportingTokens element diff --git a/src/XML/sp_200702/HashPassword.php b/src/XML/sp_200702/HashPassword.php index 012507ef..c269f2aa 100644 --- a/src/XML/sp_200702/HashPassword.php +++ b/src/XML/sp_200702/HashPassword.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An HashPassword element diff --git a/src/XML/sp_200702/HttpBasicAuthentication.php b/src/XML/sp_200702/HttpBasicAuthentication.php index 5bb6fa48..9f0a1c30 100644 --- a/src/XML/sp_200702/HttpBasicAuthentication.php +++ b/src/XML/sp_200702/HttpBasicAuthentication.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An HttpBasicAuthentication element diff --git a/src/XML/sp_200702/HttpDigestAuthentication.php b/src/XML/sp_200702/HttpDigestAuthentication.php index 2d8be34f..09b3da36 100644 --- a/src/XML/sp_200702/HttpDigestAuthentication.php +++ b/src/XML/sp_200702/HttpDigestAuthentication.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An HttpDigestAuthentication element diff --git a/src/XML/sp_200702/HttpsToken.php b/src/XML/sp_200702/HttpsToken.php index af45e31b..d02e8006 100644 --- a/src/XML/sp_200702/HttpsToken.php +++ b/src/XML/sp_200702/HttpsToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An HttpsToken element diff --git a/src/XML/sp_200702/IncludeTimestamp.php b/src/XML/sp_200702/IncludeTimestamp.php index f4a80e2f..6952a97f 100644 --- a/src/XML/sp_200702/IncludeTimestamp.php +++ b/src/XML/sp_200702/IncludeTimestamp.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An IncludeTimestamp element diff --git a/src/XML/sp_200702/IncludeTokenTypeTrait.php b/src/XML/sp_200702/IncludeTokenTypeTrait.php index be22e919..8a6a7062 100644 --- a/src/XML/sp_200702/IncludeTokenTypeTrait.php +++ b/src/XML/sp_200702/IncludeTokenTypeTrait.php @@ -4,31 +4,31 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\WSSecurity\Assert\Assert; - -use function is_string; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; /** * Trait grouping common functionality for elements that can hold IncludeToken attributes. * * @package simplesamlphp/ws-security + * + * @phpstan-ignore trait.unused */ trait IncludeTokenTypeTrait { /** * The included token. * - * @var \SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken|string|null + * @var \SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue|null */ - protected IncludeToken|string|null $includeToken; + protected ?IncludeTokenValue $includeToken; /** * Collect the value of the includeToken-property * - * @return \SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken|string|null + * @return \SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue|null */ - public function getIncludeToken(): IncludeToken|string|null + public function getIncludeToken(): ?IncludeTokenValue { return $this->includeToken; } @@ -37,14 +37,10 @@ public function getIncludeToken(): IncludeToken|string|null /** * Set the value of the includeToken-property * - * @param \SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken|string|null $includeToken + * @param \SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue|null $includeToken */ - protected function setIncludeToken(IncludeToken|string|null $includeToken): void + protected function setIncludeToken(?IncludeTokenValue $includeToken): void { - if (is_string($includeToken)) { - Assert::validURI($includeToken); - } - $this->includeToken = $includeToken; } } diff --git a/src/XML/sp_200702/InclusiveC14N.php b/src/XML/sp_200702/InclusiveC14N.php index dce05af0..74dea99c 100644 --- a/src/XML/sp_200702/InclusiveC14N.php +++ b/src/XML/sp_200702/InclusiveC14N.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An InclusiveC14N element diff --git a/src/XML/sp_200702/InitiatorEncryptionToken.php b/src/XML/sp_200702/InitiatorEncryptionToken.php index f67f7e02..32562afa 100644 --- a/src/XML/sp_200702/InitiatorEncryptionToken.php +++ b/src/XML/sp_200702/InitiatorEncryptionToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An InitiatorEncryptionToken element diff --git a/src/XML/sp_200702/InitiatorSignatureToken.php b/src/XML/sp_200702/InitiatorSignatureToken.php index d72db8fc..2ccd27cd 100644 --- a/src/XML/sp_200702/InitiatorSignatureToken.php +++ b/src/XML/sp_200702/InitiatorSignatureToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An InitiatorSignatureToken element diff --git a/src/XML/sp_200702/InitiatorToken.php b/src/XML/sp_200702/InitiatorToken.php index 444be76b..6c4d61f2 100644 --- a/src/XML/sp_200702/InitiatorToken.php +++ b/src/XML/sp_200702/InitiatorToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An InitiatorToken element diff --git a/src/XML/sp_200702/IssuedToken.php b/src/XML/sp_200702/IssuedToken.php index 53f923d6..02f3fb91 100644 --- a/src/XML/sp_200702/IssuedToken.php +++ b/src/XML/sp_200702/IssuedToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An IssuedToken element diff --git a/src/XML/sp_200702/IssuerName.php b/src/XML/sp_200702/IssuerName.php index aab2cef6..173a6304 100644 --- a/src/XML/sp_200702/IssuerName.php +++ b/src/XML/sp_200702/IssuerName.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * An IssuerName element @@ -13,16 +14,9 @@ */ final class IssuerName extends AbstractSpElement { - use URIElementTrait; + use TypedTextContentTrait; - /** - * Initialize an IssuerName. - * - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/sp_200702/KerberosToken.php b/src/XML/sp_200702/KerberosToken.php index b9d2d04b..2232623d 100644 --- a/src/XML/sp_200702/KerberosToken.php +++ b/src/XML/sp_200702/KerberosToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An KerberosToken element diff --git a/src/XML/sp_200702/KeyValueToken.php b/src/XML/sp_200702/KeyValueToken.php index a686bdc6..4e117ec3 100644 --- a/src/XML/sp_200702/KeyValueToken.php +++ b/src/XML/sp_200702/KeyValueToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An KeyValueToken element diff --git a/src/XML/sp_200702/Lax.php b/src/XML/sp_200702/Lax.php index 0931440e..86a47c82 100644 --- a/src/XML/sp_200702/Lax.php +++ b/src/XML/sp_200702/Lax.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Lax element diff --git a/src/XML/sp_200702/LaxTsFirst.php b/src/XML/sp_200702/LaxTsFirst.php index 7612ffb8..62c43ff1 100644 --- a/src/XML/sp_200702/LaxTsFirst.php +++ b/src/XML/sp_200702/LaxTsFirst.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An LaxTsFirst element diff --git a/src/XML/sp_200702/LaxTsLast.php b/src/XML/sp_200702/LaxTsLast.php index e6c5075c..7d000fe4 100644 --- a/src/XML/sp_200702/LaxTsLast.php +++ b/src/XML/sp_200702/LaxTsLast.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An LaxTsLast element diff --git a/src/XML/sp_200702/Layout.php b/src/XML/sp_200702/Layout.php index 13b0db69..04e27ac8 100644 --- a/src/XML/sp_200702/Layout.php +++ b/src/XML/sp_200702/Layout.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Layout element diff --git a/src/XML/sp_200702/MustNotSendAmend.php b/src/XML/sp_200702/MustNotSendAmend.php index f00b557e..53c4aad4 100644 --- a/src/XML/sp_200702/MustNotSendAmend.php +++ b/src/XML/sp_200702/MustNotSendAmend.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustNotSendAmend element diff --git a/src/XML/sp_200702/MustNotSendCancel.php b/src/XML/sp_200702/MustNotSendCancel.php index 20368055..8c6b33f1 100644 --- a/src/XML/sp_200702/MustNotSendCancel.php +++ b/src/XML/sp_200702/MustNotSendCancel.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustNotSendCancel element diff --git a/src/XML/sp_200702/MustNotSendRenew.php b/src/XML/sp_200702/MustNotSendRenew.php index e0051757..2ed25b22 100644 --- a/src/XML/sp_200702/MustNotSendRenew.php +++ b/src/XML/sp_200702/MustNotSendRenew.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustNotSendRenew element diff --git a/src/XML/sp_200702/MustSupportClientChallenge.php b/src/XML/sp_200702/MustSupportClientChallenge.php index b6bbe07f..c3e0fd23 100644 --- a/src/XML/sp_200702/MustSupportClientChallenge.php +++ b/src/XML/sp_200702/MustSupportClientChallenge.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportClientChallenge element diff --git a/src/XML/sp_200702/MustSupportIssuedTokens.php b/src/XML/sp_200702/MustSupportIssuedTokens.php index 3c8ba800..cd66e41a 100644 --- a/src/XML/sp_200702/MustSupportIssuedTokens.php +++ b/src/XML/sp_200702/MustSupportIssuedTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportIssuedTokens element diff --git a/src/XML/sp_200702/MustSupportRefEmbeddedToken.php b/src/XML/sp_200702/MustSupportRefEmbeddedToken.php index 14ee6f4f..03c2c55c 100644 --- a/src/XML/sp_200702/MustSupportRefEmbeddedToken.php +++ b/src/XML/sp_200702/MustSupportRefEmbeddedToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefEmbeddedToken element diff --git a/src/XML/sp_200702/MustSupportRefEncryptedKey.php b/src/XML/sp_200702/MustSupportRefEncryptedKey.php index 41f80440..d0d1a143 100644 --- a/src/XML/sp_200702/MustSupportRefEncryptedKey.php +++ b/src/XML/sp_200702/MustSupportRefEncryptedKey.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefEncryptedKey element diff --git a/src/XML/sp_200702/MustSupportRefExternalURI.php b/src/XML/sp_200702/MustSupportRefExternalURI.php index 893c8f42..7192655c 100644 --- a/src/XML/sp_200702/MustSupportRefExternalURI.php +++ b/src/XML/sp_200702/MustSupportRefExternalURI.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefExternalURI element diff --git a/src/XML/sp_200702/MustSupportRefIssuerSerial.php b/src/XML/sp_200702/MustSupportRefIssuerSerial.php index 33cbbda4..6e2baed2 100644 --- a/src/XML/sp_200702/MustSupportRefIssuerSerial.php +++ b/src/XML/sp_200702/MustSupportRefIssuerSerial.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefIssuerSerial element diff --git a/src/XML/sp_200702/MustSupportRefKeyIdentifier.php b/src/XML/sp_200702/MustSupportRefKeyIdentifier.php index 6599fe98..77ffc337 100644 --- a/src/XML/sp_200702/MustSupportRefKeyIdentifier.php +++ b/src/XML/sp_200702/MustSupportRefKeyIdentifier.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefKeyIdentifier element diff --git a/src/XML/sp_200702/MustSupportRefThumbprint.php b/src/XML/sp_200702/MustSupportRefThumbprint.php index 21a8ad5f..26b90963 100644 --- a/src/XML/sp_200702/MustSupportRefThumbprint.php +++ b/src/XML/sp_200702/MustSupportRefThumbprint.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportRefThumbprint element diff --git a/src/XML/sp_200702/MustSupportServerChallenge.php b/src/XML/sp_200702/MustSupportServerChallenge.php index 228f0f16..da75d799 100644 --- a/src/XML/sp_200702/MustSupportServerChallenge.php +++ b/src/XML/sp_200702/MustSupportServerChallenge.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An MustSupportServerChallenge element diff --git a/src/XML/sp_200702/NoPassword.php b/src/XML/sp_200702/NoPassword.php index 7b999596..f3ca5af6 100644 --- a/src/XML/sp_200702/NoPassword.php +++ b/src/XML/sp_200702/NoPassword.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An NoPassword element diff --git a/src/XML/sp_200702/OnlySignEntireHeadersAndBody.php b/src/XML/sp_200702/OnlySignEntireHeadersAndBody.php index ec78aca9..83c40c60 100644 --- a/src/XML/sp_200702/OnlySignEntireHeadersAndBody.php +++ b/src/XML/sp_200702/OnlySignEntireHeadersAndBody.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An OnlySignEntireHeadersAndBody element diff --git a/src/XML/sp_200702/ProtectTokens.php b/src/XML/sp_200702/ProtectTokens.php index 7d46404d..eb2c7b54 100644 --- a/src/XML/sp_200702/ProtectTokens.php +++ b/src/XML/sp_200702/ProtectTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An ProtectTokens element diff --git a/src/XML/sp_200702/ProtectionToken.php b/src/XML/sp_200702/ProtectionToken.php index e7e11656..3d65a970 100644 --- a/src/XML/sp_200702/ProtectionToken.php +++ b/src/XML/sp_200702/ProtectionToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ProtectionToken element diff --git a/src/XML/sp_200702/RecipientEncryptionToken.php b/src/XML/sp_200702/RecipientEncryptionToken.php index 60ea2e7f..0a4e5bfd 100644 --- a/src/XML/sp_200702/RecipientEncryptionToken.php +++ b/src/XML/sp_200702/RecipientEncryptionToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RecipientEncryptionToken element diff --git a/src/XML/sp_200702/RecipientSignatureToken.php b/src/XML/sp_200702/RecipientSignatureToken.php index e9b0e173..072cecab 100644 --- a/src/XML/sp_200702/RecipientSignatureToken.php +++ b/src/XML/sp_200702/RecipientSignatureToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RecipientSignatureToken element diff --git a/src/XML/sp_200702/RecipientToken.php b/src/XML/sp_200702/RecipientToken.php index 333b7dc6..6e44d2fe 100644 --- a/src/XML/sp_200702/RecipientToken.php +++ b/src/XML/sp_200702/RecipientToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RecipientToken element diff --git a/src/XML/sp_200702/RelToken.php b/src/XML/sp_200702/RelToken.php index a55b9c36..a807c48d 100644 --- a/src/XML/sp_200702/RelToken.php +++ b/src/XML/sp_200702/RelToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RelToken element diff --git a/src/XML/sp_200702/RequireAppliesTo.php b/src/XML/sp_200702/RequireAppliesTo.php index beccb3a2..78c01f9d 100644 --- a/src/XML/sp_200702/RequireAppliesTo.php +++ b/src/XML/sp_200702/RequireAppliesTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireAppliesTo element diff --git a/src/XML/sp_200702/RequireClientCertificate.php b/src/XML/sp_200702/RequireClientCertificate.php index 6d2d3c5a..6603a8af 100644 --- a/src/XML/sp_200702/RequireClientCertificate.php +++ b/src/XML/sp_200702/RequireClientCertificate.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireClientCertificate element diff --git a/src/XML/sp_200702/RequireClientEntropy.php b/src/XML/sp_200702/RequireClientEntropy.php index 3b641080..8220525e 100644 --- a/src/XML/sp_200702/RequireClientEntropy.php +++ b/src/XML/sp_200702/RequireClientEntropy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireClientEntropy element diff --git a/src/XML/sp_200702/RequireDerivedKeys.php b/src/XML/sp_200702/RequireDerivedKeys.php index 8f587fe9..6ac9610b 100644 --- a/src/XML/sp_200702/RequireDerivedKeys.php +++ b/src/XML/sp_200702/RequireDerivedKeys.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireDerivedKeys element diff --git a/src/XML/sp_200702/RequireEmbeddedTokenReference.php b/src/XML/sp_200702/RequireEmbeddedTokenReference.php index 1ccf763b..d698fb6a 100644 --- a/src/XML/sp_200702/RequireEmbeddedTokenReference.php +++ b/src/XML/sp_200702/RequireEmbeddedTokenReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireEmbeddedTokenReference element diff --git a/src/XML/sp_200702/RequireExplicitDerivedKeys.php b/src/XML/sp_200702/RequireExplicitDerivedKeys.php index b79ec05d..9a0d2cea 100644 --- a/src/XML/sp_200702/RequireExplicitDerivedKeys.php +++ b/src/XML/sp_200702/RequireExplicitDerivedKeys.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireExplicitDerivedKeys element diff --git a/src/XML/sp_200702/RequireExternalReference.php b/src/XML/sp_200702/RequireExternalReference.php index f3306864..89b823a6 100644 --- a/src/XML/sp_200702/RequireExternalReference.php +++ b/src/XML/sp_200702/RequireExternalReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireExternalReference element diff --git a/src/XML/sp_200702/RequireExternalUriReference.php b/src/XML/sp_200702/RequireExternalUriReference.php index 93bed58a..a3536310 100644 --- a/src/XML/sp_200702/RequireExternalUriReference.php +++ b/src/XML/sp_200702/RequireExternalUriReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireExternalUriReference element diff --git a/src/XML/sp_200702/RequireImpliedDerivedKeys.php b/src/XML/sp_200702/RequireImpliedDerivedKeys.php index ab7ca439..8e1995d5 100644 --- a/src/XML/sp_200702/RequireImpliedDerivedKeys.php +++ b/src/XML/sp_200702/RequireImpliedDerivedKeys.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireImpliedDerivedKeys element diff --git a/src/XML/sp_200702/RequireInternalReference.php b/src/XML/sp_200702/RequireInternalReference.php index 3aa93dbf..3c62ddaa 100644 --- a/src/XML/sp_200702/RequireInternalReference.php +++ b/src/XML/sp_200702/RequireInternalReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireInternalReference element diff --git a/src/XML/sp_200702/RequireIssuerSerialReference.php b/src/XML/sp_200702/RequireIssuerSerialReference.php index 5c585e5d..435e2189 100644 --- a/src/XML/sp_200702/RequireIssuerSerialReference.php +++ b/src/XML/sp_200702/RequireIssuerSerialReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireIssuerSerialReference element diff --git a/src/XML/sp_200702/RequireKeyIdentifierReference.php b/src/XML/sp_200702/RequireKeyIdentifierReference.php index fb0f9495..c7980478 100644 --- a/src/XML/sp_200702/RequireKeyIdentifierReference.php +++ b/src/XML/sp_200702/RequireKeyIdentifierReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireKeyIdentifierReference element diff --git a/src/XML/sp_200702/RequireRequestSecurityTokenCollection.php b/src/XML/sp_200702/RequireRequestSecurityTokenCollection.php index f50d95aa..5432e66f 100644 --- a/src/XML/sp_200702/RequireRequestSecurityTokenCollection.php +++ b/src/XML/sp_200702/RequireRequestSecurityTokenCollection.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireRequestSecurityTokenCollection element diff --git a/src/XML/sp_200702/RequireServerEntropy.php b/src/XML/sp_200702/RequireServerEntropy.php index 4c560547..6b957815 100644 --- a/src/XML/sp_200702/RequireServerEntropy.php +++ b/src/XML/sp_200702/RequireServerEntropy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireServerEntropy element diff --git a/src/XML/sp_200702/RequireSignatureConfirmation.php b/src/XML/sp_200702/RequireSignatureConfirmation.php index bc1a740d..12b05157 100644 --- a/src/XML/sp_200702/RequireSignatureConfirmation.php +++ b/src/XML/sp_200702/RequireSignatureConfirmation.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireSignatureConfirmation element diff --git a/src/XML/sp_200702/RequireThumbprintReference.php b/src/XML/sp_200702/RequireThumbprintReference.php index e55558f4..ea11288d 100644 --- a/src/XML/sp_200702/RequireThumbprintReference.php +++ b/src/XML/sp_200702/RequireThumbprintReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequireThumbprintReference element diff --git a/src/XML/sp_200702/RequiredElements.php b/src/XML/sp_200702/RequiredElements.php index 556022ff..2bcec454 100644 --- a/src/XML/sp_200702/RequiredElements.php +++ b/src/XML/sp_200702/RequiredElements.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequiredElements element diff --git a/src/XML/sp_200702/RequiredParts.php b/src/XML/sp_200702/RequiredParts.php index c7e52774..1054e8e2 100644 --- a/src/XML/sp_200702/RequiredParts.php +++ b/src/XML/sp_200702/RequiredParts.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RequiredParts element diff --git a/src/XML/sp_200702/RsaKeyValue.php b/src/XML/sp_200702/RsaKeyValue.php index caa1bbb3..3639cc8a 100644 --- a/src/XML/sp_200702/RsaKeyValue.php +++ b/src/XML/sp_200702/RsaKeyValue.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An RsaKeyValue element diff --git a/src/XML/sp_200702/SC13SecurityContextToken.php b/src/XML/sp_200702/SC13SecurityContextToken.php index d4b5f834..661207e1 100644 --- a/src/XML/sp_200702/SC13SecurityContextToken.php +++ b/src/XML/sp_200702/SC13SecurityContextToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SC13SecurityContextToken element diff --git a/src/XML/sp_200702/SOAPNormalization10.php b/src/XML/sp_200702/SOAPNormalization10.php index 342b2e88..e17a66f8 100644 --- a/src/XML/sp_200702/SOAPNormalization10.php +++ b/src/XML/sp_200702/SOAPNormalization10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SOAPNormalization10 element diff --git a/src/XML/sp_200702/STRTransform10.php b/src/XML/sp_200702/STRTransform10.php index 710f9279..97f82c8a 100644 --- a/src/XML/sp_200702/STRTransform10.php +++ b/src/XML/sp_200702/STRTransform10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An STRTransform10 element diff --git a/src/XML/sp_200702/SamlToken.php b/src/XML/sp_200702/SamlToken.php index 5e5d6dee..85ea8515 100644 --- a/src/XML/sp_200702/SamlToken.php +++ b/src/XML/sp_200702/SamlToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SamlToken element diff --git a/src/XML/sp_200702/SecureConversationToken.php b/src/XML/sp_200702/SecureConversationToken.php index 80dd1592..f05e6ae8 100644 --- a/src/XML/sp_200702/SecureConversationToken.php +++ b/src/XML/sp_200702/SecureConversationToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SecureConversationToken element diff --git a/src/XML/sp_200702/SecurityContextToken.php b/src/XML/sp_200702/SecurityContextToken.php index 1709419d..c12903a4 100644 --- a/src/XML/sp_200702/SecurityContextToken.php +++ b/src/XML/sp_200702/SecurityContextToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SecurityContextToken element diff --git a/src/XML/sp_200702/SignatureToken.php b/src/XML/sp_200702/SignatureToken.php index 580d6817..85b2576c 100644 --- a/src/XML/sp_200702/SignatureToken.php +++ b/src/XML/sp_200702/SignatureToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignatureToken element diff --git a/src/XML/sp_200702/SignedElements.php b/src/XML/sp_200702/SignedElements.php index 4d224d18..e34bca2c 100644 --- a/src/XML/sp_200702/SignedElements.php +++ b/src/XML/sp_200702/SignedElements.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignedElements element diff --git a/src/XML/sp_200702/SignedEncryptedSupportingTokens.php b/src/XML/sp_200702/SignedEncryptedSupportingTokens.php index 6ba2f568..bd6d54b6 100644 --- a/src/XML/sp_200702/SignedEncryptedSupportingTokens.php +++ b/src/XML/sp_200702/SignedEncryptedSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignedEncryptedSupportingTokens element diff --git a/src/XML/sp_200702/SignedEndorsingEncryptedSupportingTokens.php b/src/XML/sp_200702/SignedEndorsingEncryptedSupportingTokens.php index 27dec845..6c0cde55 100644 --- a/src/XML/sp_200702/SignedEndorsingEncryptedSupportingTokens.php +++ b/src/XML/sp_200702/SignedEndorsingEncryptedSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignedEndorsingEncryptedSupportingTokens element diff --git a/src/XML/sp_200702/SignedEndorsingSupportingTokens.php b/src/XML/sp_200702/SignedEndorsingSupportingTokens.php index 8d1b639b..d37b407e 100644 --- a/src/XML/sp_200702/SignedEndorsingSupportingTokens.php +++ b/src/XML/sp_200702/SignedEndorsingSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignedEndorsingSupportingTokens element diff --git a/src/XML/sp_200702/SignedParts.php b/src/XML/sp_200702/SignedParts.php index 8a703a59..6f6e85fa 100644 --- a/src/XML/sp_200702/SignedParts.php +++ b/src/XML/sp_200702/SignedParts.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignedParts element diff --git a/src/XML/sp_200702/SignedSupportingTokens.php b/src/XML/sp_200702/SignedSupportingTokens.php index 16716894..e475ec41 100644 --- a/src/XML/sp_200702/SignedSupportingTokens.php +++ b/src/XML/sp_200702/SignedSupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SignedSupportingTokens element diff --git a/src/XML/sp_200702/SpnegoContextToken.php b/src/XML/sp_200702/SpnegoContextToken.php index a92418e7..6a6a6035 100644 --- a/src/XML/sp_200702/SpnegoContextToken.php +++ b/src/XML/sp_200702/SpnegoContextToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SpnegoContextToken element diff --git a/src/XML/sp_200702/Strict.php b/src/XML/sp_200702/Strict.php index d73cfac0..9e0205c5 100644 --- a/src/XML/sp_200702/Strict.php +++ b/src/XML/sp_200702/Strict.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Strict element diff --git a/src/XML/sp_200702/SupportingTokens.php b/src/XML/sp_200702/SupportingTokens.php index d89f7afc..a3e64a70 100644 --- a/src/XML/sp_200702/SupportingTokens.php +++ b/src/XML/sp_200702/SupportingTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SupportingTokens element diff --git a/src/XML/sp_200702/SymmetricBinding.php b/src/XML/sp_200702/SymmetricBinding.php index ab0a0d8d..6314e486 100644 --- a/src/XML/sp_200702/SymmetricBinding.php +++ b/src/XML/sp_200702/SymmetricBinding.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A SymmetricBinding element diff --git a/src/XML/sp_200702/TransportBinding.php b/src/XML/sp_200702/TransportBinding.php index 05c2397e..6b188d04 100644 --- a/src/XML/sp_200702/TransportBinding.php +++ b/src/XML/sp_200702/TransportBinding.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A TransportBinding element diff --git a/src/XML/sp_200702/TransportToken.php b/src/XML/sp_200702/TransportToken.php index 4fc99fb2..b676eda6 100644 --- a/src/XML/sp_200702/TransportToken.php +++ b/src/XML/sp_200702/TransportToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A TransportToken element diff --git a/src/XML/sp_200702/TripleDes.php b/src/XML/sp_200702/TripleDes.php index b2b7886b..67d3b55d 100644 --- a/src/XML/sp_200702/TripleDes.php +++ b/src/XML/sp_200702/TripleDes.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDes element diff --git a/src/XML/sp_200702/TripleDesRsa15.php b/src/XML/sp_200702/TripleDesRsa15.php index 0555aa80..f6170d72 100644 --- a/src/XML/sp_200702/TripleDesRsa15.php +++ b/src/XML/sp_200702/TripleDesRsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDesRsa15 element diff --git a/src/XML/sp_200702/TripleDesSha256.php b/src/XML/sp_200702/TripleDesSha256.php index 7bab51a4..e85bbc67 100644 --- a/src/XML/sp_200702/TripleDesSha256.php +++ b/src/XML/sp_200702/TripleDesSha256.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDesSha256 element diff --git a/src/XML/sp_200702/TripleDesSha256Rsa15.php b/src/XML/sp_200702/TripleDesSha256Rsa15.php index 14781524..82fc0f81 100644 --- a/src/XML/sp_200702/TripleDesSha256Rsa15.php +++ b/src/XML/sp_200702/TripleDesSha256Rsa15.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An TripleDesSha256Rsa15 element diff --git a/src/XML/sp_200702/Trust13.php b/src/XML/sp_200702/Trust13.php index 1b466049..c492040b 100644 --- a/src/XML/sp_200702/Trust13.php +++ b/src/XML/sp_200702/Trust13.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Trust13 element diff --git a/src/XML/sp_200702/Type/IncludeTokenValue.php b/src/XML/sp_200702/Type/IncludeTokenValue.php new file mode 100644 index 00000000..417f50d1 --- /dev/null +++ b/src/XML/sp_200702/Type/IncludeTokenValue.php @@ -0,0 +1,36 @@ +value); + } +} diff --git a/src/XML/sp_200702/UsernameToken.php b/src/XML/sp_200702/UsernameToken.php index e4dac3d3..4ec03ee7 100644 --- a/src/XML/sp_200702/UsernameToken.php +++ b/src/XML/sp_200702/UsernameToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An UsernameToken element diff --git a/src/XML/sp_200702/Wss10.php b/src/XML/sp_200702/Wss10.php index f3fdda54..25d924b8 100644 --- a/src/XML/sp_200702/Wss10.php +++ b/src/XML/sp_200702/Wss10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Wss10 element diff --git a/src/XML/sp_200702/Wss11.php b/src/XML/sp_200702/Wss11.php index 1a7e870e..141723da 100644 --- a/src/XML/sp_200702/Wss11.php +++ b/src/XML/sp_200702/Wss11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Wss11 element diff --git a/src/XML/sp_200702/WssGssKerberosV5ApReqToken11.php b/src/XML/sp_200702/WssGssKerberosV5ApReqToken11.php index 433b42ae..cc0ea985 100644 --- a/src/XML/sp_200702/WssGssKerberosV5ApReqToken11.php +++ b/src/XML/sp_200702/WssGssKerberosV5ApReqToken11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssGssKerberosV5ApReqToken11 element diff --git a/src/XML/sp_200702/WssKerberosV5ApReqToken11.php b/src/XML/sp_200702/WssKerberosV5ApReqToken11.php index 82f72e97..c84a38f1 100644 --- a/src/XML/sp_200702/WssKerberosV5ApReqToken11.php +++ b/src/XML/sp_200702/WssKerberosV5ApReqToken11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssKerberosV5ApReqToken11 element diff --git a/src/XML/sp_200702/WssRelV10Token10.php b/src/XML/sp_200702/WssRelV10Token10.php index 1f37de6b..0f0b8873 100644 --- a/src/XML/sp_200702/WssRelV10Token10.php +++ b/src/XML/sp_200702/WssRelV10Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV10Token10 element diff --git a/src/XML/sp_200702/WssRelV10Token11.php b/src/XML/sp_200702/WssRelV10Token11.php index 5f36ea6e..e261ccdf 100644 --- a/src/XML/sp_200702/WssRelV10Token11.php +++ b/src/XML/sp_200702/WssRelV10Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV10Token11 element diff --git a/src/XML/sp_200702/WssRelV20Token10.php b/src/XML/sp_200702/WssRelV20Token10.php index e4329cef..d322b667 100644 --- a/src/XML/sp_200702/WssRelV20Token10.php +++ b/src/XML/sp_200702/WssRelV20Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV20Token10 element diff --git a/src/XML/sp_200702/WssRelV20Token11.php b/src/XML/sp_200702/WssRelV20Token11.php index f1879777..7abba7ec 100644 --- a/src/XML/sp_200702/WssRelV20Token11.php +++ b/src/XML/sp_200702/WssRelV20Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssRelV20Token11 element diff --git a/src/XML/sp_200702/WssSamlV11Token10.php b/src/XML/sp_200702/WssSamlV11Token10.php index 2fd152c3..fbf429a0 100644 --- a/src/XML/sp_200702/WssSamlV11Token10.php +++ b/src/XML/sp_200702/WssSamlV11Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV11Token10 element diff --git a/src/XML/sp_200702/WssSamlV11Token11.php b/src/XML/sp_200702/WssSamlV11Token11.php index 7bf29ce0..e19c6784 100644 --- a/src/XML/sp_200702/WssSamlV11Token11.php +++ b/src/XML/sp_200702/WssSamlV11Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV11Token11 element diff --git a/src/XML/sp_200702/WssSamlV20Token11.php b/src/XML/sp_200702/WssSamlV20Token11.php index ac375804..c3dcb137 100644 --- a/src/XML/sp_200702/WssSamlV20Token11.php +++ b/src/XML/sp_200702/WssSamlV20Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssSamlV20Token11 element diff --git a/src/XML/sp_200702/WssUsernameToken10.php b/src/XML/sp_200702/WssUsernameToken10.php index 77d71296..0af92dcb 100644 --- a/src/XML/sp_200702/WssUsernameToken10.php +++ b/src/XML/sp_200702/WssUsernameToken10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssUsernameToken10 element diff --git a/src/XML/sp_200702/WssUsernameToken11.php b/src/XML/sp_200702/WssUsernameToken11.php index 623461dd..838779a6 100644 --- a/src/XML/sp_200702/WssUsernameToken11.php +++ b/src/XML/sp_200702/WssUsernameToken11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssUsernameToken11 element diff --git a/src/XML/sp_200702/WssX509Pkcs7Token10.php b/src/XML/sp_200702/WssX509Pkcs7Token10.php index 1ca2e5c9..9dd9f91a 100644 --- a/src/XML/sp_200702/WssX509Pkcs7Token10.php +++ b/src/XML/sp_200702/WssX509Pkcs7Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509Pkcs7Token10 element diff --git a/src/XML/sp_200702/WssX509Pkcs7Token11.php b/src/XML/sp_200702/WssX509Pkcs7Token11.php index 36372688..51793dd0 100644 --- a/src/XML/sp_200702/WssX509Pkcs7Token11.php +++ b/src/XML/sp_200702/WssX509Pkcs7Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509Pkcs7Token11 element diff --git a/src/XML/sp_200702/WssX509PkiPathV1Token10.php b/src/XML/sp_200702/WssX509PkiPathV1Token10.php index 5f0bcac0..b3d27d27 100644 --- a/src/XML/sp_200702/WssX509PkiPathV1Token10.php +++ b/src/XML/sp_200702/WssX509PkiPathV1Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509PkiPathV1Token10 element diff --git a/src/XML/sp_200702/WssX509PkiPathV1Token11.php b/src/XML/sp_200702/WssX509PkiPathV1Token11.php index 931bf2d4..ed976a35 100644 --- a/src/XML/sp_200702/WssX509PkiPathV1Token11.php +++ b/src/XML/sp_200702/WssX509PkiPathV1Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509PkiPathV1Token11 element diff --git a/src/XML/sp_200702/WssX509V1Token11.php b/src/XML/sp_200702/WssX509V1Token11.php index 360e91d0..a66655d7 100644 --- a/src/XML/sp_200702/WssX509V1Token11.php +++ b/src/XML/sp_200702/WssX509V1Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509V1Token11 element diff --git a/src/XML/sp_200702/WssX509V3Token10.php b/src/XML/sp_200702/WssX509V3Token10.php index c852d266..8a024f21 100644 --- a/src/XML/sp_200702/WssX509V3Token10.php +++ b/src/XML/sp_200702/WssX509V3Token10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509V3Token10 element diff --git a/src/XML/sp_200702/WssX509V3Token11.php b/src/XML/sp_200702/WssX509V3Token11.php index e8c868d9..db39e8d7 100644 --- a/src/XML/sp_200702/WssX509V3Token11.php +++ b/src/XML/sp_200702/WssX509V3Token11.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An WssX509V3Token11 element diff --git a/src/XML/sp_200702/X509Token.php b/src/XML/sp_200702/X509Token.php index 3ecc0b59..93b6c5d7 100644 --- a/src/XML/sp_200702/X509Token.php +++ b/src/XML/sp_200702/X509Token.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An X509Token element diff --git a/src/XML/sp_200702/XPath.php b/src/XML/sp_200702/XPath.php index e9ee1e73..36ea981a 100644 --- a/src/XML/sp_200702/XPath.php +++ b/src/XML/sp_200702/XPath.php @@ -8,7 +8,8 @@ use DOMXPath; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\StringElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; /** * An XPath element @@ -17,26 +18,18 @@ */ final class XPath extends AbstractSpElement { - use StringElementTrait; + use TypedTextContentTrait; - /** - * Initialize an XPath. - * - * @param string $content - */ - public function __construct( - string $content, - ) { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; /** * Validate the content of the element. * * @param string $content The value to go in the XML textContent - * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure + * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure * @return void */ protected function validateContent(string $content): void diff --git a/src/XML/sp_200702/XPath10.php b/src/XML/sp_200702/XPath10.php index 5d1fbca2..546456ee 100644 --- a/src/XML/sp_200702/XPath10.php +++ b/src/XML/sp_200702/XPath10.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An XPath10 element diff --git a/src/XML/sp_200702/XPathFilter20.php b/src/XML/sp_200702/XPathFilter20.php index 32a817dd..d193fd3f 100644 --- a/src/XML/sp_200702/XPathFilter20.php +++ b/src/XML/sp_200702/XPathFilter20.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\sp_200702; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An XPathFilter20 element diff --git a/src/XML/wsa_200408/AbstractAttributedQNameType.php b/src/XML/wsa_200408/AbstractAttributedQNameType.php index 1295ad0e..5d734a80 100644 --- a/src/XML/wsa_200408/AbstractAttributedQNameType.php +++ b/src/XML/wsa_200408/AbstractAttributedQNameType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\QNameElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing AttributedQNameType. @@ -23,7 +24,11 @@ abstract class AbstractAttributedQNameType extends AbstractWsaElement { use ExtendableAttributesTrait; - use QNameElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = QNameValue::class; /** The namespace-attribute for the xs:anyElement element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -32,10 +37,10 @@ abstract class AbstractAttributedQNameType extends AbstractWsaElement /** * AbstractAttributedQNameType constructor. * - * @param string $value The QName. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $value The QName. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(QNameValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); @@ -48,7 +53,7 @@ final public function __construct(string $value, array $namespacedAttributes = [ * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -56,7 +61,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(QNameValue::fromDocument($xml->textContent, $xml), self::getAttributesNSFromXML($xml)); } @@ -69,7 +74,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsa_200408/AbstractAttributedURIType.php b/src/XML/wsa_200408/AbstractAttributedURIType.php index 88358d3c..da43850f 100644 --- a/src/XML/wsa_200408/AbstractAttributedURIType.php +++ b/src/XML/wsa_200408/AbstractAttributedURIType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\URIElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing AttributedURIType. @@ -22,7 +23,11 @@ abstract class AbstractAttributedURIType extends AbstractWsaElement { use ExtendableAttributesTrait; - use URIElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -31,10 +36,10 @@ abstract class AbstractAttributedURIType extends AbstractWsaElement /** * AbstractAttributedURIType constructor. * - * @param string $value The localized string. + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $value The localized string. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(AnyURIValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); @@ -47,7 +52,7 @@ final public function __construct(string $value, array $namespacedAttributes = [ * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -55,7 +60,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(AnyURIValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml)); } @@ -68,7 +73,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsa_200408/AbstractEndpointReferenceType.php b/src/XML/wsa_200408/AbstractEndpointReferenceType.php index 0047752d..a1fb2dfd 100644 --- a/src/XML/wsa_200408/AbstractEndpointReferenceType.php +++ b/src/XML/wsa_200408/AbstractEndpointReferenceType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function sprintf; @@ -30,6 +30,7 @@ abstract class AbstractEndpointReferenceType extends AbstractWsaElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -127,9 +128,9 @@ public function getServiceName(): ?ServiceName * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wsa_200408/AbstractRelationshipType.php b/src/XML/wsa_200408/AbstractRelationshipType.php index fd3fecf8..1301fa14 100644 --- a/src/XML/wsa_200408/AbstractRelationshipType.php +++ b/src/XML/wsa_200408/AbstractRelationshipType.php @@ -6,10 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\URIElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing RelationshipType. @@ -22,7 +24,11 @@ abstract class AbstractRelationshipType extends AbstractWsaElement { use ExtendableAttributesTrait; - use URIElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -31,17 +37,15 @@ abstract class AbstractRelationshipType extends AbstractWsaElement /** * AbstractRelationshipType constructor. * - * @param string $value The localized string. - * @param string|null $relationshipType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $value The localized string. + * @param \SimpleSAML\XMLSchema\Type\QNameValue|null $relationshipType * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - string $value, - protected ?string $relationshipType = null, + AnyURIValue $value, + protected ?QNameValue $relationshipType = null, array $namespacedAttributes = [], ) { - Assert::validQName($relationshipType); - $this->setContent($value); $this->setAttributesNS($namespacedAttributes); } @@ -50,7 +54,7 @@ final public function __construct( /** * Retrieve the value of the relationshipType property */ - public function getRelationshipType(): ?string + public function getRelationshipType(): ?QNameValue { return $this->relationshipType; } @@ -62,7 +66,7 @@ public function getRelationshipType(): ?string * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -71,8 +75,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - self::getOptionalAttribute($xml, 'RelationshipType', null), + AnyURIValue::fromString($xml->textContent), + self::getOptionalAttribute($xml, 'RelationshipType', QNameValue::class, null), self::getAttributesNSFromXML($xml), ); } @@ -87,10 +91,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); if ($this->getRelationshipType() !== null) { - $e->setAttribute('RelationshipType', $this->getRelationshipType()); + $e->setAttribute('RelationshipType', $this->getRelationshipType()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wsa_200408/AbstractRetryAfterType.php b/src/XML/wsa_200408/AbstractRetryAfterType.php index 4d42a479..9c00a4d6 100644 --- a/src/XML/wsa_200408/AbstractRetryAfterType.php +++ b/src/XML/wsa_200408/AbstractRetryAfterType.php @@ -6,13 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; - -use function intval; -use function strval; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing RetryAfterType. @@ -25,6 +23,11 @@ abstract class AbstractRetryAfterType extends AbstractWsaElement { use ExtendableAttributesTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = NonNegativeIntegerValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -33,35 +36,25 @@ abstract class AbstractRetryAfterType extends AbstractWsaElement /** * AbstractRetryAfterType constructor. * - * @param int $value The long. + * @param \SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue $value The long. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected int $value, + protected NonNegativeIntegerValue $value, array $namespacedAttributes = [], ) { - Assert::natural($value, SchemaViolationException::class); // Allows 0 as allowed by xs:nonNegativeInteger - + $this->setContent($value); $this->setAttributesNS($namespacedAttributes); } - /** - * Retrieve the value of the value-attribute - */ - public function getValue(): int - { - return $this->value; - } - - /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -69,7 +62,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(intval($xml->textContent), self::getAttributesNSFromXML($xml)); + return new static(NonNegativeIntegerValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml)); } @@ -82,7 +75,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = strval($this->getValue()); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsa_200408/AbstractServiceNameType.php b/src/XML/wsa_200408/AbstractServiceNameType.php index 7cb04d56..2a2644b1 100644 --- a/src/XML/wsa_200408/AbstractServiceNameType.php +++ b/src/XML/wsa_200408/AbstractServiceNameType.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\QNameElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing ServiceNameType. @@ -24,7 +25,11 @@ abstract class AbstractServiceNameType extends AbstractWsaElement { use ExtendableAttributesTrait; - use QNameElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = QNameValue::class; /** The namespace-attribute for the xs:anyElement element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -33,17 +38,15 @@ abstract class AbstractServiceNameType extends AbstractWsaElement /** * AbstractServiceNameType constructor. * - * @param string $value The QName. - * @param string|null $portName The PortName. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $value The QName. + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $portName The PortName. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - string $value, - protected ?string $portName = null, + QNameValue $value, + protected ?NCNameValue $portName = null, array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($portName, SchemaViolationException::class); - $this->setContent($value); $this->setAttributesNS($namespacedAttributes); } @@ -52,7 +55,7 @@ final public function __construct( /** * Get the value of the portName property */ - public function getPortName(): ?string + public function getPortName(): ?NCNameValue { return $this->portName; } @@ -64,7 +67,7 @@ public function getPortName(): ?string * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -73,8 +76,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - self::getOptionalAttribute($xml, 'PortName', null), + QNameValue::fromDocument($xml->textContent, $xml), + self::getOptionalAttribute($xml, 'PortName', NCNameValue::class, null), self::getAttributesNSFromXML($xml), ); } @@ -89,10 +92,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); if ($this->getPortName() !== null) { - $e->setAttribute('PortName', $this->getPortName()); + $e->setAttribute('PortName', $this->getPortName()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wsa_200408/Action.php b/src/XML/wsa_200408/Action.php index 92c68e15..8a94b8bf 100644 --- a/src/XML/wsa_200408/Action.php +++ b/src/XML/wsa_200408/Action.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed URI diff --git a/src/XML/wsa_200408/EndpointReference.php b/src/XML/wsa_200408/EndpointReference.php index e98d8e38..1871b89c 100644 --- a/src/XML/wsa_200408/EndpointReference.php +++ b/src/XML/wsa_200408/EndpointReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200408/FaultTo.php b/src/XML/wsa_200408/FaultTo.php index 6612cbcc..8853a88c 100644 --- a/src/XML/wsa_200408/FaultTo.php +++ b/src/XML/wsa_200408/FaultTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200408/From.php b/src/XML/wsa_200408/From.php index 925d35e5..f246535d 100644 --- a/src/XML/wsa_200408/From.php +++ b/src/XML/wsa_200408/From.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200408/MessageID.php b/src/XML/wsa_200408/MessageID.php index a741169c..6637ffd6 100644 --- a/src/XML/wsa_200408/MessageID.php +++ b/src/XML/wsa_200408/MessageID.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed URI diff --git a/src/XML/wsa_200408/ReferenceParameters.php b/src/XML/wsa_200408/ReferenceParameters.php index 837d4f3f..5d004ae6 100644 --- a/src/XML/wsa_200408/ReferenceParameters.php +++ b/src/XML/wsa_200408/ReferenceParameters.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a wsa:ReferenceParameters element. @@ -19,6 +19,7 @@ final class ReferenceParameters extends AbstractWsaElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -51,7 +52,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -75,7 +76,6 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsa_200408/ReferenceProperties.php b/src/XML/wsa_200408/ReferenceProperties.php index 0ad6a8fa..adb0deff 100644 --- a/src/XML/wsa_200408/ReferenceProperties.php +++ b/src/XML/wsa_200408/ReferenceProperties.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a wsa:ReferenceProperties element. @@ -19,6 +19,7 @@ final class ReferenceProperties extends AbstractWsaElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -51,7 +52,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -75,7 +76,6 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsa_200408/RelatesTo.php b/src/XML/wsa_200408/RelatesTo.php index 272c6b68..a2f8b6b3 100644 --- a/src/XML/wsa_200408/RelatesTo.php +++ b/src/XML/wsa_200408/RelatesTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * @package simplesamlphp/ws-security diff --git a/src/XML/wsa_200408/ReplyTo.php b/src/XML/wsa_200408/ReplyTo.php index f023d486..9016f76e 100644 --- a/src/XML/wsa_200408/ReplyTo.php +++ b/src/XML/wsa_200408/ReplyTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200408/RetryAfter.php b/src/XML/wsa_200408/RetryAfter.php index 4b78e9d4..d11edf9f 100644 --- a/src/XML/wsa_200408/RetryAfter.php +++ b/src/XML/wsa_200408/RetryAfter.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * @package simplesamlphp/ws-security diff --git a/src/XML/wsa_200408/To.php b/src/XML/wsa_200408/To.php index 533df172..495e7078 100644 --- a/src/XML/wsa_200408/To.php +++ b/src/XML/wsa_200408/To.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200408; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed URI diff --git a/src/XML/wsa_200508/AbstractAttributedQNameType.php b/src/XML/wsa_200508/AbstractAttributedQNameType.php index e551a00b..f340fccc 100644 --- a/src/XML/wsa_200508/AbstractAttributedQNameType.php +++ b/src/XML/wsa_200508/AbstractAttributedQNameType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\QNameElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing AttributedQNameType. @@ -23,7 +24,11 @@ abstract class AbstractAttributedQNameType extends AbstractWsaElement { use ExtendableAttributesTrait; - use QNameElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = QNameValue::class; /** The namespace-attribute for the xs:anyElement element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -32,10 +37,10 @@ abstract class AbstractAttributedQNameType extends AbstractWsaElement /** * AbstractAttributedQNameType constructor. * - * @param string $value The QName. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $value The QName. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(QNameValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); @@ -48,7 +53,7 @@ final public function __construct(string $value, array $namespacedAttributes = [ * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -56,7 +61,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(QNameValue::fromDocument($xml->textContent, $xml), self::getAttributesNSFromXML($xml)); } @@ -69,7 +74,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsa_200508/AbstractAttributedURIType.php b/src/XML/wsa_200508/AbstractAttributedURIType.php index 4477124c..96826f11 100644 --- a/src/XML/wsa_200508/AbstractAttributedURIType.php +++ b/src/XML/wsa_200508/AbstractAttributedURIType.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\URIElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing AttributedURIType. @@ -22,7 +23,11 @@ abstract class AbstractAttributedURIType extends AbstractWsaElement { use ExtendableAttributesTrait; - use URIElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -31,10 +36,10 @@ abstract class AbstractAttributedURIType extends AbstractWsaElement /** * AbstractAttributedURIType constructor. * - * @param string $value The localized string. + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $value The localized URI. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(AnyURIValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); @@ -47,7 +52,7 @@ final public function __construct(string $value, array $namespacedAttributes = [ * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -55,7 +60,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(AnyURIValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml)); } @@ -68,7 +73,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsa_200508/AbstractAttributedLongType.php b/src/XML/wsa_200508/AbstractAttributedUnsignedLongType.php similarity index 62% rename from src/XML/wsa_200508/AbstractAttributedLongType.php rename to src/XML/wsa_200508/AbstractAttributedUnsignedLongType.php index 0176e7a8..0bd78c4e 100644 --- a/src/XML/wsa_200508/AbstractAttributedLongType.php +++ b/src/XML/wsa_200508/AbstractAttributedUnsignedLongType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\UnsignedLongValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing AttributedLongType. @@ -20,10 +20,14 @@ * * @package simplesamlphp/ws-security */ -abstract class AbstractAttributedLongType extends AbstractWsaElement +abstract class AbstractAttributedUnsignedLongType extends AbstractWsaElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = UnsignedLongValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -32,38 +36,23 @@ abstract class AbstractAttributedLongType extends AbstractWsaElement /** * AbstractAttributedLongType constructor. * - * @param string $value The long. + * @param \SimpleSAML\XMLSchema\Type\UnsignedLongValue $value The long. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ - final public function __construct(string $value, array $namespacedAttributes = []) + final public function __construct(UnsignedLongValue $value, array $namespacedAttributes = []) { $this->setContent($value); $this->setAttributesNS($namespacedAttributes); } - /** - * 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 - { - $content = intval($content); - Assert::natural($content, SchemaViolationException::class); - Assert::range($content, 0, 18446744073709551615, SchemaViolationException::class); - } - - /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -71,7 +60,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static($xml->textContent, self::getAttributesNSFromXML($xml)); + return new static(UnsignedLongValue::fromString($xml->textContent), self::getAttributesNSFromXML($xml)); } @@ -84,7 +73,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsa_200508/AbstractEndpointReferenceType.php b/src/XML/wsa_200508/AbstractEndpointReferenceType.php index 1dd43417..008d0c2d 100644 --- a/src/XML/wsa_200508/AbstractEndpointReferenceType.php +++ b/src/XML/wsa_200508/AbstractEndpointReferenceType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function sprintf; @@ -30,6 +30,7 @@ abstract class AbstractEndpointReferenceType extends AbstractWsaElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -101,9 +102,9 @@ public function getMetadata(): ?Metadata * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static @@ -154,7 +155,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $this->getReferenceParameters()?->toXML($e); $this->getMetadata()?->toXML($e); - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsa_200508/AbstractProblemActionType.php b/src/XML/wsa_200508/AbstractProblemActionType.php index 6914e62d..84487698 100644 --- a/src/XML/wsa_200508/AbstractProblemActionType.php +++ b/src/XML/wsa_200508/AbstractProblemActionType.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing WS-addressing ProblemActionType. @@ -21,6 +21,7 @@ abstract class AbstractProblemActionType extends AbstractWsaElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; diff --git a/src/XML/wsa_200508/Action.php b/src/XML/wsa_200508/Action.php index 43086f34..e872d73f 100644 --- a/src/XML/wsa_200508/Action.php +++ b/src/XML/wsa_200508/Action.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed URI diff --git a/src/XML/wsa_200508/EndpointReference.php b/src/XML/wsa_200508/EndpointReference.php index ec7a0ba2..c3aa7b75 100644 --- a/src/XML/wsa_200508/EndpointReference.php +++ b/src/XML/wsa_200508/EndpointReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200508/FaultTo.php b/src/XML/wsa_200508/FaultTo.php index db9d6e7a..e085ce43 100644 --- a/src/XML/wsa_200508/FaultTo.php +++ b/src/XML/wsa_200508/FaultTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200508/From.php b/src/XML/wsa_200508/From.php index 997f0194..ac94d599 100644 --- a/src/XML/wsa_200508/From.php +++ b/src/XML/wsa_200508/From.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200508/MessageID.php b/src/XML/wsa_200508/MessageID.php index 8ccf1d0b..0f8bdea1 100644 --- a/src/XML/wsa_200508/MessageID.php +++ b/src/XML/wsa_200508/MessageID.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed URI diff --git a/src/XML/wsa_200508/Metadata.php b/src/XML/wsa_200508/Metadata.php index 687ef12c..faa50351 100644 --- a/src/XML/wsa_200508/Metadata.php +++ b/src/XML/wsa_200508/Metadata.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a wsa:Metadata element. @@ -23,6 +24,7 @@ final class Metadata extends AbstractWsaElement implements SchemaValidatableElem use ExtendableElementTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -50,7 +52,7 @@ public function __construct(array $children = [], array $namespacedAttributes = */ public function isEmptyElement(): bool { - return empty($this->elements) && empty($this->namespacedAttributes); + return empty($this->getElements()) && empty($this->getAttributesNS()); } @@ -60,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -89,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsa_200508/ProblemAction.php b/src/XML/wsa_200508/ProblemAction.php index 326c82c3..5567bb82 100644 --- a/src/XML/wsa_200508/ProblemAction.php +++ b/src/XML/wsa_200508/ProblemAction.php @@ -6,9 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; @@ -21,13 +22,14 @@ final class ProblemAction extends AbstractProblemActionType implements SchemaVal { use SchemaValidatableElementTrait; + /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wsa_200508/ProblemHeaderQName.php b/src/XML/wsa_200508/ProblemHeaderQName.php index 14063655..df0a820b 100644 --- a/src/XML/wsa_200508/ProblemHeaderQName.php +++ b/src/XML/wsa_200508/ProblemHeaderQName.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed QName diff --git a/src/XML/wsa_200508/ProblemIRI.php b/src/XML/wsa_200508/ProblemIRI.php index fc099ecf..8d4a9031 100644 --- a/src/XML/wsa_200508/ProblemIRI.php +++ b/src/XML/wsa_200508/ProblemIRI.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed URI diff --git a/src/XML/wsa_200508/ReferenceParameters.php b/src/XML/wsa_200508/ReferenceParameters.php index 54941706..ec7395b8 100644 --- a/src/XML/wsa_200508/ReferenceParameters.php +++ b/src/XML/wsa_200508/ReferenceParameters.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a wsa:ReferenceParameters element. @@ -23,6 +24,7 @@ final class ReferenceParameters extends AbstractWsaElement implements SchemaVali use ExtendableElementTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -50,7 +52,7 @@ public function __construct(array $children = [], array $namespacedAttributes = */ public function isEmptyElement(): bool { - return empty($this->elements) && empty($this->namespacedAttributes); + return empty($this->getElements()) && empty($this->getAttributesNS()); } @@ -60,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -89,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsa_200508/RelatesTo.php b/src/XML/wsa_200508/RelatesTo.php index 1d9e5a91..9d3dd273 100644 --- a/src/XML/wsa_200508/RelatesTo.php +++ b/src/XML/wsa_200508/RelatesTo.php @@ -6,12 +6,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a wsa:RelatesTo element. @@ -22,7 +23,11 @@ final class RelatesTo extends AbstractWsaElement implements SchemaValidatableEle { use ExtendableAttributesTrait; use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -31,17 +36,15 @@ final class RelatesTo extends AbstractWsaElement implements SchemaValidatableEle /** * Initialize a wsa:RelatesTo * - * @param string $content - * @param string|null $RelationshipType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $content + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $RelationshipType * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( - string $content, - protected ?string $RelationshipType = 'http://www.w3.org/2005/08/addressing/reply', + AnyURIValue $content, + protected ?AnyURIValue $RelationshipType, array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($RelationshipType, SchemaViolationException::class); - $this->setContent($content); $this->setAttributesNS($namespacedAttributes); } @@ -50,9 +53,9 @@ public function __construct( /** * Collect the value of the RelationshipType property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getRelationshipType(): ?string + public function getRelationshipType(): ?AnyURIValue { return $this->RelationshipType; } @@ -64,7 +67,7 @@ public function getRelationshipType(): ?string * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -73,8 +76,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, RelatesTo::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - self::getOptionalAttribute($xml, 'RelationshipType', null), + AnyURIValue::fromString($xml->textContent), + self::getOptionalAttribute($xml, 'RelationshipType', AnyURIValue::class, null), self::getAttributesNSFromXML($xml), ); } @@ -89,10 +92,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); if ($this->getRelationshipType() !== null) { - $e->setAttribute('RelationshipType', $this->getRelationshipType()); + $e->setAttribute('RelationshipType', $this->getRelationshipType()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wsa_200508/ReplyTo.php b/src/XML/wsa_200508/ReplyTo.php index bf6eec29..20928647 100644 --- a/src/XML/wsa_200508/ReplyTo.php +++ b/src/XML/wsa_200508/ReplyTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An endpoint reference diff --git a/src/XML/wsa_200508/RetryAfter.php b/src/XML/wsa_200508/RetryAfter.php index a304fad5..c324d227 100644 --- a/src/XML/wsa_200508/RetryAfter.php +++ b/src/XML/wsa_200508/RetryAfter.php @@ -4,14 +4,15 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed long * * @package simplesamlphp/ws-security */ -final class RetryAfter extends AbstractAttributedLongType implements SchemaValidatableElementInterface +final class RetryAfter extends AbstractAttributedUnsignedLongType implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; } diff --git a/src/XML/wsa_200508/SoapAction.php b/src/XML/wsa_200508/SoapAction.php index 16fca55c..96f11e16 100644 --- a/src/XML/wsa_200508/SoapAction.php +++ b/src/XML/wsa_200508/SoapAction.php @@ -4,59 +4,17 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * @package simplesamlphp/ws-security */ final class SoapAction extends AbstractWsaElement { - use URIElementTrait; + use TypedTextContentTrait; - /** - * Initialize a wsa:SoapAction - * - * @param string $value - */ - public function __construct(string $value) - { - $this->setContent($value); - } - - - /** - * Convert XML into a wsa:SoapAction - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, 'SoapAction', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, SoapAction::NS, InvalidDOMElementException::class); - - return new static($xml->textContent); - } - - - /** - * Convert this element to XML. - * - * @param \DOMElement|null $parent The element we should append this element to. - * @return \DOMElement - */ - public function toXML(?DOMElement $parent = null): DOMElement - { - $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); - - return $e; - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wsa_200508/To.php b/src/XML/wsa_200508/To.php index 6a7e11dd..c3507427 100644 --- a/src/XML/wsa_200508/To.php +++ b/src/XML/wsa_200508/To.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsa_200508; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An attributed URI diff --git a/src/XML/wsaw/AbstractAttributedQNameType.php b/src/XML/wsaw/AbstractAttributedQNameType.php index e5fa6a29..bef3b263 100644 --- a/src/XML/wsaw/AbstractAttributedQNameType.php +++ b/src/XML/wsaw/AbstractAttributedQNameType.php @@ -6,8 +6,9 @@ use DOMElement; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\QNameElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Abstract class defining the AttributedQName type @@ -17,20 +18,24 @@ abstract class AbstractAttributedQNameType extends AbstractWsawElement { use ExtendableAttributesTrait; - use QNameElementTrait; + use TypedTextContentTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + /** @var string */ + public const TEXTCONTENT_TYPE = QNameValue::class; + /** * AbstractAttributedQNameType constructor * - * @param string $value + * @param \SimpleSAML\XMLSchema\Type\QNameValue $value * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ public function __construct( - string $value, + QNameValue $value, array $namespacedAttributes = [], ) { $this->setContent($value); @@ -47,7 +52,7 @@ public function __construct( public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsaw/AbstractServiceNameType.php b/src/XML/wsaw/AbstractServiceNameType.php index 9790c6a9..5cfcb668 100644 --- a/src/XML/wsaw/AbstractServiceNameType.php +++ b/src/XML/wsaw/AbstractServiceNameType.php @@ -5,11 +5,11 @@ namespace SimpleSAML\WSSecurity\XML\wsaw; use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\QNameElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Abstract class defining the ServiceNameType type @@ -19,26 +19,28 @@ abstract class AbstractServiceNameType extends AbstractWsawElement { use ExtendableAttributesTrait; - use QNameElementTrait; + use TypedTextContentTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + /** @var string */ + public const TEXTCONTENT_TYPE = QNameValue::class; + /** * AbstractServiceName constructor * - * @param string $value - * @param string|null $endpointName + * @param \SimpleSAML\XMLSchema\Type\QNameValue $value + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $endpointName * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ public function __construct( - string $value, - protected ?string $endpointName = null, + QNameValue $value, + protected ?NCNameValue $endpointName = null, array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($endpointName, SchemaViolationException::class); - $this->setContent($value); $this->setAttributesNS($namespacedAttributes); } @@ -47,9 +49,9 @@ public function __construct( /** * Collect the value of the endpointName property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\NCNameValue|null */ - public function getEndpointName(): ?string + public function getEndpointName(): ?NCNameValue { return $this->endpointName; } @@ -64,10 +66,10 @@ public function getEndpointName(): ?string public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); if ($this->getEndpointName() !== null) { - $e->setAttribute('EndpointName', $this->getEndpointName()); + $e->setAttribute('EndpointName', $this->getEndpointName()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wsaw/ActionTrait.php b/src/XML/wsaw/ActionTrait.php index d8818fb5..551a573a 100644 --- a/src/XML/wsaw/ActionTrait.php +++ b/src/XML/wsaw/ActionTrait.php @@ -4,28 +4,29 @@ namespace SimpleSAML\WSSecurity\XML\wsaw; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * Trait adding methods to handle elements that define the action-attribute. * * @package simplesamlphp/ws-security + * + * @phpstan-ignore trait.unused */ trait ActionTrait { /** - * @var string|null + * @var \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - protected ?string $action; + protected ?AnyURIValue $action; /** * Collect the value of the action property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getAction(): ?string + public function getAction(): ?AnyURIValue { return $this->action; } @@ -34,12 +35,10 @@ public function getAction(): ?string /** * Set the value of the action property. * - * @param string|null $action - * @throws \SimpleSAML\XML\Exception\SchemViolationException + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $action */ - protected function setAction(?string $action): void + protected function setAction(?AnyURIValue $action): void { - Assert::nullOrValidURI($action, SchemaViolationException::class); $this->action = $action; } } diff --git a/src/XML/wsaw/Anonymous.php b/src/XML/wsaw/Anonymous.php index d99828db..157a642c 100644 --- a/src/XML/wsaw/Anonymous.php +++ b/src/XML/wsaw/Anonymous.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use ValueError; use function sprintf; @@ -25,6 +26,7 @@ final class Anonymous extends AbstractAnonymousType implements SchemaValidatable use ExtendableAttributesTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -50,7 +52,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wsaw/InterfaceName.php b/src/XML/wsaw/InterfaceName.php index 7b7bf730..944c3ce4 100644 --- a/src/XML/wsaw/InterfaceName.php +++ b/src/XML/wsaw/InterfaceName.php @@ -6,8 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Class defining the InterfaceName element @@ -18,13 +20,14 @@ final class InterfaceName extends AbstractAttributedQNameType implements SchemaV { use SchemaValidatableElementTrait; + /** * Create an instance of this object from its XML representation. * * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -33,7 +36,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, + QNameValue::fromDocument($xml->textContent, $xml), self::getAttributesNSFromXML($xml), ); } diff --git a/src/XML/wsaw/ServiceName.php b/src/XML/wsaw/ServiceName.php index 9ee03f86..5972edec 100644 --- a/src/XML/wsaw/ServiceName.php +++ b/src/XML/wsaw/ServiceName.php @@ -6,8 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Class defining the ServiceName element @@ -18,13 +21,14 @@ final class ServiceName extends AbstractServiceNameType implements SchemaValidat { use SchemaValidatableElementTrait; + /** * Create an instance of this object from its XML representation. * * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -33,8 +37,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - self::getOptionalAttribute($xml, 'EndpointName', null), + QNameValue::fromDocument($xml->textContent, $xml), + self::getOptionalAttribute($xml, 'EndpointName', NCNameValue::class, null), self::getAttributesNSFromXML($xml), ); } diff --git a/src/XML/wsaw/UsingAddressing.php b/src/XML/wsaw/UsingAddressing.php index 9a090578..10661a8d 100644 --- a/src/XML/wsaw/UsingAddressing.php +++ b/src/XML/wsaw/UsingAddressing.php @@ -6,10 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the UsingAddressing element @@ -21,6 +22,7 @@ final class UsingAddressing extends AbstractWsawElement implements SchemaValidat use ExtendableAttributesTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -43,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wsp/AbstractOperatorContentType.php b/src/XML/wsp/AbstractOperatorContentType.php index 9370c16f..14519242 100644 --- a/src/XML/wsp/AbstractOperatorContentType.php +++ b/src/XML/wsp/AbstractOperatorContentType.php @@ -9,10 +9,10 @@ use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a wsp:OperatorContentType element. @@ -25,6 +25,7 @@ abstract class AbstractOperatorContentType extends AbstractWspElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -90,7 +91,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -135,8 +136,9 @@ public function toXML(?DOMElement $parent = null): DOMElement } foreach ($this->getElements() as $c) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $c */ - $c->toXML($e); + if (!$c->isEmptyElement()) { + $c->toXML($e); + } } return $e; diff --git a/src/XML/wsp/All.php b/src/XML/wsp/All.php index 73a1aa30..61f79adc 100644 --- a/src/XML/wsp/All.php +++ b/src/XML/wsp/All.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsp; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the All element diff --git a/src/XML/wsp/AppliesTo.php b/src/XML/wsp/AppliesTo.php index e4de6627..0a900434 100644 --- a/src/XML/wsp/AppliesTo.php +++ b/src/XML/wsp/AppliesTo.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a wsp:AppliesTo element. @@ -23,6 +24,7 @@ final class AppliesTo extends AbstractWspElement implements SchemaValidatableEle use ExtendableElementTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -60,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -89,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsp/ExactlyOne.php b/src/XML/wsp/ExactlyOne.php index 01ca3f10..3ff406c1 100644 --- a/src/XML/wsp/ExactlyOne.php +++ b/src/XML/wsp/ExactlyOne.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsp; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the ExactlyOne element diff --git a/src/XML/wsp/OptionalTrait.php b/src/XML/wsp/OptionalTrait.php index b194a26e..f944b807 100644 --- a/src/XML/wsp/OptionalTrait.php +++ b/src/XML/wsp/OptionalTrait.php @@ -8,6 +8,7 @@ * Trait grouping common functionality for elements that can hold an Optional attribute. * * @package simplesamlphp/ws-security + * @phpstan-ignore trait.unused */ trait OptionalTrait { diff --git a/src/XML/wsp/Policy.php b/src/XML/wsp/Policy.php index 64efeb78..8638f05b 100644 --- a/src/XML/wsp/Policy.php +++ b/src/XML/wsp/Policy.php @@ -7,13 +7,14 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Attribute as XMLAttribute; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the Policy element @@ -25,6 +26,7 @@ final class Policy extends AbstractOperatorContentType implements SchemaValidata use ExtendableAttributesTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; @@ -32,27 +34,22 @@ final class Policy extends AbstractOperatorContentType implements SchemaValidata /** * Initialize a wsp:Policy * - * @param string|null $Name - * @param \SimpleSAML\XML\Attribute|null $Id * @param (\SimpleSAML\WSSecurity\XML\wsp\All| * \SimpleSAML\WSSecurity\XML\wsp\ExactlyOne| * \SimpleSAML\WSSecurity\XML\wsp\Policy| * \SimpleSAML\WSSecurity\XML\wsp\PolicyReference)[] $operatorContent - * @param \SimpleSAML\XML\Chunk[] $children + * @param \SimpleSAML\XML\SerializableElementInterface[] $children + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Name + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ public function __construct( - protected ?string $Name = null, - protected ?XMLAttribute $Id = null, array $operatorContent = [], array $children = [], + protected ?AnyURIValue $Name = null, + protected ?IDValue $Id = null, array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($Name, SchemaViolationException::class); - if ($Id !== null) { - Assert::validNCName($Id->getAttrValue(), SchemaViolationException::class); - } - $this->setAttributesNS($namespacedAttributes); parent::__construct($operatorContent, $children); @@ -60,18 +57,18 @@ public function __construct( /** - * @return \SimpleSAML\XML\Attribute|null + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null */ - public function getId(): ?XMLAttribute + public function getId(): ?IDValue { return $this->Id; } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getName(): ?string + public function getName(): ?AnyURIValue { return $this->Name; } @@ -97,7 +94,7 @@ final public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ #[\Override] @@ -108,7 +105,7 @@ public static function fromXML(DOMElement $xml): static $Id = null; if ($xml->hasAttributeNS(C::NS_SEC_UTIL, 'Id')) { - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', $xml->getAttributeNS(C::NS_SEC_UTIL, 'Id')); + $Id = IDValue::fromString($xml->getAttributeNS(C::NS_SEC_UTIL, 'Id')); } $namespacedAttributes = self::getAttributesNSFromXML($xml); @@ -145,10 +142,10 @@ public static function fromXML(DOMElement $xml): static } return new static( - self::getOptionalAttribute($xml, 'Name', null), - $Id, $operatorContent, $children, + self::getOptionalAttribute($xml, 'Name', AnyURIValue::class, null), + $Id, $namespacedAttributes, ); } @@ -165,10 +162,10 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::toXML($parent); if ($this->getName() !== null) { - $e->setAttribute('Name', $this->getName()); + $e->setAttribute('Name', $this->getName()->getValue()); } - $this->getId()?->toXML($e); + $this->getId()?->toAttribute()->toXML($e); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wsp/PolicyAttachment.php b/src/XML/wsp/PolicyAttachment.php index d5f73c77..fd851042 100644 --- a/src/XML/wsp/PolicyAttachment.php +++ b/src/XML/wsp/PolicyAttachment.php @@ -9,13 +9,14 @@ use SimpleSAML\WSSecurity\XML\wsp\AppliesTo; use SimpleSAML\WSSecurity\XML\wsp\Policy; use SimpleSAML\WSSecurity\XML\wsp\PolicyReference; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_merge; @@ -30,6 +31,7 @@ final class PolicyAttachment extends AbstractWspElement implements SchemaValidat use ExtendableElementTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -84,7 +86,7 @@ public function getPolicies(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -131,7 +133,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsp/PolicyReference.php b/src/XML/wsp/PolicyReference.php index a2e737c8..04992410 100644 --- a/src/XML/wsp/PolicyReference.php +++ b/src/XML/wsp/PolicyReference.php @@ -6,13 +6,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; - -use function str_replace; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the PolicyReference element @@ -24,6 +24,7 @@ final class PolicyReference extends AbstractWspElement implements SchemaValidata use ExtendableAttributesTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; @@ -31,47 +32,43 @@ final class PolicyReference extends AbstractWspElement implements SchemaValidata /** * Initialize a wsp:PolicyReference * - * @param string $URI - * @param string|null $Digest - * @param string $DigestAlgorithm + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $URI + * @param \SimpleSAML\XMLSchema\Type\Base64BinaryValue|null $Digest + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $DigestAlgorithm * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ public function __construct( - protected string $URI, - protected ?string $Digest = null, - protected ?string $DigestAlgorithm = 'http://schemas.xmlsoap.org/ws/2004/09/policy/Sha1Exc', + protected AnyURIValue $URI, + protected ?Base64BinaryValue $Digest = null, + protected ?AnyURIValue $DigestAlgorithm = null, array $namespacedAttributes = [], ) { - Assert::validURI($URI, SchemaViolationException::class); - Assert::nullOrValidBase64($Digest, SchemaViolationException::class); - Assert::nullOrValidURI($DigestAlgorithm, SchemaViolationException::class); - $this->setAttributesNS($namespacedAttributes); } /** - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getURI(): string + public function getURI(): AnyURIValue { return $this->URI; } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\Base64BinaryValue|null */ - public function getDigest(): ?string + public function getDigest(): ?Base64BinaryValue { - return $this->Digest ? str_replace(["\f", "\r", "\n", "\t", "\v", ' '], '', $this->Digest) : null; + return $this->Digest; } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getDigestAlgorithm(): ?string + public function getDigestAlgorithm(): ?AnyURIValue { return $this->DigestAlgorithm; } @@ -83,7 +80,7 @@ public function getDigestAlgorithm(): ?string * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -108,9 +105,9 @@ public static function fromXML(DOMElement $xml): static } return new static( - self::getAttribute($xml, 'URI'), - self::getOptionalAttribute($xml, 'Digest', null), - self::getOptionalAttribute($xml, 'DigestAlgorithm', null), + self::getAttribute($xml, 'URI', AnyURIValue::class), + self::getOptionalAttribute($xml, 'Digest', Base64BinaryValue::class, null), + self::getOptionalAttribute($xml, 'DigestAlgorithm', AnyURIValue::class, null), $namespacedAttributes, ); } @@ -125,14 +122,14 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('URI', $this->getURI()); + $e->setAttribute('URI', $this->getURI()->getValue()); if ($this->getDigest() !== null) { - $e->setAttribute('Digest', $this->getDigest()); + $e->setAttribute('Digest', $this->getDigest()->getValue()); } if ($this->getDigestAlgorithm() !== null) { - $e->setAttribute('DigestAlgorithm', $this->getDigestAlgorithm()); + $e->setAttribute('DigestAlgorithm', $this->getDigestAlgorithm()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wsp/PolicyURIsTrait.php b/src/XML/wsp/PolicyURIsTrait.php index 93b8f85b..9d575b83 100644 --- a/src/XML/wsp/PolicyURIsTrait.php +++ b/src/XML/wsp/PolicyURIsTrait.php @@ -4,29 +4,30 @@ namespace SimpleSAML\WSSecurity\XML\wsp; -use SimpleSAML\WSSecurity\Assert\Assert; +use SimpleSAML\XMLSchema\Type\Helper\AnyURIListValue; /** * Trait grouping common functionality for elements that can hold a PolicyURIs attribute. * * @package simplesamlphp/ws-security + * @phpstan-ignore trait.unused */ trait PolicyURIsTrait { /** * The PolicyURIs. * - * @var string[] + * @var \SimpleSAML\XMLSchema\Type\Helper\AnyURIListValue */ - protected array $PolicyURIs; + protected AnyURIListValue $PolicyURIs; /** * Collect the value of the PolicyURIs-property * - * @return array + * @return \SimpleSAML\XMLSchema\Type\Helper\AnyURIListValue */ - public function getPolicyURIs(): array + public function getPolicyURIs(): AnyURIListValue { return $this->PolicyURIs; } @@ -35,11 +36,10 @@ public function getPolicyURIs(): array /** * Set the value of the PolicyURIs-property * - * @param array $PolicyURIs + * @param \SimpleSAML\XMLSchema\Type\Helper\AnyURIListValue $PolicyURIs */ - protected function setPolicyURIs(array $PolicyURIs): void + protected function setPolicyURIs(AnyURIListValue $PolicyURIs): void { - Assert::allValidURI($PolicyURIs); $this->PolicyURIs = $PolicyURIs; } } diff --git a/src/XML/wsse/AbstractAttributedString.php b/src/XML/wsse/AbstractAttributedString.php index 80505d28..67da032d 100644 --- a/src/XML/wsse/AbstractAttributedString.php +++ b/src/XML/wsse/AbstractAttributedString.php @@ -7,11 +7,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_unshift; @@ -25,35 +27,37 @@ abstract class AbstractAttributedString extends AbstractWsseElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; + /** * AbstractAttributedString constructor * - * @param string $content - * @param string|null $Id + * @param \SimpleSAML\XMLSchema\Type\StringValue $content + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( - string $content, - protected ?string $Id = null, + StringValue $content, + protected ?IDValue $Id = null, array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($Id); - $this->setContent($content); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null */ - public function getId(): ?string + public function getId(): ?IDValue { return $this->Id; } @@ -65,7 +69,7 @@ public function getId(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -78,13 +82,13 @@ public static function fromXML(DOMElement $xml): static $Id = null; foreach ($nsAttributes as $i => $attr) { if ($attr->getNamespaceURI() === C::NS_SEC_UTIL && $attr->getAttrName() === 'Id') { - $Id = $attr->getAttrValue(); + $Id = IDValue::fromString($attr->getAttrValue()->getValue()); unset($nsAttributes[$i]); break; } } - return new static($xml->textContent, $Id, $nsAttributes); + return new static(StringValue::fromString($xml->textContent), $Id, $nsAttributes); } @@ -95,7 +99,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); $attributes = $this->getAttributesNS(); if ($this->getId() !== null) { diff --git a/src/XML/wsse/AbstractBinarySecurityTokenType.php b/src/XML/wsse/AbstractBinarySecurityTokenType.php index 6eb06d01..064e7f16 100644 --- a/src/XML/wsse/AbstractBinarySecurityTokenType.php +++ b/src/XML/wsse/AbstractBinarySecurityTokenType.php @@ -7,9 +7,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the BinarySecurityTokenType element @@ -25,29 +27,28 @@ abstract class AbstractBinarySecurityTokenType extends AbstractEncodedString /** * AbstractBinarySecurityTokenType constructor * - * @param string $content - * @param string|null $valueType - * @param string|null $Id - * @param string|null $EncodingType + * @param \SimpleSAML\XMLSchema\Type\StringValue $content + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $valueType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $EncodingType */ final public function __construct( - string $content, - protected ?string $valueType = null, - ?string $Id = null, - ?string $EncodingType = null, + StringValue $content, + ?IDValue $Id = null, array $namespacedAttributes = [], + protected ?AnyURIValue $valueType = null, + ?AnyURIValue $EncodingType = null, ) { - Assert::nullOrValidURI($valueType, SchemaViolationException::class); - - parent::__construct($content, $Id, $EncodingType, $namespacedAttributes); + Assert::validBase64Binary($content->getValue()); + parent::__construct($content, $Id, $namespacedAttributes, $EncodingType); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getValueType(): ?string + public function getValueType(): ?AnyURIValue { return $this->valueType; } @@ -59,7 +60,7 @@ public function getValueType(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -72,18 +73,18 @@ public static function fromXML(DOMElement $xml): static $Id = null; foreach ($nsAttributes as $i => $attr) { if ($attr->getNamespaceURI() === C::NS_SEC_UTIL && $attr->getAttrName() === 'Id') { - $Id = $attr->getAttrValue(); + $Id = IDValue::fromString($attr->getAttrValue()->getValue()); unset($nsAttributes[$i]); break; } } return new static( - $xml->textContent, - self::getOptionalAttribute($xml, 'ValueType', null), + StringValue::fromString($xml->textContent), $Id, - self::getOptionalAttribute($xml, 'EncodingType', null), $nsAttributes, + self::getOptionalAttribute($xml, 'ValueType', AnyURIValue::class, null), + self::getOptionalAttribute($xml, 'EncodingType', AnyURIValue::class, null), ); } @@ -99,7 +100,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::toXML($parent); if ($this->getValueType() !== null) { - $e->setAttribute('ValueType', $this->getValueType()); + $e->setAttribute('ValueType', $this->getValueType()->getValue()); } return $e; diff --git a/src/XML/wsse/AbstractEmbeddedType.php b/src/XML/wsse/AbstractEmbeddedType.php index 20310363..bfe79ef6 100644 --- a/src/XML/wsse/AbstractEmbeddedType.php +++ b/src/XML/wsse/AbstractEmbeddedType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the EmbeddedType element @@ -22,6 +22,7 @@ abstract class AbstractEmbeddedType extends AbstractWsseElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -32,26 +33,24 @@ abstract class AbstractEmbeddedType extends AbstractWsseElement /** * AbstractEmbeddedType constructor * - * @param string|null $valueType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $valueType * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $valueType = null, + protected ?AnyURIValue $valueType = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($valueType, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getValueType(): ?string + public function getValueType(): ?AnyURIValue { return $this->valueType; } @@ -76,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,7 +84,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'ValueType', null), + self::getOptionalAttribute($xml, 'ValueType', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -103,14 +102,13 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getValueType() !== null) { - $e->setAttribute('ValueType', $this->getValueType()); + $e->setAttribute('ValueType', $this->getValueType()->getValue()); } foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsse/AbstractEncodedString.php b/src/XML/wsse/AbstractEncodedString.php index 85e0fcba..cbc20371 100644 --- a/src/XML/wsse/AbstractEncodedString.php +++ b/src/XML/wsse/AbstractEncodedString.php @@ -7,7 +7,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; /** * Abstract class defining the EncodedString type @@ -21,27 +24,25 @@ abstract class AbstractEncodedString extends AbstractAttributedString /** * AbstractEncodedString constructor * - * @param string $content - * @param string|null $Id - * @param string|null $EncodingType + * @param \SimpleSAML\XMLSchema\Type\StringValue $content + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $EncodingType */ public function __construct( - string $content, - ?string $Id = null, - protected ?string $EncodingType = null, + StringValue $content, + ?IDValue $Id = null, array $namespacedAttributes = [], + protected ?AnyURIValue $EncodingType = null, ) { - Assert::nullOrValidURI($EncodingType); - parent::__construct($content, $Id, $namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getEncodingType(): ?string + public function getEncodingType(): ?AnyURIValue { return $this->EncodingType; } @@ -53,7 +54,7 @@ public function getEncodingType(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -66,17 +67,17 @@ public static function fromXML(DOMElement $xml): static $Id = null; foreach ($nsAttributes as $i => $attr) { if ($attr->getNamespaceURI() === C::NS_SEC_UTIL && $attr->getAttrName() === 'Id') { - $Id = $attr->getAttrValue(); + $Id = IDValue::fromString($attr->getAttrValue()->getValue()); unset($nsAttributes[$i]); break; } } return new static( - $xml->textContent, + StringValue::fromString($xml->textContent), $Id, - self::getOptionalAttribute($xml, 'EncodingType', null), $nsAttributes, + self::getOptionalAttribute($xml, 'EncodingType', AnyURIValue::class, null), ); } @@ -90,7 +91,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::toXML($parent); if ($this->getEncodingType() !== null) { - $e->setAttribute('EncodingType', $this->getEncodingType()); + $e->setAttribute('EncodingType', $this->getEncodingType()->getValue()); } return $e; diff --git a/src/XML/wsse/AbstractKeyIdentifierType.php b/src/XML/wsse/AbstractKeyIdentifierType.php index 55f46b47..f16ccda8 100644 --- a/src/XML/wsse/AbstractKeyIdentifierType.php +++ b/src/XML/wsse/AbstractKeyIdentifierType.php @@ -7,8 +7,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; /** * Class defining the KeyIdentifierType element @@ -20,29 +22,27 @@ abstract class AbstractKeyIdentifierType extends AbstractEncodedString /** * AbstractKeyIdentifierType constructor * - * @param string $content - * @param string|null $valueType - * @param string|null $Id - * @param string|null $EncodingType + * @param \SimpleSAML\XMLSchema\Type\StringValue $content + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $valueType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $EncodingType */ final public function __construct( - string $content, - protected ?string $valueType = null, - ?string $Id = null, - ?string $EncodingType = null, + StringValue $content, + ?IDValue $Id = null, array $namespacedAttributes = [], + protected ?AnyURIValue $valueType = null, + ?AnyURIValue $EncodingType = null, ) { - Assert::nullOrValidURI($valueType, SchemaViolationException::class); - - parent::__construct($content, $Id, $EncodingType, $namespacedAttributes); + parent::__construct($content, $Id, $namespacedAttributes, $EncodingType); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getValueType(): ?string + public function getValueType(): ?AnyURIValue { return $this->valueType; } @@ -54,7 +54,7 @@ public function getValueType(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -67,18 +67,18 @@ public static function fromXML(DOMElement $xml): static $Id = null; foreach ($nsAttributes as $i => $attr) { if ($attr->getNamespaceURI() === C::NS_SEC_UTIL && $attr->getAttrName() === 'Id') { - $Id = $attr->getAttrValue(); + $Id = IDValue::fromString($attr->getAttrValue()->getValue()); unset($nsAttributes[$i]); break; } } return new static( - $xml->textContent, - self::getOptionalAttribute($xml, 'ValueType', null), + StringValue::fromString($xml->textContent), $Id, - self::getOptionalAttribute($xml, 'EncodingType', null), $nsAttributes, + self::getOptionalAttribute($xml, 'ValueType', AnyURIValue::class, null), + self::getOptionalAttribute($xml, 'EncodingType', AnyURIValue::class, null), ); } @@ -94,7 +94,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::toXML($parent); if ($this->getValueType() !== null) { - $e->setAttribute('ValueType', $this->getValueType()); + $e->setAttribute('ValueType', $this->getValueType()->getValue()); } return $e; diff --git a/src/XML/wsse/AbstractPasswordString.php b/src/XML/wsse/AbstractPasswordString.php index 0664ee3d..9feddc71 100644 --- a/src/XML/wsse/AbstractPasswordString.php +++ b/src/XML/wsse/AbstractPasswordString.php @@ -7,7 +7,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; /** * Abstract class defining the PasswordString type @@ -19,28 +22,26 @@ abstract class AbstractPasswordString extends AbstractAttributedString /** * AbstractPasswordString constructor * - * @param string $content - * @param string|null $Id - * @param string|null $Type + * @param \SimpleSAML\XMLSchema\Type\StringValue $content + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Type */ final public function __construct( #[\SensitiveParameter] - string $content, - ?string $Id = null, - protected ?string $Type = null, + StringValue $content, + ?IDValue $Id = null, array $namespacedAttributes = [], + protected ?AnyURIValue $Type = null, ) { - Assert::nullOrValidURI($Type); - parent::__construct($content, $Id, $namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getType(): ?string + public function getType(): ?AnyURIValue { return $this->Type; } @@ -52,7 +53,7 @@ public function getType(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -65,17 +66,17 @@ public static function fromXML(DOMElement $xml): static $Id = null; foreach ($nsAttributes as $i => $attr) { if ($attr->getNamespaceURI() === C::NS_SEC_UTIL && $attr->getAttrName() === 'Id') { - $Id = $attr->getAttrValue(); + $Id = IDValue::fromString($attr->getAttrValue()->getValue()); unset($nsAttributes[$i]); break; } } return new static( - $xml->textContent, + StringValue::fromString($xml->textContent), $Id, - self::getOptionalAttribute($xml, 'Type', null), $nsAttributes, + self::getOptionalAttribute($xml, 'Type', AnyURIValue::class, null), ); } @@ -89,7 +90,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::toXML($parent); if ($this->getType() !== null) { - $e->setAttribute('Type', $this->getType()); + $e->setAttribute('Type', $this->getType()->getValue()); } return $e; diff --git a/src/XML/wsse/AbstractReferenceType.php b/src/XML/wsse/AbstractReferenceType.php index 84887ba5..5e5ab11e 100644 --- a/src/XML/wsse/AbstractReferenceType.php +++ b/src/XML/wsse/AbstractReferenceType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ReferenceType element @@ -20,6 +20,7 @@ abstract class AbstractReferenceType extends AbstractWsseElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -27,35 +28,32 @@ abstract class AbstractReferenceType extends AbstractWsseElement /** * AbstractReferenceType constructor * - * @param string|null $URI - * @param string|null $valueType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $URI + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $valueType * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $URI = null, - protected ?string $valueType = null, + protected ?AnyURIValue $URI = null, + protected ?AnyURIValue $valueType = null, array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($URI, SchemaViolationException::class); - Assert::nullOrValidURI($valueType, SchemaViolationException::class); - $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getValueType(): ?string + public function getValueType(): ?AnyURIValue { return $this->valueType; } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getURI(): ?string + public function getURI(): ?AnyURIValue { return $this->URI; } @@ -67,7 +65,7 @@ public function getURI(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -76,8 +74,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'URI', null), - self::getOptionalAttribute($xml, 'ValueType', null), + self::getOptionalAttribute($xml, 'URI', AnyURIValue::class, null), + self::getOptionalAttribute($xml, 'ValueType', AnyURIValue::class, null), self::getAttributesNSFromXML($xml), ); } @@ -94,11 +92,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getURI() !== null) { - $e->setAttribute('URI', $this->getURI()); + $e->setAttribute('URI', $this->getURI()->getValue()); } if ($this->getValueType() !== null) { - $e->setAttribute('ValueType', $this->getValueType()); + $e->setAttribute('ValueType', $this->getValueType()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wsse/AbstractSecurityHeaderType.php b/src/XML/wsse/AbstractSecurityHeaderType.php index e5e8fc83..15c45d45 100644 --- a/src/XML/wsse/AbstractSecurityHeaderType.php +++ b/src/XML/wsse/AbstractSecurityHeaderType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the SecurityHeaderType element @@ -21,6 +21,7 @@ abstract class AbstractSecurityHeaderType extends AbstractWsseElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; @@ -61,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -90,7 +91,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsse/AbstractSecurityTokenReferenceType.php b/src/XML/wsse/AbstractSecurityTokenReferenceType.php index 971f6eb4..779e375e 100644 --- a/src/XML/wsse/AbstractSecurityTokenReferenceType.php +++ b/src/XML/wsse/AbstractSecurityTokenReferenceType.php @@ -7,11 +7,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_unshift; @@ -26,6 +28,7 @@ abstract class AbstractSecurityTokenReferenceType extends AbstractWsseElement use ExtendableElementTrait; use UsageTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -41,19 +44,17 @@ abstract class AbstractSecurityTokenReferenceType extends AbstractWsseElement /** * AbstractSecurityReferenceType constructor * - * @param string|null $Id - * @param string|null $Usage + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Usage * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $Id = null, - ?string $Usage = null, + protected ?IDValue $Id = null, + ?AnyURIValue $Usage = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($Id); - $this->setUsage($Usage); $this->setElements($children); $this->setAttributesNS($namespacedAttributes); @@ -61,9 +62,9 @@ final public function __construct( /** - * @return string|null + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null */ - public function getId(): ?string + public function getId(): ?IDValue { return $this->Id; } @@ -89,7 +90,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -97,9 +98,19 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); + $Id = null; + if ($xml->hasAttributeNS(C::NS_SEC_UTIL, 'Id')) { + $Id = IDValue::fromString($xml->getAttributeNS(C::NS_SEC_UTIL, 'Id')); + } + + $Usage = null; + if ($xml->hasAttributeNS(C::NS_SEC_EXT, 'Usage')) { + $Usage = AnyURIValue::fromString($xml->getAttributeNS(C::NS_SEC_EXT, 'Usage')); + } + return new static( - $xml->hasAttributeNS(C::NS_SEC_UTIL, 'Id') ? $xml->getAttributeNS(C::NS_SEC_UTIL, 'Id') : null, - $xml->hasAttributeNS(C::NS_SEC_EXT, 'Usage') ? $xml->getAttributeNS(C::NS_SEC_EXT, 'Usage') : null, + $Id, + $Usage, self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -131,7 +142,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsse/AbstractTransformationParametersType.php b/src/XML/wsse/AbstractTransformationParametersType.php index 451455a2..dd15075c 100644 --- a/src/XML/wsse/AbstractTransformationParametersType.php +++ b/src/XML/wsse/AbstractTransformationParametersType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the TransformationParametersType element @@ -21,6 +21,7 @@ abstract class AbstractTransformationParametersType extends AbstractWsseElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -60,7 +61,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -89,7 +90,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $attr->toXML($e); } - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsse/AbstractUsernameTokenType.php b/src/XML/wsse/AbstractUsernameTokenType.php index 1eb48081..a8ae9cbc 100644 --- a/src/XML/wsse/AbstractUsernameTokenType.php +++ b/src/XML/wsse/AbstractUsernameTokenType.php @@ -7,13 +7,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; use function array_unshift; @@ -28,6 +28,7 @@ abstract class AbstractUsernameTokenType extends AbstractWsseElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -49,27 +50,25 @@ abstract class AbstractUsernameTokenType extends AbstractWsseElement * AbstractUsernameTokenType constructor * * @param \SimpleSAML\WSSecurity\XML\wsse\Username $username - * @param string|null $Id + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param \SimpleSAML\XML\SerializableElementInterface[] $children * @param \SimpleSAML\XML\Attribute[] $namespacedAttributes */ final public function __construct( protected Username $username, - protected ?string $Id = null, + protected ?IDValue $Id = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($Id); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null */ - public function getId(): ?string + public function getId(): ?IDValue { return $this->Id; } @@ -90,7 +89,7 @@ public function getUsername(): Username * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -102,9 +101,14 @@ public static function fromXML(DOMElement $xml): static Assert::minCount($username, 1, MissingElementException::class); Assert::maxCount($username, 1, TooManyElementsException::class); + $Id = null; + if ($xml->hasAttributeNS(C::NS_SEC_UTIL, 'Id')) { + $Id = IDValue::fromString($xml->getAttributeNS(C::NS_SEC_UTIL, 'Id')); + } + return new static( array_pop($username), - $xml->hasAttributeNS(C::NS_SEC_UTIL, 'Id') ? $xml->getAttributeNS(C::NS_SEC_UTIL, 'Id') : null, + $Id, self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -123,7 +127,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $attributes = $this->getAttributesNS(); if ($this->getId() !== null) { - $idAttr = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', $this->getId()); + $idAttr = $this->getId()->toAttribute(); array_unshift($attributes, $idAttr); } @@ -133,7 +137,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $this->getUsername()->toXML($e); - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { if (!$child->isEmptyElement()) { $child->toXML($e); diff --git a/src/XML/wsse/BinarySecurityToken.php b/src/XML/wsse/BinarySecurityToken.php index b100f9b8..0f99b32f 100644 --- a/src/XML/wsse/BinarySecurityToken.php +++ b/src/XML/wsse/BinarySecurityToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the BinarySecurityToken element diff --git a/src/XML/wsse/Embedded.php b/src/XML/wsse/Embedded.php index f3e439c0..8343a8f3 100644 --- a/src/XML/wsse/Embedded.php +++ b/src/XML/wsse/Embedded.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Embedded element diff --git a/src/XML/wsse/KeyIdentifier.php b/src/XML/wsse/KeyIdentifier.php index 47f443c7..c735bc9f 100644 --- a/src/XML/wsse/KeyIdentifier.php +++ b/src/XML/wsse/KeyIdentifier.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the KeyIdentifier element diff --git a/src/XML/wsse/Nonce.php b/src/XML/wsse/Nonce.php index c5139790..33d92d49 100644 --- a/src/XML/wsse/Nonce.php +++ b/src/XML/wsse/Nonce.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Nonce element diff --git a/src/XML/wsse/Password.php b/src/XML/wsse/Password.php index 3e2fd6e9..c6bf78f0 100644 --- a/src/XML/wsse/Password.php +++ b/src/XML/wsse/Password.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Password element diff --git a/src/XML/wsse/Reference.php b/src/XML/wsse/Reference.php index b5666db4..6379a043 100644 --- a/src/XML/wsse/Reference.php +++ b/src/XML/wsse/Reference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Reference element diff --git a/src/XML/wsse/Security.php b/src/XML/wsse/Security.php index 7cedb489..15323f30 100644 --- a/src/XML/wsse/Security.php +++ b/src/XML/wsse/Security.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Security element diff --git a/src/XML/wsse/SecurityTokenReference.php b/src/XML/wsse/SecurityTokenReference.php index c474eea1..6e4a63cb 100644 --- a/src/XML/wsse/SecurityTokenReference.php +++ b/src/XML/wsse/SecurityTokenReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the SecurityTokenReference element diff --git a/src/XML/wsse/TransformationParameters.php b/src/XML/wsse/TransformationParameters.php index e5370751..b2a7e0f9 100644 --- a/src/XML/wsse/TransformationParameters.php +++ b/src/XML/wsse/TransformationParameters.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the TransformationParameters element diff --git a/src/XML/wsse/UsageTrait.php b/src/XML/wsse/UsageTrait.php index 0774bada..01a3a86d 100644 --- a/src/XML/wsse/UsageTrait.php +++ b/src/XML/wsse/UsageTrait.php @@ -4,33 +4,31 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * @package simplesamlphp/ws-security */ trait UsageTrait { - /** @var string|null */ - protected ?string $usage; + /** @var \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ + protected ?AnyURIValue $usage; /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getUsage(): ?string + public function getUsage(): ?AnyURIValue { return $this->usage; } /** - * @param string $usage|null + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $usage|null */ - private function setUsage(?string $usage): void + private function setUsage(?AnyURIValue $usage): void { - Assert::nullOrValidURI($usage, SchemaViolationException::class); $this->usage = $usage; } } diff --git a/src/XML/wsse/UsernameToken.php b/src/XML/wsse/UsernameToken.php index f339d9e6..0a08449f 100644 --- a/src/XML/wsse/UsernameToken.php +++ b/src/XML/wsse/UsernameToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsse; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the UsernameToken element diff --git a/src/XML/wst_200502/AbstractAuthenticatorType.php b/src/XML/wst_200502/AbstractAuthenticatorType.php index cd716c9a..bb2c3668 100644 --- a/src/XML/wst_200502/AbstractAuthenticatorType.php +++ b/src/XML/wst_200502/AbstractAuthenticatorType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -21,6 +21,7 @@ abstract class AbstractAuthenticatorType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -66,7 +67,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractBinaryExchangeType.php b/src/XML/wst_200502/AbstractBinaryExchangeType.php index f4edb9ca..a386df36 100644 --- a/src/XML/wst_200502/AbstractBinaryExchangeType.php +++ b/src/XML/wst_200502/AbstractBinaryExchangeType.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A BinaryExchangeType element @@ -20,27 +21,28 @@ abstract class AbstractBinaryExchangeType extends AbstractWstElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; + /** - * @param string $content - * @param string $valueType - * @param string $encodingType + * @param \SimpleSAML\XMLSchema\Type\StringValue $content + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $valueType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $encodingType * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - string $content, - protected string $valueType, - protected string $encodingType, + StringValue $content, + protected AnyURIValue $valueType, + protected AnyURIValue $encodingType, array $namespacedAttributes, ) { - Assert::validURI($valueType, SchemaViolationException::class); - Assert::validURI($encodingType, SchemaViolationException::class); - $this->setContent($content); $this->setAttributesNS($namespacedAttributes); } @@ -49,9 +51,9 @@ final public function __construct( /** * Get the valueType property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getValueType(): string + public function getValueType(): AnyURIValue { return $this->valueType; } @@ -60,9 +62,9 @@ public function getValueType(): string /** * Get the valueType property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getEncodingType(): string + public function getEncodingType(): AnyURIValue { return $this->encodingType; } @@ -74,7 +76,7 @@ public function getEncodingType(): string * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -83,9 +85,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - self::getAttribute($xml, 'ValueType'), - self::getAttribute($xml, 'EncodingType'), + StringValue::fromString($xml->textContent), + self::getAttribute($xml, 'ValueType', AnyURIValue::class), + self::getAttribute($xml, 'EncodingType', AnyURIValue::class), self::getAttributesNSFromXML($xml), ); } @@ -100,10 +102,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); - $e->setAttribute('ValueType', $this->getValueType()); - $e->setAttribute('EncodingType', $this->getEncodingType()); + $e->setAttribute('ValueType', $this->getValueType()->getValue()); + $e->setAttribute('EncodingType', $this->getEncodingType()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wst_200502/AbstractBinarySecretType.php b/src/XML/wst_200502/AbstractBinarySecretType.php index 7c4c2c13..1cc478b8 100644 --- a/src/XML/wst_200502/AbstractBinarySecretType.php +++ b/src/XML/wst_200502/AbstractBinarySecretType.php @@ -6,11 +6,13 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Base64ElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_map; use function explode; @@ -23,23 +25,28 @@ */ abstract class AbstractBinarySecretType extends AbstractWstElement { - use Base64ElementTrait; use ExtendableAttributesTrait; + use TypedTextContentTrait; + /** @var string|\SimpleSAML\XML\XsNamespace */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + /** @var string */ + public const TEXTCONTENT_TYPE = Base64BinaryValue::class; + + /** @var string[]|null */ protected ?array $Type; /** - * @param string $content + * @param \SimpleSAML\XMLSchema\Type\Base64BinaryValue $content * @param (\SimpleSAML\WSSecurity\XML\wst_200502\BinarySecretTypeEnum|string)[]|null $Type * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - string $content, + Base64BinaryValue $content, ?array $Type = null, array $namespacedAttributes = [], ) { @@ -76,7 +83,7 @@ public function getType(): ?array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,8 +92,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - explode(' ', self::getAttribute($xml, 'Type')), + Base64BinaryValue::fromString($xml->textContent), + explode(' ', self::getAttribute($xml, 'Type', StringValue::class)->getValue()), self::getAttributesNSFromXML($xml), ); } @@ -101,7 +108,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); if ($this->getType() !== null) { $e->setAttribute('Type', implode(' ', $this->getType())); diff --git a/src/XML/wst_200502/AbstractCancelTargetType.php b/src/XML/wst_200502/AbstractCancelTargetType.php index bf38a4e8..12cb873e 100644 --- a/src/XML/wst_200502/AbstractCancelTargetType.php +++ b/src/XML/wst_200502/AbstractCancelTargetType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractCancelTargetType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -46,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractClaimsType.php b/src/XML/wst_200502/AbstractClaimsType.php index 8d2c1da8..169768ce 100644 --- a/src/XML/wst_200502/AbstractClaimsType.php +++ b/src/XML/wst_200502/AbstractClaimsType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ClaimsType element @@ -22,6 +22,7 @@ abstract class AbstractClaimsType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -32,26 +33,24 @@ abstract class AbstractClaimsType extends AbstractWstElement /** * AbstractClaimsType constructor * - * @param string|null $dialect + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $dialect * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $dialect = null, + protected ?AnyURIValue $dialect = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($dialect, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getDialect(): ?string + public function getDialect(): ?AnyURIValue { return $this->dialect; } @@ -76,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,7 +84,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Dialect', null), + self::getOptionalAttribute($xml, 'Dialect', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -103,7 +102,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getDialect() !== null) { - $e->setAttribute('Dialect', $this->getDialect()); + $e->setAttribute('Dialect', $this->getDialect()->getValue()); } foreach ($this->getElements() as $child) { diff --git a/src/XML/wst_200502/AbstractComputedKeyOpenEnum.php b/src/XML/wst_200502/AbstractComputedKeyOpenEnum.php index 37ba2933..20691bec 100644 --- a/src/XML/wst_200502/AbstractComputedKeyOpenEnum.php +++ b/src/XML/wst_200502/AbstractComputedKeyOpenEnum.php @@ -4,59 +4,19 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A ComputedKeyOpenEnum element * * @package simplesamlphp/ws-security - * - * @phpstan-consistent-constructor */ abstract class AbstractComputedKeyOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200502\ComputedKeyEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (ComputedKeyEnum|string $v): string { - return ($v instanceof ComputedKeyEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/AbstractDelegateToType.php b/src/XML/wst_200502/AbstractDelegateToType.php index ab8915a5..68fede06 100644 --- a/src/XML/wst_200502/AbstractDelegateToType.php +++ b/src/XML/wst_200502/AbstractDelegateToType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the DelegateToType element @@ -22,6 +22,7 @@ abstract class AbstractDelegateToType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractEncryptionType.php b/src/XML/wst_200502/AbstractEncryptionType.php index 1d45d29a..f2c37191 100644 --- a/src/XML/wst_200502/AbstractEncryptionType.php +++ b/src/XML/wst_200502/AbstractEncryptionType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the EncryptionType element @@ -22,6 +22,7 @@ abstract class AbstractEncryptionType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractEntropyType.php b/src/XML/wst_200502/AbstractEntropyType.php index 5c142cd0..f2d8f5e8 100644 --- a/src/XML/wst_200502/AbstractEntropyType.php +++ b/src/XML/wst_200502/AbstractEntropyType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the EntropyType element @@ -21,6 +21,7 @@ abstract class AbstractEntropyType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -61,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractKeyExchangeTokenType.php b/src/XML/wst_200502/AbstractKeyExchangeTokenType.php index be125e6e..51088735 100644 --- a/src/XML/wst_200502/AbstractKeyExchangeTokenType.php +++ b/src/XML/wst_200502/AbstractKeyExchangeTokenType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the KeyExchangeTokenType element @@ -19,6 +19,7 @@ abstract class AbstractKeyExchangeTokenType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -52,7 +53,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractKeyTypeOpenEnum.php b/src/XML/wst_200502/AbstractKeyTypeOpenEnum.php index 70092454..fa809335 100644 --- a/src/XML/wst_200502/AbstractKeyTypeOpenEnum.php +++ b/src/XML/wst_200502/AbstractKeyTypeOpenEnum.php @@ -4,59 +4,19 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A KeyTypeOpenEnum element * * @package simplesamlphp/ws-security - * - * @phpstan-consistent-constructor */ abstract class AbstractKeyTypeOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200502\KeyTypeEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (KeyTypeEnum|string $v): string { - return ($v instanceof KeyTypeEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/AbstractLifetimeType.php b/src/XML/wst_200502/AbstractLifetimeType.php index b3184ba6..0bbfdf0b 100644 --- a/src/XML/wst_200502/AbstractLifetimeType.php +++ b/src/XML/wst_200502/AbstractLifetimeType.php @@ -8,8 +8,8 @@ use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\wsu\Created; use SimpleSAML\WSSecurity\XML\wsu\Expires; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; /** * Class defining the LifetimeType element @@ -67,7 +67,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractOnBehalfOfType.php b/src/XML/wst_200502/AbstractOnBehalfOfType.php index 93aff7b5..82a6064d 100644 --- a/src/XML/wst_200502/AbstractOnBehalfOfType.php +++ b/src/XML/wst_200502/AbstractOnBehalfOfType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the OnBehalfOfType element @@ -22,6 +22,7 @@ abstract class AbstractOnBehalfOfType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractParticipantType.php b/src/XML/wst_200502/AbstractParticipantType.php index ecfe24e4..0c78fa9b 100644 --- a/src/XML/wst_200502/AbstractParticipantType.php +++ b/src/XML/wst_200502/AbstractParticipantType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ParticipantType element @@ -22,6 +22,7 @@ abstract class AbstractParticipantType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractParticipantsType.php b/src/XML/wst_200502/AbstractParticipantsType.php index ab9da0eb..149e715e 100644 --- a/src/XML/wst_200502/AbstractParticipantsType.php +++ b/src/XML/wst_200502/AbstractParticipantsType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ParticipantsType element @@ -20,6 +20,7 @@ abstract class AbstractParticipantsType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -77,7 +78,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractProofEncryptionType.php b/src/XML/wst_200502/AbstractProofEncryptionType.php index f5c87b4e..7e0223bd 100644 --- a/src/XML/wst_200502/AbstractProofEncryptionType.php +++ b/src/XML/wst_200502/AbstractProofEncryptionType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ProofEncryptionType element @@ -22,6 +22,7 @@ abstract class AbstractProofEncryptionType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractRenewTargetType.php b/src/XML/wst_200502/AbstractRenewTargetType.php index e7d9c42b..d25be8c3 100644 --- a/src/XML/wst_200502/AbstractRenewTargetType.php +++ b/src/XML/wst_200502/AbstractRenewTargetType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractRenewTargetType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -46,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractRenewingType.php b/src/XML/wst_200502/AbstractRenewingType.php index ad238314..178cf199 100644 --- a/src/XML/wst_200502/AbstractRenewingType.php +++ b/src/XML/wst_200502/AbstractRenewingType.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * Class defining the RenewingType element @@ -18,29 +19,29 @@ abstract class AbstractRenewingType extends AbstractWstElement /** * AbstractRenewingType constructor * - * @param bool|null $allow - * @param bool|null $ok + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $allow + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $ok */ final public function __construct( - protected ?bool $allow = null, - protected ?bool $ok = null, + protected ?BooleanValue $allow = null, + protected ?BooleanValue $ok = null, ) { } /** - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getAllow(): ?bool + public function getAllow(): ?BooleanValue { return $this->allow; } /** - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getOk(): ?bool + public function getOk(): ?BooleanValue { return $this->ok; } @@ -64,7 +65,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -73,8 +74,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalBooleanAttribute($xml, 'Allow', null), - self::getOptionalBooleanAttribute($xml, 'OK', null), + self::getOptionalAttribute($xml, 'Allow', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'OK', BooleanValue::class, null), ); } @@ -90,11 +91,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getAllow() !== null) { - $e->setAttribute('Allow', $this->getAllow() ? 'true' : 'false'); + $e->setAttribute('Allow', $this->getAllow()->getValue()); } if ($this->getOk() !== null) { - $e->setAttribute('OK', $this->getOk() ? 'true' : 'false'); + $e->setAttribute('OK', $this->getOk()->getValue()); } return $e; diff --git a/src/XML/wst_200502/AbstractRequestSecurityTokenResponseCollectionType.php b/src/XML/wst_200502/AbstractRequestSecurityTokenResponseCollectionType.php index ebb3a7cd..701f8018 100644 --- a/src/XML/wst_200502/AbstractRequestSecurityTokenResponseCollectionType.php +++ b/src/XML/wst_200502/AbstractRequestSecurityTokenResponseCollectionType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A RequestSecurityTokenResponseCollectionType element @@ -21,6 +21,7 @@ abstract class AbstractRequestSecurityTokenResponseCollectionType extends Abstra { use ExtendableAttributesTrait; + /** @var string|\SimpleSAML\XML\XsNamespace */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -61,7 +62,7 @@ public function getRequestSecurityTokenResponse(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractRequestSecurityTokenResponseType.php b/src/XML/wst_200502/AbstractRequestSecurityTokenResponseType.php index 9c1f5346..41683e9d 100644 --- a/src/XML/wst_200502/AbstractRequestSecurityTokenResponseType.php +++ b/src/XML/wst_200502/AbstractRequestSecurityTokenResponseType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RequestSecurityTokenResponseType element @@ -22,6 +22,7 @@ abstract class AbstractRequestSecurityTokenResponseType extends AbstractWstEleme use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -32,26 +33,24 @@ abstract class AbstractRequestSecurityTokenResponseType extends AbstractWstEleme /** * AbstractRequestSecurityTokenResponseType constructor * - * @param string|null $context + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $context * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $context = null, + protected ?AnyURIValue $context = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($context, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getContext(): ?string + public function getContext(): ?AnyURIValue { return $this->context; } @@ -76,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,7 +84,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Context'), + self::getOptionalAttribute($xml, 'Context', AnyURIValue::class), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -103,7 +102,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getContext() !== null) { - $e->setAttribute('Context', $this->getContext()); + $e->setAttribute('Context', $this->getContext()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wst_200502/AbstractRequestSecurityTokenType.php b/src/XML/wst_200502/AbstractRequestSecurityTokenType.php index 985ce419..d18deb2c 100644 --- a/src/XML/wst_200502/AbstractRequestSecurityTokenType.php +++ b/src/XML/wst_200502/AbstractRequestSecurityTokenType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RequestSecurityTokenType element @@ -24,6 +24,7 @@ abstract class AbstractRequestSecurityTokenType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -34,26 +35,24 @@ abstract class AbstractRequestSecurityTokenType extends AbstractWstElement /** * AbstractRequestSecurityTokenType constructor * - * @param string|null $context + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $context * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $context = null, + protected ?AnyURIValue $context = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($context, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getContext(): ?string + public function getContext(): ?AnyURIValue { return $this->context; } @@ -78,7 +77,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -87,7 +86,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Context'), + self::getOptionalAttribute($xml, 'Context', AnyURIValue::class), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -105,7 +104,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getContext() !== null) { - $e->setAttribute('Context', $this->getContext()); + $e->setAttribute('Context', $this->getContext()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wst_200502/AbstractRequestTypeOpenEnum.php b/src/XML/wst_200502/AbstractRequestTypeOpenEnum.php index a5c5611b..a2a1e4a5 100644 --- a/src/XML/wst_200502/AbstractRequestTypeOpenEnum.php +++ b/src/XML/wst_200502/AbstractRequestTypeOpenEnum.php @@ -4,59 +4,19 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A RequestTypeOpenEnum element * * @package simplesamlphp/ws-security - * - * @phpstan-consistent-constructor */ abstract class AbstractRequestTypeOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200502\RequestTypeEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (RequestTypeEnum|string $v): string { - return ($v instanceof RequestTypeEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/AbstractRequestedProofTokenType.php b/src/XML/wst_200502/AbstractRequestedProofTokenType.php index b9bde6b0..620d27a2 100644 --- a/src/XML/wst_200502/AbstractRequestedProofTokenType.php +++ b/src/XML/wst_200502/AbstractRequestedProofTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RequestedProofTokenType element @@ -22,6 +22,7 @@ abstract class AbstractRequestedProofTokenType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractRequestedReferenceType.php b/src/XML/wst_200502/AbstractRequestedReferenceType.php index ed53bef3..a7dd145f 100644 --- a/src/XML/wst_200502/AbstractRequestedReferenceType.php +++ b/src/XML/wst_200502/AbstractRequestedReferenceType.php @@ -7,9 +7,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\wsse\SecurityTokenReference; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; @@ -48,7 +48,7 @@ public function getSecurityTokenReference(): SecurityTokenReference * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractRequestedSecurityTokenType.php b/src/XML/wst_200502/AbstractRequestedSecurityTokenType.php index 85254e02..20a65e23 100644 --- a/src/XML/wst_200502/AbstractRequestedSecurityTokenType.php +++ b/src/XML/wst_200502/AbstractRequestedSecurityTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractRequestedSecurityTokenType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -46,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractSignChallengeType.php b/src/XML/wst_200502/AbstractSignChallengeType.php index fa24fb44..4be05cf2 100644 --- a/src/XML/wst_200502/AbstractSignChallengeType.php +++ b/src/XML/wst_200502/AbstractSignChallengeType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -23,6 +23,7 @@ abstract class AbstractSignChallengeType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -80,7 +81,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractStatusCodeOpenEnum.php b/src/XML/wst_200502/AbstractStatusCodeOpenEnum.php index d84e5c40..153eadb4 100644 --- a/src/XML/wst_200502/AbstractStatusCodeOpenEnum.php +++ b/src/XML/wst_200502/AbstractStatusCodeOpenEnum.php @@ -4,15 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A StatusCodeOpenEnum element @@ -23,40 +16,9 @@ */ abstract class AbstractStatusCodeOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200502\StatusCodeEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (StatusCodeEnum|string $v): string { - return ($v instanceof StatusCodeEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/AbstractStatusType.php b/src/XML/wst_200502/AbstractStatusType.php index 734494e7..c9a10c2d 100644 --- a/src/XML/wst_200502/AbstractStatusType.php +++ b/src/XML/wst_200502/AbstractStatusType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; /** * Class defining the StatusType element @@ -54,7 +54,7 @@ public function getReason(): ?Reason * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AbstractUseKeyType.php b/src/XML/wst_200502/AbstractUseKeyType.php index 62828b49..35d62595 100644 --- a/src/XML/wst_200502/AbstractUseKeyType.php +++ b/src/XML/wst_200502/AbstractUseKeyType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the UseKeyType element @@ -22,6 +22,7 @@ abstract class AbstractUseKeyType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -30,14 +31,12 @@ abstract class AbstractUseKeyType extends AbstractWstElement * AbstractUseKeyType constructor * * @param \SimpleSAML\XML\SerializableElementInterface|null $child - * @param string|null $Sig + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Sig */ final public function __construct( ?SerializableElementInterface $child = null, - protected ?string $Sig = null, + protected ?AnyURIValue $Sig = null, ) { - Assert::nullOrValidURI($Sig, SchemaViolationException::class); - if ($child !== null) { $this->setElements([$child]); } @@ -45,9 +44,9 @@ final public function __construct( /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getSig(): ?string + public function getSig(): ?AnyURIValue { return $this->Sig; } @@ -71,7 +70,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -84,7 +83,7 @@ public static function fromXML(DOMElement $xml): static return new static( array_pop($children), - self::getOptionalAttribute($xml, 'Sig', null), + self::getOptionalAttribute($xml, 'Sig', AnyURIValue::class, null), ); } @@ -100,7 +99,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getSig() !== null) { - $e->setAttribute('Sig', $this->getSig()); + $e->setAttribute('Sig', $this->getSig()->getValue()); } foreach ($this->getElements() as $child) { diff --git a/src/XML/wst_200502/AllowPostdating.php b/src/XML/wst_200502/AllowPostdating.php index eff18e13..d9a967ce 100644 --- a/src/XML/wst_200502/AllowPostdating.php +++ b/src/XML/wst_200502/AllowPostdating.php @@ -6,8 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * A AllowPostdating element @@ -18,13 +19,14 @@ final class AllowPostdating extends AbstractWstElement implements SchemaValidata { use SchemaValidatableElementTrait; + /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/AuthenticationType.php b/src/XML/wst_200502/AuthenticationType.php index 891a41c7..ce06bed0 100644 --- a/src/XML/wst_200502/AuthenticationType.php +++ b/src/XML/wst_200502/AuthenticationType.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A AuthenticationType element @@ -15,14 +17,9 @@ final class AuthenticationType extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/Authenticator.php b/src/XML/wst_200502/Authenticator.php index b81c906d..3b1eea5f 100644 --- a/src/XML/wst_200502/Authenticator.php +++ b/src/XML/wst_200502/Authenticator.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Authenticator element diff --git a/src/XML/wst_200502/BinaryExchange.php b/src/XML/wst_200502/BinaryExchange.php index 5caa44e4..fb0b5c04 100644 --- a/src/XML/wst_200502/BinaryExchange.php +++ b/src/XML/wst_200502/BinaryExchange.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A BinaryExchange element diff --git a/src/XML/wst_200502/BinarySecret.php b/src/XML/wst_200502/BinarySecret.php index 59a85d34..6ba6fda2 100644 --- a/src/XML/wst_200502/BinarySecret.php +++ b/src/XML/wst_200502/BinarySecret.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A BinarySecret element diff --git a/src/XML/wst_200502/CancelTarget.php b/src/XML/wst_200502/CancelTarget.php index 083dc15e..ecfea63d 100644 --- a/src/XML/wst_200502/CancelTarget.php +++ b/src/XML/wst_200502/CancelTarget.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A CancelTarget element diff --git a/src/XML/wst_200502/CanonicalizationAlgorithm.php b/src/XML/wst_200502/CanonicalizationAlgorithm.php index ab008538..fa6bfd53 100644 --- a/src/XML/wst_200502/CanonicalizationAlgorithm.php +++ b/src/XML/wst_200502/CanonicalizationAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A CanonicalizationAlgorithm element @@ -15,14 +17,9 @@ final class CanonicalizationAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/Challenge.php b/src/XML/wst_200502/Challenge.php index 6ae5d17a..85b85904 100644 --- a/src/XML/wst_200502/Challenge.php +++ b/src/XML/wst_200502/Challenge.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\StringElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; /** * A Challenge element @@ -15,14 +17,9 @@ final class Challenge extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; } diff --git a/src/XML/wst_200502/Claims.php b/src/XML/wst_200502/Claims.php index e7d8ac6e..27253387 100644 --- a/src/XML/wst_200502/Claims.php +++ b/src/XML/wst_200502/Claims.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Claims element diff --git a/src/XML/wst_200502/CombinedHash.php b/src/XML/wst_200502/CombinedHash.php index ca61d5e8..a68fdd20 100644 --- a/src/XML/wst_200502/CombinedHash.php +++ b/src/XML/wst_200502/CombinedHash.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\Base64ElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; /** * A CombinedHash element @@ -14,15 +16,10 @@ */ final class CombinedHash extends AbstractWstElement implements SchemaValidatableElementInterface { - use Base64ElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = Base64BinaryValue::class; } diff --git a/src/XML/wst_200502/ComputedKey.php b/src/XML/wst_200502/ComputedKey.php index dc8172e7..3c54c2e8 100644 --- a/src/XML/wst_200502/ComputedKey.php +++ b/src/XML/wst_200502/ComputedKey.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ComputedKey element diff --git a/src/XML/wst_200502/ComputedKeyAlgorithm.php b/src/XML/wst_200502/ComputedKeyAlgorithm.php index 70284c12..c2904f07 100644 --- a/src/XML/wst_200502/ComputedKeyAlgorithm.php +++ b/src/XML/wst_200502/ComputedKeyAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A ComputedKeyAlgorithm element @@ -15,14 +17,9 @@ final class ComputedKeyAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/Delegatable.php b/src/XML/wst_200502/Delegatable.php index c5fe8de5..6f836c71 100644 --- a/src/XML/wst_200502/Delegatable.php +++ b/src/XML/wst_200502/Delegatable.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\BooleanElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * A Delegatable element @@ -14,15 +16,10 @@ */ final class Delegatable extends AbstractWstElement implements SchemaValidatableElementInterface { - use BooleanElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = BooleanValue::class; } diff --git a/src/XML/wst_200502/DelegateTo.php b/src/XML/wst_200502/DelegateTo.php index 74527186..72d9e3de 100644 --- a/src/XML/wst_200502/DelegateTo.php +++ b/src/XML/wst_200502/DelegateTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A DelegateTo element diff --git a/src/XML/wst_200502/EncryptWith.php b/src/XML/wst_200502/EncryptWith.php index a4aeee17..5e841e3f 100644 --- a/src/XML/wst_200502/EncryptWith.php +++ b/src/XML/wst_200502/EncryptWith.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * An EncryptWith element @@ -15,14 +17,9 @@ final class EncryptWith extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/Encryption.php b/src/XML/wst_200502/Encryption.php index da4c1e08..a578d502 100644 --- a/src/XML/wst_200502/Encryption.php +++ b/src/XML/wst_200502/Encryption.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Encryption element diff --git a/src/XML/wst_200502/EncryptionAlgorithm.php b/src/XML/wst_200502/EncryptionAlgorithm.php index b4bc6f53..5bfee5f2 100644 --- a/src/XML/wst_200502/EncryptionAlgorithm.php +++ b/src/XML/wst_200502/EncryptionAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A EncryptionAlgorithm element @@ -15,14 +17,9 @@ final class EncryptionAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/Entropy.php b/src/XML/wst_200502/Entropy.php index 005e2001..770cadeb 100644 --- a/src/XML/wst_200502/Entropy.php +++ b/src/XML/wst_200502/Entropy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Entropy element diff --git a/src/XML/wst_200502/Forwardable.php b/src/XML/wst_200502/Forwardable.php index 03db3fda..a2a57c04 100644 --- a/src/XML/wst_200502/Forwardable.php +++ b/src/XML/wst_200502/Forwardable.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\BooleanElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * A Forwardable element @@ -14,15 +16,10 @@ */ final class Forwardable extends AbstractWstElement implements SchemaValidatableElementInterface { - use BooleanElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = BooleanValue::class; } diff --git a/src/XML/wst_200502/IssuedTokens.php b/src/XML/wst_200502/IssuedTokens.php index 0d067d8f..45058dea 100644 --- a/src/XML/wst_200502/IssuedTokens.php +++ b/src/XML/wst_200502/IssuedTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A IssuedTokens element diff --git a/src/XML/wst_200502/Issuer.php b/src/XML/wst_200502/Issuer.php index b9bcce98..f8e51fc9 100644 --- a/src/XML/wst_200502/Issuer.php +++ b/src/XML/wst_200502/Issuer.php @@ -6,7 +6,8 @@ use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\AbstractEndpointReferenceType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Issuer element @@ -17,6 +18,7 @@ final class Issuer extends AbstractEndpointReferenceType implements SchemaValida { use SchemaValidatableElementTrait; + /** @var string */ public const NS = C::NS_TRUST_200502; diff --git a/src/XML/wst_200502/KeyExchangeToken.php b/src/XML/wst_200502/KeyExchangeToken.php index f5660c18..ae67d47d 100644 --- a/src/XML/wst_200502/KeyExchangeToken.php +++ b/src/XML/wst_200502/KeyExchangeToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A KeyEchangeToken element diff --git a/src/XML/wst_200502/KeySize.php b/src/XML/wst_200502/KeySize.php index a249711a..7a4de79d 100644 --- a/src/XML/wst_200502/KeySize.php +++ b/src/XML/wst_200502/KeySize.php @@ -4,10 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\IntegerElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\UnsignedIntValue; /** * Class representing WS-trust KeySize. @@ -16,31 +16,10 @@ */ final class KeySize extends AbstractWstElement implements SchemaValidatableElementInterface { - use IntegerElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * KeySize constructor. - * - * @param string $value The long. - */ - final public function __construct(string $value) - { - $this->setContent($value); - } - - /** - * 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 - { - $content = intval($content); - Assert::natural($content, SchemaViolationException::class); - Assert::range($content, 0, 4294967295, SchemaViolationException::class); - } + /** @var string */ + public const TEXTCONTENT_TYPE = UnsignedIntValue::class; } diff --git a/src/XML/wst_200502/KeyType.php b/src/XML/wst_200502/KeyType.php index a9ba6a8c..fc3da47d 100644 --- a/src/XML/wst_200502/KeyType.php +++ b/src/XML/wst_200502/KeyType.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A KeyType element diff --git a/src/XML/wst_200502/Lifetime.php b/src/XML/wst_200502/Lifetime.php index b6fcbeec..da7b79ce 100644 --- a/src/XML/wst_200502/Lifetime.php +++ b/src/XML/wst_200502/Lifetime.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Lifetime element diff --git a/src/XML/wst_200502/OnBehalfOf.php b/src/XML/wst_200502/OnBehalfOf.php index 2145ade1..7d11ea11 100644 --- a/src/XML/wst_200502/OnBehalfOf.php +++ b/src/XML/wst_200502/OnBehalfOf.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A OnBehalfOf element diff --git a/src/XML/wst_200502/Participants.php b/src/XML/wst_200502/Participants.php index 0b7207f6..9a07c02b 100644 --- a/src/XML/wst_200502/Participants.php +++ b/src/XML/wst_200502/Participants.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Participants element diff --git a/src/XML/wst_200502/ProofEncryption.php b/src/XML/wst_200502/ProofEncryption.php index 13835738..e320cd1e 100644 --- a/src/XML/wst_200502/ProofEncryption.php +++ b/src/XML/wst_200502/ProofEncryption.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ProofEncryption element diff --git a/src/XML/wst_200502/Reason.php b/src/XML/wst_200502/Reason.php index 091ab130..364964bc 100644 --- a/src/XML/wst_200502/Reason.php +++ b/src/XML/wst_200502/Reason.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\StringElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; /** * A Reason element @@ -13,14 +14,9 @@ */ final class Reason extends AbstractWstElement { - use StringElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; } diff --git a/src/XML/wst_200502/RenewTarget.php b/src/XML/wst_200502/RenewTarget.php index 5bf16bb4..31b21ad9 100644 --- a/src/XML/wst_200502/RenewTarget.php +++ b/src/XML/wst_200502/RenewTarget.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RenewTarget element diff --git a/src/XML/wst_200502/Renewing.php b/src/XML/wst_200502/Renewing.php index 692591d5..120ddfd8 100644 --- a/src/XML/wst_200502/Renewing.php +++ b/src/XML/wst_200502/Renewing.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Renewing element diff --git a/src/XML/wst_200502/RequestKET.php b/src/XML/wst_200502/RequestKET.php index d5add1a0..124a88b8 100644 --- a/src/XML/wst_200502/RequestKET.php +++ b/src/XML/wst_200502/RequestKET.php @@ -6,8 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * A RequestKET element @@ -18,13 +19,14 @@ final class RequestKET extends AbstractWstElement implements SchemaValidatableEl { use SchemaValidatableElementTrait; + /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/RequestSecurityToken.php b/src/XML/wst_200502/RequestSecurityToken.php index 58a5bdf0..1f4737a0 100644 --- a/src/XML/wst_200502/RequestSecurityToken.php +++ b/src/XML/wst_200502/RequestSecurityToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestSecurityToken element diff --git a/src/XML/wst_200502/RequestSecurityTokenResponse.php b/src/XML/wst_200502/RequestSecurityTokenResponse.php index 1b60d0d3..da3bd8c9 100644 --- a/src/XML/wst_200502/RequestSecurityTokenResponse.php +++ b/src/XML/wst_200502/RequestSecurityTokenResponse.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestSecurityTokenResponse element diff --git a/src/XML/wst_200502/RequestSecurityTokenResponseCollection.php b/src/XML/wst_200502/RequestSecurityTokenResponseCollection.php index f53540a5..94a8905f 100644 --- a/src/XML/wst_200502/RequestSecurityTokenResponseCollection.php +++ b/src/XML/wst_200502/RequestSecurityTokenResponseCollection.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestSecurityTokenResponseCollection element diff --git a/src/XML/wst_200502/RequestType.php b/src/XML/wst_200502/RequestType.php index 35b0ffce..459b812a 100644 --- a/src/XML/wst_200502/RequestType.php +++ b/src/XML/wst_200502/RequestType.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestType element diff --git a/src/XML/wst_200502/RequestedAttachedReference.php b/src/XML/wst_200502/RequestedAttachedReference.php index fedbbb52..37fdfc79 100644 --- a/src/XML/wst_200502/RequestedAttachedReference.php +++ b/src/XML/wst_200502/RequestedAttachedReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedAttachedReference element diff --git a/src/XML/wst_200502/RequestedProofToken.php b/src/XML/wst_200502/RequestedProofToken.php index e120c9e2..cf3389a1 100644 --- a/src/XML/wst_200502/RequestedProofToken.php +++ b/src/XML/wst_200502/RequestedProofToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedProofToken element diff --git a/src/XML/wst_200502/RequestedSecurityToken.php b/src/XML/wst_200502/RequestedSecurityToken.php index 256974bd..a250fe4e 100644 --- a/src/XML/wst_200502/RequestedSecurityToken.php +++ b/src/XML/wst_200502/RequestedSecurityToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedSecurityToken element diff --git a/src/XML/wst_200502/RequestedTokenCancelled.php b/src/XML/wst_200502/RequestedTokenCancelled.php index 356b359c..ad813d45 100644 --- a/src/XML/wst_200502/RequestedTokenCancelled.php +++ b/src/XML/wst_200502/RequestedTokenCancelled.php @@ -6,8 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * A RequestedTokenCancelled element @@ -18,13 +19,14 @@ final class RequestedTokenCancelled extends AbstractWstElement implements Schema { use SchemaValidatableElementTrait; + /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200502/RequestedUnattachedReference.php b/src/XML/wst_200502/RequestedUnattachedReference.php index e0cc2395..87a4f516 100644 --- a/src/XML/wst_200502/RequestedUnattachedReference.php +++ b/src/XML/wst_200502/RequestedUnattachedReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedUnattachedReference element diff --git a/src/XML/wst_200502/SignChallenge.php b/src/XML/wst_200502/SignChallenge.php index 8845336f..a30f2390 100644 --- a/src/XML/wst_200502/SignChallenge.php +++ b/src/XML/wst_200502/SignChallenge.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignChallenge element diff --git a/src/XML/wst_200502/SignChallengeResponse.php b/src/XML/wst_200502/SignChallengeResponse.php index 33325890..482e49ba 100644 --- a/src/XML/wst_200502/SignChallengeResponse.php +++ b/src/XML/wst_200502/SignChallengeResponse.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignChallengeResponse element diff --git a/src/XML/wst_200502/SignWith.php b/src/XML/wst_200502/SignWith.php index 22a167a2..5d2961de 100644 --- a/src/XML/wst_200502/SignWith.php +++ b/src/XML/wst_200502/SignWith.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A SignWith element @@ -15,14 +17,9 @@ final class SignWith extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/SignatureAlgorithm.php b/src/XML/wst_200502/SignatureAlgorithm.php index c3da4b8f..d0f67f16 100644 --- a/src/XML/wst_200502/SignatureAlgorithm.php +++ b/src/XML/wst_200502/SignatureAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A SignatureAlgorithm element @@ -15,14 +17,9 @@ final class SignatureAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/Status.php b/src/XML/wst_200502/Status.php index d44a292a..5f56745a 100644 --- a/src/XML/wst_200502/Status.php +++ b/src/XML/wst_200502/Status.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Status element diff --git a/src/XML/wst_200502/TokenType.php b/src/XML/wst_200502/TokenType.php index 1abc8890..2fe3eccf 100644 --- a/src/XML/wst_200502/TokenType.php +++ b/src/XML/wst_200502/TokenType.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A TokenType element @@ -15,14 +17,9 @@ final class TokenType extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200502/UseKey.php b/src/XML/wst_200502/UseKey.php index 06f68e37..fe91df61 100644 --- a/src/XML/wst_200502/UseKey.php +++ b/src/XML/wst_200502/UseKey.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200502; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A UseKey element diff --git a/src/XML/wst_200512/AbstractAuthenticatorType.php b/src/XML/wst_200512/AbstractAuthenticatorType.php index 3be1ec9a..b31d796d 100644 --- a/src/XML/wst_200512/AbstractAuthenticatorType.php +++ b/src/XML/wst_200512/AbstractAuthenticatorType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -21,6 +21,7 @@ abstract class AbstractAuthenticatorType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -66,7 +67,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractBinaryExchangeType.php b/src/XML/wst_200512/AbstractBinaryExchangeType.php index e9099de1..5ab217c6 100644 --- a/src/XML/wst_200512/AbstractBinaryExchangeType.php +++ b/src/XML/wst_200512/AbstractBinaryExchangeType.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A BinaryExchangeType element @@ -20,27 +21,28 @@ abstract class AbstractBinaryExchangeType extends AbstractWstElement { use ExtendableAttributesTrait; - use StringElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** - * @param string $content - * @param string $valueType - * @param string $encodingType + * @param \SimpleSAML\XMLSchema\Type\StringValue $content + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $valueType + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $encodingType * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - string $content, - protected string $valueType, - protected string $encodingType, + StringValue $content, + protected AnyURIValue $valueType, + protected AnyURIValue $encodingType, array $namespacedAttributes, ) { - Assert::validURI($valueType, SchemaViolationException::class); - Assert::validURI($encodingType, SchemaViolationException::class); - $this->setContent($content); $this->setAttributesNS($namespacedAttributes); } @@ -49,9 +51,9 @@ final public function __construct( /** * Get the valueType property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getValueType(): string + public function getValueType(): AnyURIValue { return $this->valueType; } @@ -60,9 +62,9 @@ public function getValueType(): string /** * Get the valueType property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getEncodingType(): string + public function getEncodingType(): AnyURIValue { return $this->encodingType; } @@ -74,7 +76,7 @@ public function getEncodingType(): string * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -83,9 +85,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - self::getAttribute($xml, 'ValueType'), - self::getAttribute($xml, 'EncodingType'), + StringValue::fromString($xml->textContent), + self::getAttribute($xml, 'ValueType', AnyURIValue::class), + self::getAttribute($xml, 'EncodingType', AnyURIValue::class), self::getAttributesNSFromXML($xml), ); } @@ -100,10 +102,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); - $e->setAttribute('ValueType', $this->getValueType()); - $e->setAttribute('EncodingType', $this->getEncodingType()); + $e->setAttribute('ValueType', $this->getValueType()->getValue()); + $e->setAttribute('EncodingType', $this->getEncodingType()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/wst_200512/AbstractBinarySecretType.php b/src/XML/wst_200512/AbstractBinarySecretType.php index f12f5705..f0905737 100644 --- a/src/XML/wst_200512/AbstractBinarySecretType.php +++ b/src/XML/wst_200512/AbstractBinarySecretType.php @@ -6,15 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Base64ElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A BinarySecertType element @@ -23,37 +20,27 @@ */ abstract class AbstractBinarySecretType extends AbstractWstElement { - use Base64ElementTrait; use ExtendableAttributesTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = Base64BinaryValue::class; /** @var string|\SimpleSAML\XML\XsNamespace */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; - /** @var string[]|null */ - protected ?array $Type; - /** - * @param string $content - * @param (\SimpleSAML\WSSecurity\XML\wst_200512\BinarySecretTypeEnum|string)[]|null $Type + * @param \SimpleSAML\XMLSchema\Type\Base64BinaryValue $content + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Type * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - string $content, - ?array $Type = null, + Base64BinaryValue $content, + protected ?AnyURIValue $Type = null, array $namespacedAttributes = [], ) { - if ($Type !== null) { - $Type = array_map( - function (BinarySecretTypeEnum|string $v): string { - return ($v instanceof BinarySecretTypeEnum) ? $v->value : $v; - }, - $Type, - ); - Assert::allValidURI($Type, SchemaViolationException::class); - $this->Type = $Type; - } - $this->setContent($content); $this->setAttributesNS($namespacedAttributes); } @@ -62,9 +49,9 @@ function (BinarySecretTypeEnum|string $v): string { /** * Get the Type property. * - * @return string[]|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getType(): ?array + public function getType(): ?AnyURIValue { return $this->Type; } @@ -76,7 +63,7 @@ public function getType(): ?array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,8 +72,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - $xml->textContent, - explode(' ', self::getAttribute($xml, 'Type')), + Base64BinaryValue::fromString($xml->textContent), + self::getAttribute($xml, 'Type', AnyURIValue::class), self::getAttributesNSFromXML($xml), ); } @@ -101,10 +88,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); if ($this->getType() !== null) { - $e->setAttribute('Type', implode(' ', $this->getType())); + $e->setAttribute('Type', $this->getType()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wst_200512/AbstractCancelTargetType.php b/src/XML/wst_200512/AbstractCancelTargetType.php index 2f8e7791..9b52f0b3 100644 --- a/src/XML/wst_200512/AbstractCancelTargetType.php +++ b/src/XML/wst_200512/AbstractCancelTargetType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractCancelTargetType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -46,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractClaimsType.php b/src/XML/wst_200512/AbstractClaimsType.php index bc5a0aa2..c60d3167 100644 --- a/src/XML/wst_200512/AbstractClaimsType.php +++ b/src/XML/wst_200512/AbstractClaimsType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ClaimsType element @@ -22,6 +22,7 @@ abstract class AbstractClaimsType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -32,26 +33,24 @@ abstract class AbstractClaimsType extends AbstractWstElement /** * AbstractClaimsType constructor * - * @param string|null $dialect + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $dialect * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $dialect = null, + protected ?AnyURIValue $dialect = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($dialect, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getDialect(): ?string + public function getDialect(): ?AnyURIValue { return $this->dialect; } @@ -76,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,7 +84,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Dialect', null), + self::getOptionalAttribute($xml, 'Dialect', AnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -103,7 +102,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getDialect() !== null) { - $e->setAttribute('Dialect', $this->getDialect()); + $e->setAttribute('Dialect', $this->getDialect()->getValue()); } foreach ($this->getElements() as $child) { diff --git a/src/XML/wst_200512/AbstractComputedKeyOpenEnum.php b/src/XML/wst_200512/AbstractComputedKeyOpenEnum.php index ae1a9264..ee1ab2cf 100644 --- a/src/XML/wst_200512/AbstractComputedKeyOpenEnum.php +++ b/src/XML/wst_200512/AbstractComputedKeyOpenEnum.php @@ -4,15 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A ComputedKeyOpenEnum element @@ -23,40 +16,9 @@ */ abstract class AbstractComputedKeyOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200512\ComputedKeyEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (ComputedKeyEnum|string $v): string { - return ($v instanceof ComputedKeyEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/AbstractDelegateToType.php b/src/XML/wst_200512/AbstractDelegateToType.php index 772f9d64..39c9d0be 100644 --- a/src/XML/wst_200512/AbstractDelegateToType.php +++ b/src/XML/wst_200512/AbstractDelegateToType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the DelegateToType element @@ -22,6 +22,7 @@ abstract class AbstractDelegateToType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractEncryptionType.php b/src/XML/wst_200512/AbstractEncryptionType.php index 5af46dc3..d857a7ce 100644 --- a/src/XML/wst_200512/AbstractEncryptionType.php +++ b/src/XML/wst_200512/AbstractEncryptionType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the EncryptionType element @@ -22,6 +22,7 @@ abstract class AbstractEncryptionType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractEntropyType.php b/src/XML/wst_200512/AbstractEntropyType.php index 5e122104..24ac0ba3 100644 --- a/src/XML/wst_200512/AbstractEntropyType.php +++ b/src/XML/wst_200512/AbstractEntropyType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the EntropyType element @@ -21,6 +21,7 @@ abstract class AbstractEntropyType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -61,7 +62,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractKeyExchangeTokenType.php b/src/XML/wst_200512/AbstractKeyExchangeTokenType.php index 2fb9db49..64cb8f6c 100644 --- a/src/XML/wst_200512/AbstractKeyExchangeTokenType.php +++ b/src/XML/wst_200512/AbstractKeyExchangeTokenType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the KeyExchangeTokenType element @@ -19,6 +19,7 @@ abstract class AbstractKeyExchangeTokenType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -52,7 +53,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractKeyTypeOpenEnum.php b/src/XML/wst_200512/AbstractKeyTypeOpenEnum.php index 508d5f9a..f8e342c6 100644 --- a/src/XML/wst_200512/AbstractKeyTypeOpenEnum.php +++ b/src/XML/wst_200512/AbstractKeyTypeOpenEnum.php @@ -4,15 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A KeyTypeOpenEnum element @@ -23,40 +16,9 @@ */ abstract class AbstractKeyTypeOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200512\KeyTypeEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (KeyTypeEnum|string $v): string { - return ($v instanceof KeyTypeEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/AbstractLifetimeType.php b/src/XML/wst_200512/AbstractLifetimeType.php index 1a876eed..e686ee72 100644 --- a/src/XML/wst_200512/AbstractLifetimeType.php +++ b/src/XML/wst_200512/AbstractLifetimeType.php @@ -8,8 +8,8 @@ use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\wsu\Created; use SimpleSAML\WSSecurity\XML\wsu\Expires; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; /** * Class defining the LifetimeType element @@ -67,7 +67,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractOnBehalfOfType.php b/src/XML/wst_200512/AbstractOnBehalfOfType.php index 2cf4d718..178f7e9b 100644 --- a/src/XML/wst_200512/AbstractOnBehalfOfType.php +++ b/src/XML/wst_200512/AbstractOnBehalfOfType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the OnBehalfOfType element @@ -22,6 +22,7 @@ abstract class AbstractOnBehalfOfType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractParticipantType.php b/src/XML/wst_200512/AbstractParticipantType.php index 606bdb44..079d9450 100644 --- a/src/XML/wst_200512/AbstractParticipantType.php +++ b/src/XML/wst_200512/AbstractParticipantType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ParticipantType element @@ -22,6 +22,7 @@ abstract class AbstractParticipantType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractParticipantsType.php b/src/XML/wst_200512/AbstractParticipantsType.php index d4b28064..506f796c 100644 --- a/src/XML/wst_200512/AbstractParticipantsType.php +++ b/src/XML/wst_200512/AbstractParticipantsType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ParticipantsType element @@ -20,6 +20,7 @@ abstract class AbstractParticipantsType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -77,7 +78,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractProofEncryptionType.php b/src/XML/wst_200512/AbstractProofEncryptionType.php index 376cea73..75fc72b4 100644 --- a/src/XML/wst_200512/AbstractProofEncryptionType.php +++ b/src/XML/wst_200512/AbstractProofEncryptionType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the ProofEncryptionType element @@ -22,6 +22,7 @@ abstract class AbstractProofEncryptionType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractRenewTargetType.php b/src/XML/wst_200512/AbstractRenewTargetType.php index ddcf2fa0..9db10b5b 100644 --- a/src/XML/wst_200512/AbstractRenewTargetType.php +++ b/src/XML/wst_200512/AbstractRenewTargetType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractRenewTargetType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -46,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractRenewingType.php b/src/XML/wst_200512/AbstractRenewingType.php index 0ae2e2ac..295cde15 100644 --- a/src/XML/wst_200512/AbstractRenewingType.php +++ b/src/XML/wst_200512/AbstractRenewingType.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * Class defining the RenewingType element @@ -18,29 +19,29 @@ abstract class AbstractRenewingType extends AbstractWstElement /** * AbstractRenewingType constructor * - * @param bool|null $allow - * @param bool|null $ok + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $allow + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $ok */ final public function __construct( - protected ?bool $allow = null, - protected ?bool $ok = null, + protected ?BooleanValue $allow = null, + protected ?BooleanValue $ok = null, ) { } /** - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getAllow(): ?bool + public function getAllow(): ?BooleanValue { return $this->allow; } /** - * @return bool|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ - public function getOk(): ?bool + public function getOk(): ?BooleanValue { return $this->ok; } @@ -64,7 +65,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -73,8 +74,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalBooleanAttribute($xml, 'Allow', null), - self::getOptionalBooleanAttribute($xml, 'OK', null), + self::getOptionalAttribute($xml, 'Allow', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'OK', BooleanValue::class, null), ); } @@ -90,11 +91,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getAllow() !== null) { - $e->setAttribute('Allow', $this->getAllow() ? 'true' : 'false'); + $e->setAttribute('Allow', $this->getAllow()->getValue()); } if ($this->getOk() !== null) { - $e->setAttribute('OK', $this->getOk() ? 'true' : 'false'); + $e->setAttribute('OK', $this->getOk()->getValue()); } return $e; diff --git a/src/XML/wst_200512/AbstractRequestSecurityTokenCollectionType.php b/src/XML/wst_200512/AbstractRequestSecurityTokenCollectionType.php index ef1a4d9b..bfac0552 100644 --- a/src/XML/wst_200512/AbstractRequestSecurityTokenCollectionType.php +++ b/src/XML/wst_200512/AbstractRequestSecurityTokenCollectionType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * A RequestSecurityTokenCollectionType element @@ -49,7 +49,7 @@ public function getRequestSecurityToken(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractRequestSecurityTokenResponseCollectionType.php b/src/XML/wst_200512/AbstractRequestSecurityTokenResponseCollectionType.php index f6e9e2ed..0f105f3d 100644 --- a/src/XML/wst_200512/AbstractRequestSecurityTokenResponseCollectionType.php +++ b/src/XML/wst_200512/AbstractRequestSecurityTokenResponseCollectionType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * A RequestSecurityTokenResponseCollectionType element @@ -21,7 +21,8 @@ abstract class AbstractRequestSecurityTokenResponseCollectionType extends Abstra { use ExtendableAttributesTrait; - /** @var string|\SimpleSAML\XML\XsNamespace */ + + /** The namespace-attribute for the xs:anyAttribute */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -61,7 +62,7 @@ public function getRequestSecurityTokenResponse(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractRequestSecurityTokenResponseType.php b/src/XML/wst_200512/AbstractRequestSecurityTokenResponseType.php index c896c714..d7487334 100644 --- a/src/XML/wst_200512/AbstractRequestSecurityTokenResponseType.php +++ b/src/XML/wst_200512/AbstractRequestSecurityTokenResponseType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RequestSecurityTokenResponseType element @@ -22,6 +22,7 @@ abstract class AbstractRequestSecurityTokenResponseType extends AbstractWstEleme use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -32,26 +33,24 @@ abstract class AbstractRequestSecurityTokenResponseType extends AbstractWstEleme /** * AbstractRequestSecurityTokenResponseType constructor * - * @param string|null $context + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $context * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $context = null, + protected ?AnyURIValue $context = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($context, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getContext(): ?string + public function getContext(): ?AnyURIValue { return $this->context; } @@ -76,7 +75,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -85,7 +84,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Context'), + self::getOptionalAttribute($xml, 'Context', AnyURIValue::class), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -103,7 +102,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getContext() !== null) { - $e->setAttribute('Context', $this->getContext()); + $e->setAttribute('Context', $this->getContext()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wst_200512/AbstractRequestSecurityTokenType.php b/src/XML/wst_200512/AbstractRequestSecurityTokenType.php index 00f3afcb..57074123 100644 --- a/src/XML/wst_200512/AbstractRequestSecurityTokenType.php +++ b/src/XML/wst_200512/AbstractRequestSecurityTokenType.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RequestSecurityTokenType element @@ -24,6 +24,7 @@ abstract class AbstractRequestSecurityTokenType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -34,26 +35,24 @@ abstract class AbstractRequestSecurityTokenType extends AbstractWstElement /** * AbstractRequestSecurityTokenType constructor * - * @param string|null $context + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $context * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected ?string $context = null, + protected ?AnyURIValue $context = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidURI($context, SchemaViolationException::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getContext(): ?string + public function getContext(): ?AnyURIValue { return $this->context; } @@ -78,7 +77,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -87,7 +86,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Context'), + self::getOptionalAttribute($xml, 'Context', AnyURIValue::class), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -105,7 +104,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getContext() !== null) { - $e->setAttribute('Context', $this->getContext()); + $e->setAttribute('Context', $this->getContext()->getValue()); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/wst_200512/AbstractRequestTypeOpenEnum.php b/src/XML/wst_200512/AbstractRequestTypeOpenEnum.php index 2da55a86..31df61c3 100644 --- a/src/XML/wst_200512/AbstractRequestTypeOpenEnum.php +++ b/src/XML/wst_200512/AbstractRequestTypeOpenEnum.php @@ -4,15 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A RequestTypeOpenEnum element @@ -23,40 +16,9 @@ */ abstract class AbstractRequestTypeOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200512\RequestTypeEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (RequestTypeEnum|string $v): string { - return ($v instanceof RequestTypeEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/AbstractRequestedProofTokenType.php b/src/XML/wst_200512/AbstractRequestedProofTokenType.php index 22e19536..de9a882d 100644 --- a/src/XML/wst_200512/AbstractRequestedProofTokenType.php +++ b/src/XML/wst_200512/AbstractRequestedProofTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the RequestedProofTokenType element @@ -22,6 +22,7 @@ abstract class AbstractRequestedProofTokenType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -44,7 +45,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractRequestedReferenceType.php b/src/XML/wst_200512/AbstractRequestedReferenceType.php index e1c44e7c..9c148cbf 100644 --- a/src/XML/wst_200512/AbstractRequestedReferenceType.php +++ b/src/XML/wst_200512/AbstractRequestedReferenceType.php @@ -7,9 +7,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; use SimpleSAML\WSSecurity\XML\wsse\SecurityTokenReference; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; @@ -48,7 +48,7 @@ public function getSecurityTokenReference(): SecurityTokenReference * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractRequestedSecurityTokenType.php b/src/XML/wst_200512/AbstractRequestedSecurityTokenType.php index 9e3f6432..6b1a8629 100644 --- a/src/XML/wst_200512/AbstractRequestedSecurityTokenType.php +++ b/src/XML/wst_200512/AbstractRequestedSecurityTokenType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractRequestedSecurityTokenType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -46,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractSignChallengeType.php b/src/XML/wst_200512/AbstractSignChallengeType.php index 87a29f2c..59961500 100644 --- a/src/XML/wst_200512/AbstractSignChallengeType.php +++ b/src/XML/wst_200512/AbstractSignChallengeType.php @@ -6,10 +6,10 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -23,6 +23,7 @@ abstract class AbstractSignChallengeType extends AbstractWstElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -80,7 +81,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractStatusCodeOpenEnum.php b/src/XML/wst_200512/AbstractStatusCodeOpenEnum.php index 1c8fad8a..e0b74e84 100644 --- a/src/XML/wst_200512/AbstractStatusCodeOpenEnum.php +++ b/src/XML/wst_200512/AbstractStatusCodeOpenEnum.php @@ -4,59 +4,19 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use DOMElement; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\StringElementTrait; - -use function array_map; -use function explode; -use function implode; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A StatusCodeOpenEnum element * * @package simplesamlphp/ws-security - * - * @phpstan-consistent-constructor */ abstract class AbstractStatusCodeOpenEnum extends AbstractWstElement { - use StringElementTrait; - - - /** - * @param (\SimpleSAML\WSSecurity\XML\wst_200512\StatusCodeEnum|string)[] $values - */ - public function __construct(array $values) - { - $values = array_map( - function (StatusCodeEnum|string $v): string { - return ($v instanceof StatusCodeEnum) ? $v->value : $v; - }, - $values, - ); - Assert::allValidURI($values, SchemaViolationException::class); - - $this->setContent(implode(' ', $values)); - } - + use TypedTextContentTrait; - /** - * Convert XML into a class instance - * - * @param \DOMElement $xml The XML element we should load - * @return static - * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException - * If the qualified name of the supplied element is wrong - */ - public static function fromXML(DOMElement $xml): static - { - Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - return new static(explode(' ', $xml->textContent)); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/AbstractStatusType.php b/src/XML/wst_200512/AbstractStatusType.php index c06f4129..9c2c72b3 100644 --- a/src/XML/wst_200512/AbstractStatusType.php +++ b/src/XML/wst_200512/AbstractStatusType.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; /** * Class defining the StatusType element @@ -54,7 +54,7 @@ public function getReason(): ?Reason * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AbstractUseKeyType.php b/src/XML/wst_200512/AbstractUseKeyType.php index b9f4d83e..d2fc365b 100644 --- a/src/XML/wst_200512/AbstractUseKeyType.php +++ b/src/XML/wst_200512/AbstractUseKeyType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the UseKeyType element @@ -22,6 +22,7 @@ abstract class AbstractUseKeyType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; @@ -30,14 +31,12 @@ abstract class AbstractUseKeyType extends AbstractWstElement * AbstractUseKeyType constructor * * @param \SimpleSAML\XML\SerializableElementInterface|null $child - * @param string|null $Sig + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Sig */ final public function __construct( ?SerializableElementInterface $child = null, - protected ?string $Sig = null, + protected ?AnyURIValue $Sig = null, ) { - Assert::nullOrValidURI($Sig, SchemaViolationException::class); - if ($child !== null) { $this->setElements([$child]); } @@ -45,9 +44,9 @@ final public function __construct( /** - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getSig(): ?string + public function getSig(): ?AnyURIValue { return $this->Sig; } @@ -71,7 +70,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -84,7 +83,7 @@ public static function fromXML(DOMElement $xml): static return new static( array_pop($children), - self::getOptionalAttribute($xml, 'Sig', null), + self::getOptionalAttribute($xml, 'Sig', AnyURIValue::class, null), ); } @@ -100,7 +99,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = parent::instantiateParentElement($parent); if ($this->getSig() !== null) { - $e->setAttribute('Sig', $this->getSig()); + $e->setAttribute('Sig', $this->getSig()->getValue()); } foreach ($this->getElements() as $child) { diff --git a/src/XML/wst_200512/AbstractValidateTargetType.php b/src/XML/wst_200512/AbstractValidateTargetType.php index 119cc7f1..0071e78b 100644 --- a/src/XML/wst_200512/AbstractValidateTargetType.php +++ b/src/XML/wst_200512/AbstractValidateTargetType.php @@ -6,12 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractValidateTargetType extends AbstractWstElement { use ExtendableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -46,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AllowPostdating.php b/src/XML/wst_200512/AllowPostdating.php index 3dae2d39..11726f3d 100644 --- a/src/XML/wst_200512/AllowPostdating.php +++ b/src/XML/wst_200512/AllowPostdating.php @@ -6,8 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * A AllowPostdating element @@ -18,13 +19,14 @@ final class AllowPostdating extends AbstractWstElement implements SchemaValidata { use SchemaValidatableElementTrait; + /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/AuthenticationType.php b/src/XML/wst_200512/AuthenticationType.php index d362f2e7..c58c43c2 100644 --- a/src/XML/wst_200512/AuthenticationType.php +++ b/src/XML/wst_200512/AuthenticationType.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A AuthenticationType element @@ -15,14 +17,9 @@ final class AuthenticationType extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/Authenticator.php b/src/XML/wst_200512/Authenticator.php index 9e3e95ef..1bac186e 100644 --- a/src/XML/wst_200512/Authenticator.php +++ b/src/XML/wst_200512/Authenticator.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Authenticator element diff --git a/src/XML/wst_200512/BinaryExchange.php b/src/XML/wst_200512/BinaryExchange.php index 52058c98..e2f34cd5 100644 --- a/src/XML/wst_200512/BinaryExchange.php +++ b/src/XML/wst_200512/BinaryExchange.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A BinaryExchange element diff --git a/src/XML/wst_200512/BinarySecret.php b/src/XML/wst_200512/BinarySecret.php index b97b9d01..5dda60ca 100644 --- a/src/XML/wst_200512/BinarySecret.php +++ b/src/XML/wst_200512/BinarySecret.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A BinarySecret element diff --git a/src/XML/wst_200512/CancelTarget.php b/src/XML/wst_200512/CancelTarget.php index 5ed46f1b..a26a61f9 100644 --- a/src/XML/wst_200512/CancelTarget.php +++ b/src/XML/wst_200512/CancelTarget.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A CancelTarget element diff --git a/src/XML/wst_200512/CanonicalizationAlgorithm.php b/src/XML/wst_200512/CanonicalizationAlgorithm.php index 5149c359..4496986b 100644 --- a/src/XML/wst_200512/CanonicalizationAlgorithm.php +++ b/src/XML/wst_200512/CanonicalizationAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A CanonicalizationAlgorithm element @@ -15,14 +17,9 @@ final class CanonicalizationAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/Challenge.php b/src/XML/wst_200512/Challenge.php index 06682a4e..28dc56c1 100644 --- a/src/XML/wst_200512/Challenge.php +++ b/src/XML/wst_200512/Challenge.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\StringElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; /** * A Challenge element @@ -15,14 +17,9 @@ final class Challenge extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; } diff --git a/src/XML/wst_200512/Claims.php b/src/XML/wst_200512/Claims.php index 3d1cb14b..410b4e3f 100644 --- a/src/XML/wst_200512/Claims.php +++ b/src/XML/wst_200512/Claims.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Claims element diff --git a/src/XML/wst_200512/CombinedHash.php b/src/XML/wst_200512/CombinedHash.php index 3e8f7617..a2fcd2e8 100644 --- a/src/XML/wst_200512/CombinedHash.php +++ b/src/XML/wst_200512/CombinedHash.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\Base64ElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; /** * A CombinedHash element @@ -14,15 +16,10 @@ */ final class CombinedHash extends AbstractWstElement implements SchemaValidatableElementInterface { - use Base64ElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = Base64BinaryValue::class; } diff --git a/src/XML/wst_200512/ComputedKey.php b/src/XML/wst_200512/ComputedKey.php index 26b22a20..b7a76a19 100644 --- a/src/XML/wst_200512/ComputedKey.php +++ b/src/XML/wst_200512/ComputedKey.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ComputedKey element diff --git a/src/XML/wst_200512/ComputedKeyAlgorithm.php b/src/XML/wst_200512/ComputedKeyAlgorithm.php index 492ce6a4..680d59f3 100644 --- a/src/XML/wst_200512/ComputedKeyAlgorithm.php +++ b/src/XML/wst_200512/ComputedKeyAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A ComputedKeyAlgorithm element @@ -15,14 +17,9 @@ final class ComputedKeyAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/Delegatable.php b/src/XML/wst_200512/Delegatable.php index 789f0f1b..3146abf9 100644 --- a/src/XML/wst_200512/Delegatable.php +++ b/src/XML/wst_200512/Delegatable.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\BooleanElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * A Delegatable element @@ -14,15 +16,10 @@ */ final class Delegatable extends AbstractWstElement implements SchemaValidatableElementInterface { - use BooleanElementTrait; + use TypedTextContentTrait; use SchemaValidatableElementTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = BooleanValue::class; } diff --git a/src/XML/wst_200512/DelegateTo.php b/src/XML/wst_200512/DelegateTo.php index 39ff0126..46f5b095 100644 --- a/src/XML/wst_200512/DelegateTo.php +++ b/src/XML/wst_200512/DelegateTo.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A DelegateTo element diff --git a/src/XML/wst_200512/EncryptWith.php b/src/XML/wst_200512/EncryptWith.php index 089d463c..d6efb1ce 100644 --- a/src/XML/wst_200512/EncryptWith.php +++ b/src/XML/wst_200512/EncryptWith.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * An EncryptWith element @@ -15,14 +17,9 @@ final class EncryptWith extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/Encryption.php b/src/XML/wst_200512/Encryption.php index 2636a465..f1beb26b 100644 --- a/src/XML/wst_200512/Encryption.php +++ b/src/XML/wst_200512/Encryption.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Encryption element diff --git a/src/XML/wst_200512/EncryptionAlgorithm.php b/src/XML/wst_200512/EncryptionAlgorithm.php index f5cc646a..5403cb5e 100644 --- a/src/XML/wst_200512/EncryptionAlgorithm.php +++ b/src/XML/wst_200512/EncryptionAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A EncryptionAlgorithm element @@ -15,14 +17,9 @@ final class EncryptionAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/Entropy.php b/src/XML/wst_200512/Entropy.php index 95e157e6..0f0cec6a 100644 --- a/src/XML/wst_200512/Entropy.php +++ b/src/XML/wst_200512/Entropy.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Entropy element diff --git a/src/XML/wst_200512/Forwardable.php b/src/XML/wst_200512/Forwardable.php index 30fa2e63..633c3195 100644 --- a/src/XML/wst_200512/Forwardable.php +++ b/src/XML/wst_200512/Forwardable.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\BooleanElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * A Forwardable element @@ -14,15 +16,10 @@ */ final class Forwardable extends AbstractWstElement implements SchemaValidatableElementInterface { - use BooleanElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = BooleanValue::class; } diff --git a/src/XML/wst_200512/IssuedTokens.php b/src/XML/wst_200512/IssuedTokens.php index be0b8404..e15d6fe2 100644 --- a/src/XML/wst_200512/IssuedTokens.php +++ b/src/XML/wst_200512/IssuedTokens.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A IssuedTokens element diff --git a/src/XML/wst_200512/Issuer.php b/src/XML/wst_200512/Issuer.php index c9770354..c1025aad 100644 --- a/src/XML/wst_200512/Issuer.php +++ b/src/XML/wst_200512/Issuer.php @@ -6,7 +6,8 @@ use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\AbstractEndpointReferenceType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An Issuer element @@ -17,6 +18,7 @@ final class Issuer extends AbstractEndpointReferenceType implements SchemaValida { use SchemaValidatableElementTrait; + /** @var string */ public const NS = C::NS_TRUST_200512; diff --git a/src/XML/wst_200512/KeyExchangeToken.php b/src/XML/wst_200512/KeyExchangeToken.php index 5ba195a5..fe69e5d5 100644 --- a/src/XML/wst_200512/KeyExchangeToken.php +++ b/src/XML/wst_200512/KeyExchangeToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A KeyEchangeToken element diff --git a/src/XML/wst_200512/KeySize.php b/src/XML/wst_200512/KeySize.php index d2b4a7ad..eb3b31bc 100644 --- a/src/XML/wst_200512/KeySize.php +++ b/src/XML/wst_200512/KeySize.php @@ -4,10 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\IntegerElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\UnsignedIntValue; /** * Class representing WS-trust KeySize. @@ -16,32 +16,10 @@ */ final class KeySize extends AbstractWstElement implements SchemaValidatableElementInterface { - use IntegerElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * KeySize constructor. - * - * @param string $value The long. - */ - final public function __construct(string $value) - { - $this->setContent($value); - } - - - /** - * 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 - { - $content = intval($content); - Assert::natural($content, SchemaViolationException::class); - Assert::range($content, 0, 4294967295, SchemaViolationException::class); - } + /** @var string */ + public const TEXTCONTENT_TYPE = UnsignedIntValue::class; } diff --git a/src/XML/wst_200512/KeyType.php b/src/XML/wst_200512/KeyType.php index 3e6c5364..f1723393 100644 --- a/src/XML/wst_200512/KeyType.php +++ b/src/XML/wst_200512/KeyType.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A KeyType element diff --git a/src/XML/wst_200512/KeyWrapAlgorithm.php b/src/XML/wst_200512/KeyWrapAlgorithm.php index 22d3bb02..f63e8c76 100644 --- a/src/XML/wst_200512/KeyWrapAlgorithm.php +++ b/src/XML/wst_200512/KeyWrapAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A KeyWrapAlgorithm element @@ -15,14 +17,9 @@ final class KeyWrapAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/Lifetime.php b/src/XML/wst_200512/Lifetime.php index 0f1d38b7..d149ba31 100644 --- a/src/XML/wst_200512/Lifetime.php +++ b/src/XML/wst_200512/Lifetime.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Lifetime element diff --git a/src/XML/wst_200512/OnBehalfOf.php b/src/XML/wst_200512/OnBehalfOf.php index ad435c68..a89296de 100644 --- a/src/XML/wst_200512/OnBehalfOf.php +++ b/src/XML/wst_200512/OnBehalfOf.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A OnBehalfOf element diff --git a/src/XML/wst_200512/Participants.php b/src/XML/wst_200512/Participants.php index 345ae72e..f54148b3 100644 --- a/src/XML/wst_200512/Participants.php +++ b/src/XML/wst_200512/Participants.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Participants element diff --git a/src/XML/wst_200512/ProofEncryption.php b/src/XML/wst_200512/ProofEncryption.php index 4313d424..91f491a5 100644 --- a/src/XML/wst_200512/ProofEncryption.php +++ b/src/XML/wst_200512/ProofEncryption.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ProofEncryption element diff --git a/src/XML/wst_200512/Reason.php b/src/XML/wst_200512/Reason.php index 12922185..28c07273 100644 --- a/src/XML/wst_200512/Reason.php +++ b/src/XML/wst_200512/Reason.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\StringElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\StringValue; /** * A Reason element @@ -13,14 +14,9 @@ */ final class Reason extends AbstractWstElement { - use StringElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = StringValue::class; } diff --git a/src/XML/wst_200512/RenewTarget.php b/src/XML/wst_200512/RenewTarget.php index 4c217820..2938b786 100644 --- a/src/XML/wst_200512/RenewTarget.php +++ b/src/XML/wst_200512/RenewTarget.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RenewTarget element diff --git a/src/XML/wst_200512/Renewing.php b/src/XML/wst_200512/Renewing.php index 2a76a61e..6c5e67a0 100644 --- a/src/XML/wst_200512/Renewing.php +++ b/src/XML/wst_200512/Renewing.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Renewing element diff --git a/src/XML/wst_200512/RequestKET.php b/src/XML/wst_200512/RequestKET.php index ae46c4c2..ed452ea0 100644 --- a/src/XML/wst_200512/RequestKET.php +++ b/src/XML/wst_200512/RequestKET.php @@ -6,8 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * A RequestKET element @@ -18,13 +19,14 @@ final class RequestKET extends AbstractWstElement implements SchemaValidatableEl { use SchemaValidatableElementTrait; + /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/RequestSecurityToken.php b/src/XML/wst_200512/RequestSecurityToken.php index 87ea8ef7..a480a22b 100644 --- a/src/XML/wst_200512/RequestSecurityToken.php +++ b/src/XML/wst_200512/RequestSecurityToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestSecurityToken element diff --git a/src/XML/wst_200512/RequestSecurityTokenCollection.php b/src/XML/wst_200512/RequestSecurityTokenCollection.php index fbe43e20..42b4b92d 100644 --- a/src/XML/wst_200512/RequestSecurityTokenCollection.php +++ b/src/XML/wst_200512/RequestSecurityTokenCollection.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestSecurityTokenCollection element diff --git a/src/XML/wst_200512/RequestSecurityTokenResponse.php b/src/XML/wst_200512/RequestSecurityTokenResponse.php index e9f5e82f..eaa2252b 100644 --- a/src/XML/wst_200512/RequestSecurityTokenResponse.php +++ b/src/XML/wst_200512/RequestSecurityTokenResponse.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestSecurityTokenResponse element diff --git a/src/XML/wst_200512/RequestSecurityTokenResponseCollection.php b/src/XML/wst_200512/RequestSecurityTokenResponseCollection.php index 50d617ff..0ca4756d 100644 --- a/src/XML/wst_200512/RequestSecurityTokenResponseCollection.php +++ b/src/XML/wst_200512/RequestSecurityTokenResponseCollection.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestSecurityTokenResponseCollection element diff --git a/src/XML/wst_200512/RequestType.php b/src/XML/wst_200512/RequestType.php index 6923fd0d..c37bb888 100644 --- a/src/XML/wst_200512/RequestType.php +++ b/src/XML/wst_200512/RequestType.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestType element diff --git a/src/XML/wst_200512/RequestedAttachedReference.php b/src/XML/wst_200512/RequestedAttachedReference.php index f2fabafe..b35cb2a6 100644 --- a/src/XML/wst_200512/RequestedAttachedReference.php +++ b/src/XML/wst_200512/RequestedAttachedReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedAttachedReference element diff --git a/src/XML/wst_200512/RequestedProofToken.php b/src/XML/wst_200512/RequestedProofToken.php index 8beed89a..6ddcf8a9 100644 --- a/src/XML/wst_200512/RequestedProofToken.php +++ b/src/XML/wst_200512/RequestedProofToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedProofToken element diff --git a/src/XML/wst_200512/RequestedSecurityToken.php b/src/XML/wst_200512/RequestedSecurityToken.php index 7ad4ff47..83ec8209 100644 --- a/src/XML/wst_200512/RequestedSecurityToken.php +++ b/src/XML/wst_200512/RequestedSecurityToken.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedSecurityToken element diff --git a/src/XML/wst_200512/RequestedTokenCancelled.php b/src/XML/wst_200512/RequestedTokenCancelled.php index a3b15d48..1ea2c4dd 100644 --- a/src/XML/wst_200512/RequestedTokenCancelled.php +++ b/src/XML/wst_200512/RequestedTokenCancelled.php @@ -6,8 +6,9 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * A RequestedTokenCancelled element @@ -18,13 +19,14 @@ final class RequestedTokenCancelled extends AbstractWstElement implements Schema { use SchemaValidatableElementTrait; + /** * Convert XML into a class instance * * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wst_200512/RequestedUnattachedReference.php b/src/XML/wst_200512/RequestedUnattachedReference.php index 4cd0bdc2..0fbc0fc8 100644 --- a/src/XML/wst_200512/RequestedUnattachedReference.php +++ b/src/XML/wst_200512/RequestedUnattachedReference.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A RequestedUnattachedReference element diff --git a/src/XML/wst_200512/SignChallenge.php b/src/XML/wst_200512/SignChallenge.php index 6b61b67e..aa80dcd9 100644 --- a/src/XML/wst_200512/SignChallenge.php +++ b/src/XML/wst_200512/SignChallenge.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignChallenge element diff --git a/src/XML/wst_200512/SignChallengeResponse.php b/src/XML/wst_200512/SignChallengeResponse.php index 2310758d..7723e28b 100644 --- a/src/XML/wst_200512/SignChallengeResponse.php +++ b/src/XML/wst_200512/SignChallengeResponse.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * An SignChallengeResponse element diff --git a/src/XML/wst_200512/SignWith.php b/src/XML/wst_200512/SignWith.php index 77a71614..09ecb76e 100644 --- a/src/XML/wst_200512/SignWith.php +++ b/src/XML/wst_200512/SignWith.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A SignWith element @@ -15,14 +17,9 @@ final class SignWith extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/SignatureAlgorithm.php b/src/XML/wst_200512/SignatureAlgorithm.php index 647476c6..4dd3dad6 100644 --- a/src/XML/wst_200512/SignatureAlgorithm.php +++ b/src/XML/wst_200512/SignatureAlgorithm.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A SignatureAlgorithm element @@ -15,14 +17,9 @@ final class SignatureAlgorithm extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/Status.php b/src/XML/wst_200512/Status.php index 165d54ea..4fd2bb8b 100644 --- a/src/XML/wst_200512/Status.php +++ b/src/XML/wst_200512/Status.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A Status element diff --git a/src/XML/wst_200512/TokenType.php b/src/XML/wst_200512/TokenType.php index 0ed5b5cc..221fb914 100644 --- a/src/XML/wst_200512/TokenType.php +++ b/src/XML/wst_200512/TokenType.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * A TokenType element @@ -15,14 +17,9 @@ final class TokenType extends AbstractWstElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wst_200512/UseKey.php b/src/XML/wst_200512/UseKey.php index fdd36bc8..0aadbddc 100644 --- a/src/XML/wst_200512/UseKey.php +++ b/src/XML/wst_200512/UseKey.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A UseKey element diff --git a/src/XML/wst_200512/ValidateTarget.php b/src/XML/wst_200512/ValidateTarget.php index 10037d76..ae8bf58f 100644 --- a/src/XML/wst_200512/ValidateTarget.php +++ b/src/XML/wst_200512/ValidateTarget.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wst_200512; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A ValidateTarget element diff --git a/src/XML/wsu/AbstractAttributedDateTime.php b/src/XML/wsu/AbstractAttributedDateTime.php index 0f3efc29..16a07f0f 100644 --- a/src/XML/wsu/AbstractAttributedDateTime.php +++ b/src/XML/wsu/AbstractAttributedDateTime.php @@ -4,15 +4,13 @@ namespace SimpleSAML\WSSecurity\XML\wsu; -use DateTimeImmutable; use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\WSSecurity\Constants as C; -use SimpleSAML\WSSecurity\Exception\ProtocolViolationException; -use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Abstract class defining the AttributedDateTime type @@ -23,6 +21,7 @@ abstract class AbstractAttributedDateTime extends AbstractWsuElement { use ExtendableAttributesTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -30,24 +29,23 @@ abstract class AbstractAttributedDateTime extends AbstractWsuElement /** * AbstractAttributedDateTime constructor * - * @param \DateTimeImmutable $dateTime - * @param string|null $Id + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue $dateTime + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - protected DateTimeImmutable $dateTime, - protected ?string $Id = null, + protected DateTimeValue $dateTime, + protected ?IDValue $Id = null, array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($Id); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null */ - public function getId(): ?string + public function getId(): ?IDValue { return $this->Id; } @@ -56,9 +54,9 @@ public function getId(): ?string /** * Collect the value of the dateTime property * - * @return \DateTimeImmutable + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue */ - public function getDateTime(): DateTimeImmutable + public function getDateTime(): DateTimeValue { return $this->dateTime; } @@ -70,7 +68,7 @@ public function getDateTime(): DateTimeImmutable * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -78,17 +76,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - // Time values MUST be expressed in the UTC timezone using the 'Z' timezone identifier - // Strip sub-seconds - $xml->textContent = preg_replace('/([.][0-9]+)/', '', $xml->textContent, 1); - Assert::validDateTime($xml->textContent, ProtocolViolationException::class); - $Id = null; if ($xml->hasAttributeNS(static::NS, 'Id')) { - $Id = $xml->getAttributeNS(static::NS, 'Id'); + $Id = IDValue::fromString($xml->getAttributeNS(static::NS, 'Id')); } - return new static(new DateTimeImmutable($xml->textContent), $Id, self::getAttributesNSFromXML($xml)); + return new static(DateTimeValue::fromString($xml->textContent), $Id, self::getAttributesNSFromXML($xml)); } @@ -99,11 +92,11 @@ public static function fromXML(DOMElement $xml): static final public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getDateTime()->format(C::DATETIME_FORMAT); + $e->textContent = $this->getDateTime()->getValue(); $attributes = $this->getAttributesNS(); if ($this->getId() !== null) { - $attributes[] = new XMLAttribute(static::NS, 'wsu', 'Id', $this->getId()); + $this->getId()->toAttribute()->toXML($e); } foreach ($attributes as $attr) { diff --git a/src/XML/wsu/AbstractAttributedURI.php b/src/XML/wsu/AbstractAttributedURI.php index de47428d..a5819923 100644 --- a/src/XML/wsu/AbstractAttributedURI.php +++ b/src/XML/wsu/AbstractAttributedURI.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\URIElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Abstract class defining the AttributedURI type @@ -20,7 +21,11 @@ abstract class AbstractAttributedURI extends AbstractWsuElement { use ExtendableAttributesTrait; - use URIElementTrait; + use TypedTextContentTrait; + + + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -29,13 +34,13 @@ abstract class AbstractAttributedURI extends AbstractWsuElement /** * AbstractAttributedURI constructor * - * @param string $uri - * @param string|null $Id + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $uri + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final protected function __construct( - string $uri, - protected ?string $Id = null, + AnyURIValue $uri, + protected ?IDValue $Id = null, array $namespacedAttributes = [], ) { Assert::nullOrValidNCName($Id); @@ -46,9 +51,9 @@ final protected function __construct( /** - * @return string|null + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null */ - public function getId(): ?string + public function getId(): ?IDValue { return $this->Id; } @@ -60,7 +65,7 @@ public function getId(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -70,10 +75,10 @@ public static function fromXML(DOMElement $xml): static $Id = null; if ($xml->hasAttributeNS(static::NS, 'Id')) { - $Id = $xml->getAttributeNS(static::NS, 'Id'); + $Id = IDValue::fromString($xml->getAttributeNS(static::NS, 'Id')); } - return new static($xml->textContent, $Id, self::getAttributesNSFromXML($xml)); + return new static(AnyURIValue::fromString($xml->textContent), $Id, self::getAttributesNSFromXML($xml)); } @@ -84,11 +89,11 @@ public static function fromXML(DOMElement $xml): static final public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); $attributes = $this->getAttributesNS(); if ($this->getId() !== null) { - $attributes[] = new XMLAttribute(static::NS, 'wsu', 'Id', $this->getId()); + $this->getId()->toAttribute()->toXML($e); } foreach ($attributes as $attr) { diff --git a/src/XML/wsu/AbstractTimestamp.php b/src/XML/wsu/AbstractTimestamp.php index 37aeefb8..09d23039 100644 --- a/src/XML/wsu/AbstractTimestamp.php +++ b/src/XML/wsu/AbstractTimestamp.php @@ -6,11 +6,11 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +24,7 @@ abstract class AbstractTimestamp extends AbstractWsuElement use ExtendableAttributesTrait; use ExtendableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -42,28 +43,26 @@ abstract class AbstractTimestamp extends AbstractWsuElement * * @param \SimpleSAML\WSSecurity\XML\wsu\Created|null $created * @param \SimpleSAML\WSSecurity\XML\wsu\Expires|null $expires - * @param string|null $Id + * @param \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null $Id * @param array<\SimpleSAML\XML\SerializableElementInterface> $elements * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected ?Created $created = null, protected ?Expires $expires = null, - protected ?string $Id = null, + protected ?IDValue $Id = null, array $elements = [], array $namespacedAttributes = [], ) { - Assert::nullOrValidNCName($Id); - $this->setElements($elements); $this->setAttributesNS($namespacedAttributes); } /** - * @return string|null + * @return \SimpleSAML\WSSecurity\XML\wsu\Type\IDValue|null */ - public function getId(): ?string + public function getId(): ?IDValue { return $this->Id; } @@ -108,7 +107,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -122,7 +121,7 @@ public static function fromXML(DOMElement $xml): static $Id = null; if ($xml->hasAttributeNS(static::NS, 'Id')) { - $Id = $xml->getAttributeNS(static::NS, 'Id'); + $Id = IDValue::fromString($xml->getAttributeNS(static::NS, 'Id')); } return new static( @@ -147,7 +146,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $attributes = $this->getAttributesNS(); if ($this->getId() !== null) { - $attributes[] = new XMLAttribute(static::NS, 'wsu', 'Id', $this->getId()); + $this->getId()->toAttribute()->toXML($e); } foreach ($attributes as $attr) { @@ -158,7 +157,6 @@ public function toXML(?DOMElement $parent = null): DOMElement $this->getExpires()?->toXML($e); foreach ($this->getElements() as $detail) { - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $detail */ $detail->toXML($e); } diff --git a/src/XML/wsu/Created.php b/src/XML/wsu/Created.php index 2d30ad97..69d99b38 100644 --- a/src/XML/wsu/Created.php +++ b/src/XML/wsu/Created.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsu; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Created element diff --git a/src/XML/wsu/Expires.php b/src/XML/wsu/Expires.php index 0eaec2fa..5d4fa8b0 100644 --- a/src/XML/wsu/Expires.php +++ b/src/XML/wsu/Expires.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsu; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Expires element diff --git a/src/XML/wsu/Timestamp.php b/src/XML/wsu/Timestamp.php index 9999b231..15054b35 100644 --- a/src/XML/wsu/Timestamp.php +++ b/src/XML/wsu/Timestamp.php @@ -4,7 +4,8 @@ namespace SimpleSAML\WSSecurity\XML\wsu; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class defining the Timestamp element diff --git a/src/XML/wsu/Type/DateTimeValue.php b/src/XML/wsu/Type/DateTimeValue.php new file mode 100644 index 00000000..eeae968b --- /dev/null +++ b/src/XML/wsu/Type/DateTimeValue.php @@ -0,0 +1,34 @@ +sanitizeValue($value), ProtocolViolationException::class); + } +} diff --git a/src/XML/wsu/Type/IDValue.php b/src/XML/wsu/Type/IDValue.php new file mode 100644 index 00000000..009ed9cc --- /dev/null +++ b/src/XML/wsu/Type/IDValue.php @@ -0,0 +1,26 @@ +setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wsx/GetMetadata.php b/src/XML/wsx/GetMetadata.php index 4b231a3f..b9846f28 100644 --- a/src/XML/wsx/GetMetadata.php +++ b/src/XML/wsx/GetMetadata.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_pop; @@ -24,6 +25,7 @@ final class GetMetadata extends AbstractWsxElement implements SchemaValidatableE use ExtendableAttributesTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -85,7 +87,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wsx/Identifier.php b/src/XML/wsx/Identifier.php index 3fd38c93..f54dfaa6 100644 --- a/src/XML/wsx/Identifier.php +++ b/src/XML/wsx/Identifier.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wsx; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * An Identifier element @@ -15,14 +17,9 @@ final class Identifier extends AbstractWsxElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wsx/Location.php b/src/XML/wsx/Location.php index e44f0d6f..90fcb81c 100644 --- a/src/XML/wsx/Location.php +++ b/src/XML/wsx/Location.php @@ -4,8 +4,10 @@ namespace SimpleSAML\WSSecurity\XML\wsx; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\URIElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * An Location element @@ -15,14 +17,9 @@ final class Location extends AbstractWsxElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = AnyURIValue::class; } diff --git a/src/XML/wsx/Metadata.php b/src/XML/wsx/Metadata.php index 298baed5..3eb5f351 100644 --- a/src/XML/wsx/Metadata.php +++ b/src/XML/wsx/Metadata.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the Metadata element @@ -23,6 +24,7 @@ final class Metadata extends AbstractWsxElement implements SchemaValidatableElem use ExtendableElementTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -77,7 +79,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wsx/MetadataReference.php b/src/XML/wsx/MetadataReference.php index 36b345d3..75cab2c1 100644 --- a/src/XML/wsx/MetadataReference.php +++ b/src/XML/wsx/MetadataReference.php @@ -6,11 +6,12 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class defining the MetadataReference element @@ -22,6 +23,7 @@ final class MetadataReference extends AbstractWsxElement implements SchemaValida use ExtendableElementTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -45,7 +47,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/wsx/MetadataSection.php b/src/XML/wsx/MetadataSection.php index ad9e76c4..f7b6d296 100644 --- a/src/XML/wsx/MetadataSection.php +++ b/src/XML/wsx/MetadataSection.php @@ -6,14 +6,16 @@ use DOMElement; use SimpleSAML\WSSecurity\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_merge; use function array_pop; @@ -29,6 +31,7 @@ final class MetadataSection extends AbstractWsxElement implements SchemaValidata use ExtendableElementTrait; use SchemaValidatableElementTrait; + /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; @@ -42,21 +45,19 @@ final class MetadataSection extends AbstractWsxElement implements SchemaValidata * @param (\SimpleSAML\XML\SerializableElementInterface| * \SimpleSAML\WSSecurity\XML\wsx\MetadataReference| * \SimpleSAML\WSSecurity\XML\wsx\Location) $child - * @param string $Dialect - * @param string|null $Identifier + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $Dialect + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue|null $Identifier * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( protected SerializableElementInterface|MetadataReference|Location $child, - protected string $Dialect, - protected ?string $Identifier = null, + protected AnyURIValue $Dialect, + protected ?AnyURIValue $Identifier = null, array $namespacedAttributes = [], ) { if (!($child instanceof MetadataReference) && !($child instanceof Location)) { Assert::notSame($child->toXML()->namespaceURI, static::NS); } - Assert::validURI($Dialect); - Assert::nullOrValidURI($Identifier); $this->setAttributesNS($namespacedAttributes); } @@ -78,9 +79,9 @@ public function getChild(): SerializableElementInterface|MetadataReference|Locat /** * Get the Dialect property. * - * @return string + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ - public function getDialect(): string + public function getDialect(): AnyURIValue { return $this->Dialect; } @@ -89,9 +90,9 @@ public function getDialect(): string /** * Get the Identifier property. * - * @return string|null + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue|null */ - public function getIdentifier(): ?string + public function getIdentifier(): ?AnyURIValue { return $this->Identifier; } @@ -103,7 +104,7 @@ public function getIdentifier(): ?string * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -121,8 +122,8 @@ public static function fromXML(DOMElement $xml): static return new static( array_pop($children), - self::getAttribute($xml, 'Dialect'), - self::getOptionalAttribute($xml, 'Identifier', null), + self::getAttribute($xml, 'Dialect', AnyURIValue::class), + self::getOptionalAttribute($xml, 'Identifier', AnyURIValue::class, null), self::getAttributesNSFromXML($xml), ); } @@ -137,10 +138,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = parent::instantiateParentElement($parent); - $e->setAttribute('Dialect', $this->getDialect()); + $e->setAttribute('Dialect', $this->getDialect()->getValue()); if ($this->getIdentifier() !== null) { - $e->setAttribute('Identifier', $this->getIdentifier()); + $e->setAttribute('Identifier', $this->getIdentifier()->getValue()); } $this->getChild()->toXML($e); diff --git a/tests/WSSecurity/XML/ElementRegistryTest.php b/tests/WSSecurity/XML/ElementRegistryTest.php index 12f1c95e..1405ac77 100644 --- a/tests/WSSecurity/XML/ElementRegistryTest.php +++ b/tests/WSSecurity/XML/ElementRegistryTest.php @@ -23,7 +23,7 @@ final class ElementRegistryTest extends TestCase */ public function testElementRegistry(): void { - $elementRegistry = dirname(__FILE__, 4) . '/src/XML/element.registry.php'; + $elementRegistry = dirname(__FILE__, 4) . '/classes/element.registry.php'; $namespaces = include($elementRegistry); foreach ($namespaces as $namespaceURI => $elements) { diff --git a/tests/WSSecurity/XML/auth/AdditionalContextTest.php b/tests/WSSecurity/XML/auth/AdditionalContextTest.php index fda0c8c9..58a0cca0 100644 --- a/tests/WSSecurity/XML/auth/AdditionalContextTest.php +++ b/tests/WSSecurity/XML/auth/AdditionalContextTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -57,13 +59,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'value2'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('value2')); $contextItem = new ContextItem( - C::NAMESPACE, - 'urn:x-simplesamlphp:scope', - new Value('someValue'), + AnyURIValue::fromString(C::NAMESPACE), + AnyURIValue::fromString('urn:x-simplesamlphp:scope'), + new Value( + StringValue::fromString('someValue'), + ), null, [$attr1], ); diff --git a/tests/WSSecurity/XML/auth/ClaimTypeTest.php b/tests/WSSecurity/XML/auth/ClaimTypeTest.php index edb10b4a..8e95c53d 100644 --- a/tests/WSSecurity/XML/auth/ClaimTypeTest.php +++ b/tests/WSSecurity/XML/auth/ClaimTypeTest.php @@ -20,6 +20,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -59,14 +62,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $claimType = new ClaimType( - C::NAMESPACE, - true, - new DisplayName('someDisplayName'), - new Description('someDescription'), - new DisplayValue('someDisplayValue'), - new Value('someValue'), + AnyURIValue::fromString(C::NAMESPACE), + BooleanValue::fromBoolean(true), + new DisplayName(StringValue::fromString('someDisplayName')), + new Description(StringValue::fromString('someDescription')), + new DisplayValue(StringValue::fromString('someDisplayValue')), + new Value(StringValue::fromString('someValue')), [$attr], ); @@ -81,14 +84,14 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $claimType = new ClaimType( - C::NAMESPACE, - true, - new DisplayName('someDisplayName'), - new Description('someDescription'), - new DisplayValue('someDisplayValue'), - new Value('someValue'), + AnyURIValue::fromString(C::NAMESPACE), + BooleanValue::fromBoolean(true), + new DisplayName(StringValue::fromString('someDisplayName')), + new Description(StringValue::fromString('someDescription')), + new DisplayValue(StringValue::fromString('someDisplayValue')), + new Value(StringValue::fromString('someValue')), [$attr], ); $claimTypeElement = $claimType->toXML(); @@ -99,7 +102,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $claimTypeElements); // Test ordering of ClaimType contents - /** @psalm-var \DOMElement[] $claimTypeElements */ + /** @var \DOMElement[] $claimTypeElements */ $claimTypeElements = XPath::xpQuery($claimTypeElement, './auth:DisplayName/following-sibling::*', $xpCache); $this->assertCount(3, $claimTypeElements); $this->assertEquals('auth:Description', $claimTypeElements[0]->tagName); diff --git a/tests/WSSecurity/XML/auth/ConstrainedManyValueTest.php b/tests/WSSecurity/XML/auth/ConstrainedManyValueTest.php index 5574b016..a05e76c7 100644 --- a/tests/WSSecurity/XML/auth/ConstrainedManyValueTest.php +++ b/tests/WSSecurity/XML/auth/ConstrainedManyValueTest.php @@ -17,6 +17,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XMLSchema\Type\StringValue; /** * Tests for auth:ConstrainedManyValueType. @@ -51,7 +52,7 @@ public function testMarshallingEmpty(string $class): void #[DataProvider('classProvider')] public function testMarshallingIllegalCombination(string $class): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); @@ -61,7 +62,7 @@ public function testMarshallingIllegalCombination(string $class): void [$attr1], ); - $value = new Value('MyValue'); + $value = new Value(StringValue::fromString('MyValue')); $this->expectException(AssertionFailedException::class); new $class([$value], [$structuredValue]); diff --git a/tests/WSSecurity/XML/auth/ConstrainedSingleValueTest.php b/tests/WSSecurity/XML/auth/ConstrainedSingleValueTest.php index 9a7d7c0d..3bf807c6 100644 --- a/tests/WSSecurity/XML/auth/ConstrainedSingleValueTest.php +++ b/tests/WSSecurity/XML/auth/ConstrainedSingleValueTest.php @@ -22,6 +22,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XMLSchema\Type\StringValue; /** * Tests for auth:ConstrainedSingleValueType. @@ -60,7 +61,7 @@ public function testMarshallingEmpty(string $class): void #[DataProvider('classProvider')] public function testMarshallingIllegalCombination(string $class): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); @@ -70,7 +71,7 @@ public function testMarshallingIllegalCombination(string $class): void [$attr1], ); - $value = new Value('MyValue'); + $value = new Value(StringValue::fromString('MyValue')); $this->expectException(AssertionFailedException::class); new $class($value, $structuredValue); diff --git a/tests/WSSecurity/XML/auth/ConstrainedValueTest.php b/tests/WSSecurity/XML/auth/ConstrainedValueTest.php index 63f1a4e9..de897534 100644 --- a/tests/WSSecurity/XML/auth/ConstrainedValueTest.php +++ b/tests/WSSecurity/XML/auth/ConstrainedValueTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\Attribute as XMLAttribute; //use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -48,19 +50,19 @@ public static function setUpBeforeClass(): void { self::$resourcePath = dirname(__FILE__, 4) . '/resources/xml/'; - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); -/** + /** self::$structuredValue = new StructuredValue( [new Chunk($child->documentElement)], [$attr1], ); -*/ + */ - self::$value = new Value('MyValue'); + self::$value = new Value(StringValue::fromString('MyValue')); } @@ -91,7 +93,7 @@ public function testMarshalling(string $class, string $xmlRepresentation): void * ) $item */ $item = new $class(self::$value, null); - $constrainedValue = new ConstrainedValue($item, [], true); + $constrainedValue = new ConstrainedValue($item, [], BooleanValue::fromBoolean(true)); $this->assertEquals( $xmlRepresentation->saveXML($xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/auth/ContextItemTest.php b/tests/WSSecurity/XML/auth/ContextItemTest.php index 952c2828..10782caa 100644 --- a/tests/WSSecurity/XML/auth/ContextItemTest.php +++ b/tests/WSSecurity/XML/auth/ContextItemTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,12 +55,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $contextItem = new ContextItem( - C::NAMESPACE, - 'urn:x-simplesamlphp:scope', - new Value('someValue'), + AnyURIValue::fromString(C::NAMESPACE), + AnyURIValue::fromString('urn:x-simplesamlphp:scope'), + new Value(StringValue::fromString('someValue')), null, [$attr1], ); diff --git a/tests/WSSecurity/XML/auth/DescriptionTest.php b/tests/WSSecurity/XML/auth/DescriptionTest.php index 8658f6b4..37ca5e4b 100644 --- a/tests/WSSecurity/XML/auth/DescriptionTest.php +++ b/tests/WSSecurity/XML/auth/DescriptionTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +52,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $description = new Description('MyDescription', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $description = new Description(StringValue::fromString('MyDescription'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/auth/DisplayNameTest.php b/tests/WSSecurity/XML/auth/DisplayNameTest.php index 09ccb5b5..86790f1f 100644 --- a/tests/WSSecurity/XML/auth/DisplayNameTest.php +++ b/tests/WSSecurity/XML/auth/DisplayNameTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +52,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $displayName = new DisplayName('MyFancyDisplayName', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $displayName = new DisplayName(StringValue::fromString('MyFancyDisplayName'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/auth/DisplayValueTest.php b/tests/WSSecurity/XML/auth/DisplayValueTest.php index ff594ba8..9b25a476 100644 --- a/tests/WSSecurity/XML/auth/DisplayValueTest.php +++ b/tests/WSSecurity/XML/auth/DisplayValueTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +52,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $displayValue = new DisplayValue('MyValue', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $displayValue = new DisplayValue(StringValue::fromString('MyValue'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/auth/EncryptedValueTest.php b/tests/WSSecurity/XML/auth/EncryptedValueTest.php index 433d05b4..74d0c6a5 100644 --- a/tests/WSSecurity/XML/auth/EncryptedValueTest.php +++ b/tests/WSSecurity/XML/auth/EncryptedValueTest.php @@ -12,6 +12,10 @@ use SimpleSAML\WSSecurity\XML\auth\EncryptedValue; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\StringValue; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; use SimpleSAML\XMLSecurity\XML\xenc\CipherData; use SimpleSAML\XMLSecurity\XML\xenc\CipherValue; @@ -57,29 +61,41 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $encryptedData = new EncryptedData( - new CipherData(new CipherValue('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=')), - 'MyID', - 'http://www.w3.org/2001/04/xmlenc#Element', - 'text/plain', - 'urn:x-simplesamlphp:encoding', - new EncryptionMethod('http://www.w3.org/2001/04/xmlenc#aes128-cbc'), + new CipherData( + new CipherValue( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + ), + ), + IDValue::fromString('MyID'), + AnyURIValue::fromString('http://www.w3.org/2001/04/xmlenc#Element'), + StringValue::fromString('text/plain'), + AnyURIValue::fromString('urn:x-simplesamlphp:encoding'), + new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2001/04/xmlenc#aes128-cbc'), + ), new KeyInfo( [ new EncryptedKey( - new CipherData(new CipherValue('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=')), + new CipherData( + new CipherValue( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + ), + ), null, null, null, null, null, null, - new EncryptionMethod('http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'), + new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'), + ), ), ], ), ); - $encryptedValue = new EncryptedValue($encryptedData, 'urn:some:uri'); + $encryptedValue = new EncryptedValue($encryptedData, AnyURIValue::fromString('urn:some:uri')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/auth/StructuredValueTest.php b/tests/WSSecurity/XML/auth/StructuredValueTest.php index 22775671..7cc3cd38 100644 --- a/tests/WSSecurity/XML/auth/StructuredValueTest.php +++ b/tests/WSSecurity/XML/auth/StructuredValueTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/auth/ValueGreaterThanOrEqualTest.php b/tests/WSSecurity/XML/auth/ValueGreaterThanOrEqualTest.php index bcf8f0d2..2b67c0d9 100644 --- a/tests/WSSecurity/XML/auth/ValueGreaterThanOrEqualTest.php +++ b/tests/WSSecurity/XML/auth/ValueGreaterThanOrEqualTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/auth/ValueGreaterThanTest.php b/tests/WSSecurity/XML/auth/ValueGreaterThanTest.php index 98920174..81928f1c 100644 --- a/tests/WSSecurity/XML/auth/ValueGreaterThanTest.php +++ b/tests/WSSecurity/XML/auth/ValueGreaterThanTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/auth/ValueInRangenTest.php b/tests/WSSecurity/XML/auth/ValueInRangenTest.php index 026f0ced..e672bb7d 100644 --- a/tests/WSSecurity/XML/auth/ValueInRangenTest.php +++ b/tests/WSSecurity/XML/auth/ValueInRangenTest.php @@ -18,6 +18,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -56,7 +57,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); @@ -67,7 +68,10 @@ public function testMarshalling(): void ); $valueUpperBound = new ValueUpperBound(null, $structuredValue); - $valueLowerBound = new ValueLowerBound(new Value('MyValue'), null); + $valueLowerBound = new ValueLowerBound( + new Value(StringValue::fromString('MyValue')), + null, + ); $valueInRangen = new ValueInRangen($valueUpperBound, $valueLowerBound); $this->assertEquals( diff --git a/tests/WSSecurity/XML/auth/ValueLessThanOrEqualTest.php b/tests/WSSecurity/XML/auth/ValueLessThanOrEqualTest.php index eb7140a7..c73a80df 100644 --- a/tests/WSSecurity/XML/auth/ValueLessThanOrEqualTest.php +++ b/tests/WSSecurity/XML/auth/ValueLessThanOrEqualTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/auth/ValueLessThanTest.php b/tests/WSSecurity/XML/auth/ValueLessThanTest.php index 713c6a10..fa37ef76 100644 --- a/tests/WSSecurity/XML/auth/ValueLessThanTest.php +++ b/tests/WSSecurity/XML/auth/ValueLessThanTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/auth/ValueLowerBoundTest.php b/tests/WSSecurity/XML/auth/ValueLowerBoundTest.php index 9cb336fe..8c3ecb13 100644 --- a/tests/WSSecurity/XML/auth/ValueLowerBoundTest.php +++ b/tests/WSSecurity/XML/auth/ValueLowerBoundTest.php @@ -13,6 +13,7 @@ use SimpleSAML\WSSecurity\XML\auth\ValueLowerBound; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,7 +52,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $valueLowerBound = new ValueLowerBound(new Value('MyValue')); + $valueLowerBound = new ValueLowerBound( + new Value(StringValue::fromString('MyValue')), + ); $this->assertFalse($valueLowerBound->isEmptyElement()); $this->assertEquals( diff --git a/tests/WSSecurity/XML/auth/ValueOneOfWithStructuredValuesTest.php b/tests/WSSecurity/XML/auth/ValueOneOfWithStructuredValuesTest.php index 2855afa6..11054b8e 100644 --- a/tests/WSSecurity/XML/auth/ValueOneOfWithStructuredValuesTest.php +++ b/tests/WSSecurity/XML/auth/ValueOneOfWithStructuredValuesTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,8 +54,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $child1 = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/auth/ValueOneOfWithValuesTest.php b/tests/WSSecurity/XML/auth/ValueOneOfWithValuesTest.php index d9ba4522..9a539f14 100644 --- a/tests/WSSecurity/XML/auth/ValueOneOfWithValuesTest.php +++ b/tests/WSSecurity/XML/auth/ValueOneOfWithValuesTest.php @@ -13,6 +13,7 @@ use SimpleSAML\WSSecurity\XML\auth\ValueOneOf; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +52,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $value1 = new Value('MyValue'); - $value2 = new Value('MyOtherValue'); + $value1 = new Value(StringValue::fromString('MyValue')); + $value2 = new Value(StringValue::fromString('MyOtherValue')); $valueOneOf = new ValueOneOf([$value1, $value2]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/auth/ValueTest.php b/tests/WSSecurity/XML/auth/ValueTest.php index 7838072f..a1f3217b 100644 --- a/tests/WSSecurity/XML/auth/ValueTest.php +++ b/tests/WSSecurity/XML/auth/ValueTest.php @@ -11,6 +11,7 @@ use SimpleSAML\WSSecurity\XML\auth\Value; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -48,7 +49,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $value = new Value('MyValue'); + $value = new Value(StringValue::fromString('MyValue')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/auth/ValueUpperBoundTest.php b/tests/WSSecurity/XML/auth/ValueUpperBoundTest.php index 103ddef4..543572ff 100644 --- a/tests/WSSecurity/XML/auth/ValueUpperBoundTest.php +++ b/tests/WSSecurity/XML/auth/ValueUpperBoundTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/fed/AdditionalContextProcessedTest.php b/tests/WSSecurity/XML/fed/AdditionalContextProcessedTest.php index 240da55a..0085744f 100644 --- a/tests/WSSecurity/XML/fed/AdditionalContextProcessedTest.php +++ b/tests/WSSecurity/XML/fed/AdditionalContextProcessedTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class AdditionalContextProcessedTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_AdditionalContextProcessed.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/ApplicationServiceEndpointTest.php b/tests/WSSecurity/XML/fed/ApplicationServiceEndpointTest.php index 8b8875d7..bd63bcbb 100644 --- a/tests/WSSecurity/XML/fed/ApplicationServiceEndpointTest.php +++ b/tests/WSSecurity/XML/fed/ApplicationServiceEndpointTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class ApplicationServiceEndpointTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/AttributeServiceEndpointTest.php b/tests/WSSecurity/XML/fed/AttributeServiceEndpointTest.php index 8265fb7c..3933b1dc 100644 --- a/tests/WSSecurity/XML/fed/AttributeServiceEndpointTest.php +++ b/tests/WSSecurity/XML/fed/AttributeServiceEndpointTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -41,6 +43,7 @@ final class AttributeServiceEndpointTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -92,17 +95,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/AttributeServiceEndpointsTest.php b/tests/WSSecurity/XML/fed/AttributeServiceEndpointsTest.php index 41c24ea2..2dbf0b48 100644 --- a/tests/WSSecurity/XML/fed/AttributeServiceEndpointsTest.php +++ b/tests/WSSecurity/XML/fed/AttributeServiceEndpointsTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class AttributeServiceEndpointsTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/AuthenticationTokenTest.php b/tests/WSSecurity/XML/fed/AuthenticationTokenTest.php index 35b7a871..76f3d7cd 100644 --- a/tests/WSSecurity/XML/fed/AuthenticationTokenTest.php +++ b/tests/WSSecurity/XML/fed/AuthenticationTokenTest.php @@ -17,6 +17,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -42,6 +43,7 @@ final class AuthenticationTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -52,7 +54,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_AuthenticationToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/AutomaticPseudonymsTest.php b/tests/WSSecurity/XML/fed/AutomaticPseudonymsTest.php index 2b76a945..aca8333e 100644 --- a/tests/WSSecurity/XML/fed/AutomaticPseudonymsTest.php +++ b/tests/WSSecurity/XML/fed/AutomaticPseudonymsTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; @@ -49,7 +50,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $automaticPseudonyms = new AutomaticPseudonyms(true); + $automaticPseudonyms = new AutomaticPseudonyms(BooleanValue::fromBoolean(true)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/ClaimDialectTest.php b/tests/WSSecurity/XML/fed/ClaimDialectTest.php index 02afc654..c64e3407 100644 --- a/tests/WSSecurity/XML/fed/ClaimDialectTest.php +++ b/tests/WSSecurity/XML/fed/ClaimDialectTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,13 +55,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $claimDialect = new ClaimDialect( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/fed/ClaimDialectsOfferedTest.php b/tests/WSSecurity/XML/fed/ClaimDialectsOfferedTest.php index 908bee89..d7bed630 100644 --- a/tests/WSSecurity/XML/fed/ClaimDialectsOfferedTest.php +++ b/tests/WSSecurity/XML/fed/ClaimDialectsOfferedTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -55,14 +57,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $child1 = DOMDocumentFactory::fromString( 'SomeChunk', ); $claimDialect = new ClaimDialect( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [new Chunk($child1->documentElement)], [$attr2], ); diff --git a/tests/WSSecurity/XML/fed/ClaimTypesOfferedTest.php b/tests/WSSecurity/XML/fed/ClaimTypesOfferedTest.php index 2319b58e..f8d79c65 100644 --- a/tests/WSSecurity/XML/fed/ClaimTypesOfferedTest.php +++ b/tests/WSSecurity/XML/fed/ClaimTypesOfferedTest.php @@ -20,6 +20,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -58,16 +61,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); $claimType = new ClaimType( - C::NAMESPACE, - true, - new DisplayName('someDisplayName'), - new Description('someDescription'), - new DisplayValue('someDisplayValue'), - new Value('someValue'), + AnyURIValue::fromString(C::NAMESPACE), + BooleanValue::fromBoolean(true), + new DisplayName(StringValue::fromString('someDisplayName')), + new Description(StringValue::fromString('someDescription')), + new DisplayValue(StringValue::fromString('someDisplayValue')), + new Value(StringValue::fromString('someValue')), [$attr2], ); diff --git a/tests/WSSecurity/XML/fed/ClaimTypesRequestedTest.php b/tests/WSSecurity/XML/fed/ClaimTypesRequestedTest.php index b557e776..8bac4f30 100644 --- a/tests/WSSecurity/XML/fed/ClaimTypesRequestedTest.php +++ b/tests/WSSecurity/XML/fed/ClaimTypesRequestedTest.php @@ -20,6 +20,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -58,16 +61,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); $claimType = new ClaimType( - C::NAMESPACE, - true, - new DisplayName('someDisplayName'), - new Description('someDescription'), - new DisplayValue('someDisplayValue'), - new Value('someValue'), + AnyURIValue::fromString(C::NAMESPACE), + BooleanValue::fromBoolean(true), + new DisplayName(StringValue::fromString('someDisplayName')), + new Description(StringValue::fromString('someDescription')), + new DisplayValue(StringValue::fromString('someDisplayValue')), + new Value(StringValue::fromString('someValue')), [$attr2], ); diff --git a/tests/WSSecurity/XML/fed/ClientPseudonymTest.php b/tests/WSSecurity/XML/fed/ClientPseudonymTest.php index cfd3ffc3..13eb0e24 100644 --- a/tests/WSSecurity/XML/fed/ClientPseudonymTest.php +++ b/tests/WSSecurity/XML/fed/ClientPseudonymTest.php @@ -13,12 +13,14 @@ use SimpleSAML\WSSecurity\XML\fed\DisplayName; use SimpleSAML\WSSecurity\XML\fed\EMail; use SimpleSAML\WSSecurity\XML\fed\PPID; +use SimpleSAML\WSSecurity\XML\fed\Type\EmailAddressValue; use SimpleSAML\XML\Attribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XML\Utils\XPath; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XPath\XPath; use function dirname; use function strval; @@ -58,19 +60,19 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', 'testval3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', 'testval4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('testval4')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', )->documentElement); $clientPseudonym = new ClientPseudonym( - new PPID('MyPPID', [$attr2]), - new DisplayName('MyDisplayName', [$attr3]), - new EMail('MyEMail', [$attr4]), + new PPID(StringValue::fromString('MyPPID'), [$attr2]), + new DisplayName(StringValue::fromString('MyDisplayName'), [$attr3]), + new EMail(EmailAddressValue::fromString('example@simplesamlphp.org'), [$attr4]), [$chunk], [$attr1], ); @@ -96,19 +98,19 @@ public function testMarshallingEmptyElement(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', 'testval3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', 'testval4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('testval4')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', )->documentElement); $clientPseudonym = new ClientPseudonym( - new PPID('MyPPID', [$attr2]), - new DisplayName('MyDisplayName', [$attr3]), - new EMail('MyEMail', [$attr4]), + new PPID(StringValue::fromString('MyPPID'), [$attr2]), + new DisplayName(StringValue::fromString('MyDisplayName'), [$attr3]), + new EMail(EmailAddressValue::fromString('example@simplesamlphp.org'), [$attr4]), [$chunk], [$attr1], ); @@ -120,8 +122,9 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $clientPseudonymElements); // Test ordering of ClientPseudonym contents - /** @psalm-var \DOMElement[] $clientPseudonymElements */ + /** @var \DOMElement[] $clientPseudonymElements */ $clientPseudonymElements = XPath::xpQuery($clientPseudonymElement, './fed:PPID/following-sibling::*', $xpCache); + $this->assertCount(3, $clientPseudonymElements); $this->assertEquals('fed:DisplayName', $clientPseudonymElements[0]->tagName); $this->assertEquals('fed:EMail', $clientPseudonymElements[1]->tagName); diff --git a/tests/WSSecurity/XML/fed/DisplayNameTest.php b/tests/WSSecurity/XML/fed/DisplayNameTest.php index 45ca48db..01ce2de4 100644 --- a/tests/WSSecurity/XML/fed/DisplayNameTest.php +++ b/tests/WSSecurity/XML/fed/DisplayNameTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -51,12 +52,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $DisplayName = new DisplayName('phpunit', [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $displayName = new DisplayName(StringValue::fromString('phpunit'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($DisplayName), + strval($displayName), ); } } diff --git a/tests/WSSecurity/XML/fed/EMailTest.php b/tests/WSSecurity/XML/fed/EMailTest.php index 9a14df8c..523fd2d6 100644 --- a/tests/WSSecurity/XML/fed/EMailTest.php +++ b/tests/WSSecurity/XML/fed/EMailTest.php @@ -11,9 +11,11 @@ use SimpleSAML\WSSecurity\XML\fed\AbstractAttributeExtensibleString; use SimpleSAML\WSSecurity\XML\fed\AbstractFedElement; use SimpleSAML\WSSecurity\XML\fed\EMail; +use SimpleSAML\WSSecurity\XML\fed\Type\EmailAddressValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -51,8 +53,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $EMail = new EMail('phpunit', [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $EMail = new EMail(EmailAddressValue::fromString('example@simplesamlphp.org'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/FederationIDTest.php b/tests/WSSecurity/XML/fed/FederationIDTest.php index 29a23cac..43b1a745 100644 --- a/tests/WSSecurity/XML/fed/FederationIDTest.php +++ b/tests/WSSecurity/XML/fed/FederationIDTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,8 +57,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $federationID = new FederationID(C::NAMESPACE, [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $federationID = new FederationID(AnyURIValue::fromString(C::NAMESPACE), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/FederationMetadataHandlerTest.php b/tests/WSSecurity/XML/fed/FederationMetadataHandlerTest.php index bdda20bc..bccc04de 100644 --- a/tests/WSSecurity/XML/fed/FederationMetadataHandlerTest.php +++ b/tests/WSSecurity/XML/fed/FederationMetadataHandlerTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); $federationMetadataHandler = new FederationMetadataHandler([$attr1]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/fed/FederationMetadataTest.php b/tests/WSSecurity/XML/fed/FederationMetadataTest.php index 66051966..3fdf71a1 100644 --- a/tests/WSSecurity/XML/fed/FederationMetadataTest.php +++ b/tests/WSSecurity/XML/fed/FederationMetadataTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -55,8 +57,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $some = DOMDocumentFactory::fromString( 'Some', ); @@ -65,7 +67,7 @@ public function testMarshalling(): void ); $federation = new Federation( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [new Chunk($some->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/fed/FederationTest.php b/tests/WSSecurity/XML/fed/FederationTest.php index 7c5be19e..7c6aa4e5 100644 --- a/tests/WSSecurity/XML/fed/FederationTest.php +++ b/tests/WSSecurity/XML/fed/FederationTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; use function strval; @@ -52,13 +53,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', AnyURIValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $federation = new Federation( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/fed/FilterPseudonymsTest.php b/tests/WSSecurity/XML/fed/FilterPseudonymsTest.php index 94722542..576b9f78 100644 --- a/tests/WSSecurity/XML/fed/FilterPseudonymsTest.php +++ b/tests/WSSecurity/XML/fed/FilterPseudonymsTest.php @@ -19,6 +19,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -37,6 +38,7 @@ final class FilterPseudonymsTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -94,10 +96,10 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', 'testval3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', 'testval4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('testval4')); $pseudonymBasis = new PseudonymBasis( self::$basis, diff --git a/tests/WSSecurity/XML/fed/FreshnessTest.php b/tests/WSSecurity/XML/fed/FreshnessTest.php index 005140f9..ff9453d5 100644 --- a/tests/WSSecurity/XML/fed/FreshnessTest.php +++ b/tests/WSSecurity/XML/fed/FreshnessTest.php @@ -15,6 +15,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\Type\UnsignedIntValue; use function dirname; @@ -36,6 +39,7 @@ final class FreshnessTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -56,8 +60,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $freshness = new Freshness(123, true, [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $freshness = new Freshness(UnsignedIntValue::fromInteger(123), BooleanValue::fromBoolean(true), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/IssuerNameTest.php b/tests/WSSecurity/XML/fed/IssuerNameTest.php index 330f7a28..c6d83c27 100644 --- a/tests/WSSecurity/XML/fed/IssuerNameTest.php +++ b/tests/WSSecurity/XML/fed/IssuerNameTest.php @@ -13,6 +13,8 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,10 +53,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $issuerName = new IssuerName( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [$attr1], ); diff --git a/tests/WSSecurity/XML/fed/IssuesSpecificPolicyFaultTest.php b/tests/WSSecurity/XML/fed/IssuesSpecificPolicyFaultTest.php index 8682348d..4f87ccad 100644 --- a/tests/WSSecurity/XML/fed/IssuesSpecificPolicyFaultTest.php +++ b/tests/WSSecurity/XML/fed/IssuesSpecificPolicyFaultTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class IssuesSpecificPolicyFaultTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_IssuesSpecificPolicyFault.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/LogicalServiceNamesOfferedTest.php b/tests/WSSecurity/XML/fed/LogicalServiceNamesOfferedTest.php index 792e522d..562ad38a 100644 --- a/tests/WSSecurity/XML/fed/LogicalServiceNamesOfferedTest.php +++ b/tests/WSSecurity/XML/fed/LogicalServiceNamesOfferedTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,11 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $issuerName = new IssuerName( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [$attr2], ); diff --git a/tests/WSSecurity/XML/fed/PPIDTest.php b/tests/WSSecurity/XML/fed/PPIDTest.php index 31682085..3ee1fbb6 100644 --- a/tests/WSSecurity/XML/fed/PPIDTest.php +++ b/tests/WSSecurity/XML/fed/PPIDTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,8 +56,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $PPID = new PPID('phpunit', [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $PPID = new PPID(StringValue::fromString('phpunit'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/PassiveRequestorEndpointTest.php b/tests/WSSecurity/XML/fed/PassiveRequestorEndpointTest.php index d82c246c..b1ea766f 100644 --- a/tests/WSSecurity/XML/fed/PassiveRequestorEndpointTest.php +++ b/tests/WSSecurity/XML/fed/PassiveRequestorEndpointTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class PassiveRequestorEndpointTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/PassiveRequestorEndpointsTest.php b/tests/WSSecurity/XML/fed/PassiveRequestorEndpointsTest.php index 364b8037..d7e93a98 100644 --- a/tests/WSSecurity/XML/fed/PassiveRequestorEndpointsTest.php +++ b/tests/WSSecurity/XML/fed/PassiveRequestorEndpointsTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class PassiveRequestorEndpointsTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/ProofTokenTest.php b/tests/WSSecurity/XML/fed/ProofTokenTest.php index e902d5e5..8b640266 100644 --- a/tests/WSSecurity/XML/fed/ProofTokenTest.php +++ b/tests/WSSecurity/XML/fed/ProofTokenTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -27,7 +28,6 @@ #[Group('fed')] #[CoversClass(ProofToken::class)] #[CoversClass(AbstractProofTokenType::class)] -#[CoversClass(AbstractProofTokenType::class)] #[CoversClass(AbstractFedElement::class)] final class ProofTokenTest extends TestCase { @@ -55,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/fed/PseudonymBasisTest.php b/tests/WSSecurity/XML/fed/PseudonymBasisTest.php index 2b15c094..8b1a6756 100644 --- a/tests/WSSecurity/XML/fed/PseudonymBasisTest.php +++ b/tests/WSSecurity/XML/fed/PseudonymBasisTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/fed/PseudonymServiceEndpointTest.php b/tests/WSSecurity/XML/fed/PseudonymServiceEndpointTest.php index c1fd9768..c1f8397c 100644 --- a/tests/WSSecurity/XML/fed/PseudonymServiceEndpointTest.php +++ b/tests/WSSecurity/XML/fed/PseudonymServiceEndpointTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class PseudonymServiceEndpointTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/PseudonymServiceEndpointsTest.php b/tests/WSSecurity/XML/fed/PseudonymServiceEndpointsTest.php index 15a3177f..be25c59b 100644 --- a/tests/WSSecurity/XML/fed/PseudonymServiceEndpointsTest.php +++ b/tests/WSSecurity/XML/fed/PseudonymServiceEndpointsTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class PseudonymServiceEndpointsTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,28 +92,28 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], [$attr1], ); - $PseudonymServiceEndpoints = new PseudonymServiceEndpoints([$endpointReference]); + $pseudonymServiceEndpoints = new PseudonymServiceEndpoints([$endpointReference]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($PseudonymServiceEndpoints), + strval($pseudonymServiceEndpoints), ); } } diff --git a/tests/WSSecurity/XML/fed/PseudonymTest.php b/tests/WSSecurity/XML/fed/PseudonymTest.php index 6a44d90a..3e2148fa 100644 --- a/tests/WSSecurity/XML/fed/PseudonymTest.php +++ b/tests/WSSecurity/XML/fed/PseudonymTest.php @@ -4,7 +4,6 @@ namespace SimpleSAML\Test\WSSecurity\XML\fed; -use DateTimeImmutable; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -16,12 +15,14 @@ use SimpleSAML\WSSecurity\XML\fed\RelativeTo; use SimpleSAML\WSSecurity\XML\fed\SecurityToken; use SimpleSAML\WSSecurity\XML\wsu\Expires; +use SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue; use SimpleSAML\XML\Attribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XML\Utils\XPath; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XPath\XPath; use function dirname; use function strval; @@ -40,6 +41,7 @@ final class PseudonymTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $basis */ protected static Chunk $basis; @@ -96,11 +98,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', 'testval3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', 'testval4'); - $attr5 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr5', 'testval5'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('testval4')); + $attr5 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr5', StringValue::fromString('testval5')); $pseudonymBasis = new PseudonymBasis( self::$basis, @@ -112,7 +114,7 @@ public function testMarshalling(): void [$attr3], ); - $expires = new Expires(new DateTimeImmutable('2001-10-13T09:00:00Z')); + $expires = new Expires(DateTimeValue::fromString('2001-10-13T09:00:00Z')); $securityToken = new SecurityToken( self::$security, @@ -142,11 +144,11 @@ public function testMarshalling(): void */ public function testMarshallingElementOrder(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', 'testval3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', 'testval4'); - $attr5 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr5', 'testval5'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('testval4')); + $attr5 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr5', StringValue::fromString('testval5')); $pseudonymBasis = new PseudonymBasis( self::$basis, @@ -158,7 +160,7 @@ public function testMarshallingElementOrder(): void [$attr3], ); - $expires = new Expires(new DateTimeImmutable('2001-10-13T09:00:00Z')); + $expires = new Expires(DateTimeValue::fromString('2001-10-13T09:00:00Z')); $securityToken = new SecurityToken( self::$security, @@ -184,8 +186,9 @@ public function testMarshallingElementOrder(): void $this->assertCount(1, $pseudonymBasisElements); // Test ordering of Pseudonym contents - /** @psalm-var \DOMElement[] $pseudonymElements */ + /** @var \DOMElement[] $pseudonymElements */ $pseudonymElements = XPath::xpQuery($pseudonymElement, './fed:PseudonymBasis/following-sibling::*', $xpCache); + $this->assertCount(5, $pseudonymElements); $this->assertEquals('fed:RelativeTo', $pseudonymElements[0]->tagName); $this->assertEquals('wsu:Expires', $pseudonymElements[1]->tagName); diff --git a/tests/WSSecurity/XML/fed/RealmTest.php b/tests/WSSecurity/XML/fed/RealmTest.php index 1e350444..dceacc41 100644 --- a/tests/WSSecurity/XML/fed/RealmTest.php +++ b/tests/WSSecurity/XML/fed/RealmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $realm = new Realm(C::NAMESPACE); + $realm = new Realm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/ReferenceDigestTest.php b/tests/WSSecurity/XML/fed/ReferenceDigestTest.php index 418850f4..9bad5b05 100644 --- a/tests/WSSecurity/XML/fed/ReferenceDigestTest.php +++ b/tests/WSSecurity/XML/fed/ReferenceDigestTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -51,8 +53,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $referenceDigest = new ReferenceDigest('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=', [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $referenceDigest = new ReferenceDigest( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/ReferenceEPRTest.php b/tests/WSSecurity/XML/fed/ReferenceEPRTest.php index c02ad901..70080671 100644 --- a/tests/WSSecurity/XML/fed/ReferenceEPRTest.php +++ b/tests/WSSecurity/XML/fed/ReferenceEPRTest.php @@ -14,10 +14,12 @@ use SimpleSAML\WSSecurity\XML\wsa_200508\Address; use SimpleSAML\WSSecurity\XML\wsa_200508\Metadata; use SimpleSAML\WSSecurity\XML\wsa_200508\ReferenceParameters; -use SimpleSAML\XML\Attribute; +use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -78,17 +80,20 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', 'testval3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', 'testval4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('testval4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr3]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr4]); $chunk = new Chunk(self::$customContent); $referenceEPR = new ReferenceEPR( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address( + AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), + [$attr2], + ), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/ReferenceToken11Test.php b/tests/WSSecurity/XML/fed/ReferenceToken11Test.php index 25d311cd..05f8d065 100644 --- a/tests/WSSecurity/XML/fed/ReferenceToken11Test.php +++ b/tests/WSSecurity/XML/fed/ReferenceToken11Test.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class ReferenceToken11Test extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_ReferenceToken11.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/ReferenceTokenTest.php b/tests/WSSecurity/XML/fed/ReferenceTokenTest.php index 93f5fea2..44d7eedc 100644 --- a/tests/WSSecurity/XML/fed/ReferenceTokenTest.php +++ b/tests/WSSecurity/XML/fed/ReferenceTokenTest.php @@ -25,6 +25,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -99,14 +102,14 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); - $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr3', 'testval3'); - $attr4 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr4', 'testval4'); - $attr5 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr5', 'testval5'); - $attr6 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr6', 'testval6'); - $attr7 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr7', 'testval7'); - $attr8 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr8', 'testval8'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr4', StringValue::fromString('testval4')); + $attr5 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr5', StringValue::fromString('testval5')); + $attr6 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr6', StringValue::fromString('testval6')); + $attr7 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr7', StringValue::fromString('testval7')); + $attr8 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr8', StringValue::fromString('testval8')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr5]); @@ -114,16 +117,22 @@ public function testMarshalling(): void $some = new Chunk(self::$some); $referenceEPR = new ReferenceEPR( - new Address('https://login.microsoftonline.com/login.srf', [$attr3]), + new Address( + AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), + [$attr3], + ), $referenceParameters, $metadata, [$chunk], [$attr2], ); - $referenceDigest = new ReferenceDigest('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=', [$attr6]); - $referenceType = new ReferenceType(C::NAMESPACE, [$attr7]); - $serialNo = new SerialNo(C::NAMESPACE, [$attr8]); + $referenceDigest = new ReferenceDigest( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + [$attr6], + ); + $referenceType = new ReferenceType(AnyURIValue::fromString(C::NAMESPACE), [$attr7]); + $serialNo = new SerialNo(AnyURIValue::fromString(C::NAMESPACE), [$attr8]); $referenceToken = new ReferenceToken( [$referenceEPR], diff --git a/tests/WSSecurity/XML/fed/ReferenceTypeTest.php b/tests/WSSecurity/XML/fed/ReferenceTypeTest.php index c0800da3..66609fb5 100644 --- a/tests/WSSecurity/XML/fed/ReferenceTypeTest.php +++ b/tests/WSSecurity/XML/fed/ReferenceTypeTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,8 +55,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $referenceType = new ReferenceType(C::NAMESPACE, [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $referenceType = new ReferenceType(AnyURIValue::fromString(C::NAMESPACE), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/RelativeToTest.php b/tests/WSSecurity/XML/fed/RelativeToTest.php index fefc5468..b53b5961 100644 --- a/tests/WSSecurity/XML/fed/RelativeToTest.php +++ b/tests/WSSecurity/XML/fed/RelativeToTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -55,7 +56,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/fed/RequestProofTokenTest.php b/tests/WSSecurity/XML/fed/RequestProofTokenTest.php index c08e32f1..f07a36ef 100644 --- a/tests/WSSecurity/XML/fed/RequestProofTokenTest.php +++ b/tests/WSSecurity/XML/fed/RequestProofTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class RequestProofTokenTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_RequestProofToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/RequestPseudonymTest.php b/tests/WSSecurity/XML/fed/RequestPseudonymTest.php index 4bf44b6d..96c47381 100644 --- a/tests/WSSecurity/XML/fed/RequestPseudonymTest.php +++ b/tests/WSSecurity/XML/fed/RequestPseudonymTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,14 +56,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $requestPseudonym = new RequestPseudonym( - true, - false, + BooleanValue::fromBoolean(true), + BooleanValue::fromBoolean(false), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/fed/RequireBearerTokensTest.php b/tests/WSSecurity/XML/fed/RequireBearerTokensTest.php index 7531c601..98fb1dad 100644 --- a/tests/WSSecurity/XML/fed/RequireBearerTokensTest.php +++ b/tests/WSSecurity/XML/fed/RequireBearerTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class RequireBearerTokensTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_RequireBearerTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/RequireReferenceTokenTest.php b/tests/WSSecurity/XML/fed/RequireReferenceTokenTest.php index 189796e8..573979d4 100644 --- a/tests/WSSecurity/XML/fed/RequireReferenceTokenTest.php +++ b/tests/WSSecurity/XML/fed/RequireReferenceTokenTest.php @@ -12,12 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('fed')] #[CoversClass(RequireReferenceToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class RequireReferenceTokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); - $requireReferenceToken = new RequireReferenceToken([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $requireReferenceToken = new RequireReferenceToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($requireReferenceToken), diff --git a/tests/WSSecurity/XML/fed/RequireSharedCookiesTest.php b/tests/WSSecurity/XML/fed/RequireSharedCookiesTest.php index d0c7d695..65d1ad8b 100644 --- a/tests/WSSecurity/XML/fed/RequireSharedCookiesTest.php +++ b/tests/WSSecurity/XML/fed/RequireSharedCookiesTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class RequireSharedCookiesTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_RequireSharedCookies.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/RequireSignedTokensTest.php b/tests/WSSecurity/XML/fed/RequireSignedTokensTest.php index b471d396..490c4e64 100644 --- a/tests/WSSecurity/XML/fed/RequireSignedTokensTest.php +++ b/tests/WSSecurity/XML/fed/RequireSignedTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class RequireSignedTokensTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_RequireSignedTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/RequiresGenericClaimDialectTest.php b/tests/WSSecurity/XML/fed/RequiresGenericClaimDialectTest.php index ad21e5bb..d397a321 100644 --- a/tests/WSSecurity/XML/fed/RequiresGenericClaimDialectTest.php +++ b/tests/WSSecurity/XML/fed/RequiresGenericClaimDialectTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -33,6 +34,7 @@ final class RequiresGenericClaimDialectTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -50,7 +52,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_RequiresGenericClaimDialect.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/fed/SecurityTokenServiceEndpointTest.php b/tests/WSSecurity/XML/fed/SecurityTokenServiceEndpointTest.php index f5a22c84..55d0471e 100644 --- a/tests/WSSecurity/XML/fed/SecurityTokenServiceEndpointTest.php +++ b/tests/WSSecurity/XML/fed/SecurityTokenServiceEndpointTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class SecurityTokenServiceEndpointTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/SecurityTokenTest.php b/tests/WSSecurity/XML/fed/SecurityTokenTest.php index c8a0fd3e..2327fd15 100644 --- a/tests/WSSecurity/XML/fed/SecurityTokenTest.php +++ b/tests/WSSecurity/XML/fed/SecurityTokenTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/fed/SerialNoTest.php b/tests/WSSecurity/XML/fed/SerialNoTest.php index 26bce561..788482ae 100644 --- a/tests/WSSecurity/XML/fed/SerialNoTest.php +++ b/tests/WSSecurity/XML/fed/SerialNoTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,8 +55,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $serialNo = new SerialNo(C::NAMESPACE, [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $serialNo = new SerialNo(AnyURIValue::fromString(C::NAMESPACE), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/fed/SignOutBasisTest.php b/tests/WSSecurity/XML/fed/SignOutBasisTest.php index a7430c06..cac769c5 100644 --- a/tests/WSSecurity/XML/fed/SignOutBasisTest.php +++ b/tests/WSSecurity/XML/fed/SignOutBasisTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -31,6 +32,7 @@ final class SignOutBasisTest extends TestCase { use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; @@ -59,7 +61,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $signOutBasis = new SignOutBasis( [self::$chunk], diff --git a/tests/WSSecurity/XML/fed/SignOutTest.php b/tests/WSSecurity/XML/fed/SignOutTest.php index 6680a961..f57f0b42 100644 --- a/tests/WSSecurity/XML/fed/SignOutTest.php +++ b/tests/WSSecurity/XML/fed/SignOutTest.php @@ -12,12 +12,15 @@ use SimpleSAML\WSSecurity\XML\fed\Realm; use SimpleSAML\WSSecurity\XML\fed\SignOut; use SimpleSAML\WSSecurity\XML\fed\SignOutBasis; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XML\Utils\XPath; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XPath\XPath; use function dirname; use function strval; @@ -36,6 +39,7 @@ final class SignOutTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $basis */ protected static Chunk $basis; @@ -71,20 +75,20 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $signOutBasis = new SignOutBasis( [self::$basis], [$attr2], ); - $realm = new Realm('urn:x-simplesamlphp:namespace'); + $realm = new Realm(AnyURIValue::fromString('urn:x-simplesamlphp:namespace')); $signOut = new SignOut( $signOutBasis, $realm, - 'phpunit', + IDValue::fromString('phpunit'), [self::$chunk], [$attr1], ); @@ -100,20 +104,20 @@ public function testMarshalling(): void */ public function testMarshallingElementOrder(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $signOutBasis = new SignOutBasis( [self::$basis], [$attr2], ); - $realm = new Realm('urn:x-simplesamlphp:namespace'); + $realm = new Realm(AnyURIValue::fromString('urn:x-simplesamlphp:namespace')); $signOut = new SignOut( $signOutBasis, $realm, - 'phpunit', + IDValue::fromString('phpunit'), [self::$chunk], [$attr1], ); @@ -125,8 +129,9 @@ public function testMarshallingElementOrder(): void $this->assertCount(1, $signOutElements); // Test ordering of SignOUt contents - /** @psalm-var \DOMElement[] $signOutElements */ + /** @var \DOMElement[] $signOutElements */ $signOutElements = XPath::xpQuery($signOutElement, './fed:Realm/following-sibling::*', $xpCache); + $this->assertCount(2, $signOutElements); $this->assertEquals('fed:SignOutBasis', $signOutElements[0]->tagName); $this->assertEquals('ssp:Chunk', $signOutElements[1]->tagName); diff --git a/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointTest.php b/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointTest.php index b47f6ba4..fa51337f 100644 --- a/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointTest.php +++ b/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class SingleSignOutNotificationEndpointTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointsTest.php b/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointsTest.php index 547d4d0b..93a4bd91 100644 --- a/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointsTest.php +++ b/tests/WSSecurity/XML/fed/SingleSignOutNotificationEndpointsTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class SingleSignOutNotificationEndpointsTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointTest.php b/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointTest.php index 8b848dce..54cdd7c3 100644 --- a/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointTest.php +++ b/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class SingleSignOutSubscriptionEndpointTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointsTest.php b/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointsTest.php index 6863b5e3..9e7abf12 100644 --- a/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointsTest.php +++ b/tests/WSSecurity/XML/fed/SingleSignOutSubscriptionEndpointsTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class SingleSignOutSubscriptionEndpointsTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/TargetScopesTest.php b/tests/WSSecurity/XML/fed/TargetScopesTest.php index 29913cc2..40320b9e 100644 --- a/tests/WSSecurity/XML/fed/TargetScopesTest.php +++ b/tests/WSSecurity/XML/fed/TargetScopesTest.php @@ -20,6 +20,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -38,6 +40,7 @@ final class TargetScopesTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $endpointReference */ protected static DOMElement $endpointReference; @@ -89,17 +92,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParameters)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/fed/TokenTypeTest.php b/tests/WSSecurity/XML/fed/TokenTypeTest.php index f707e397..d32e39c3 100644 --- a/tests/WSSecurity/XML/fed/TokenTypeTest.php +++ b/tests/WSSecurity/XML/fed/TokenTypeTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -52,13 +54,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $tokenType = new TokenType( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/fed/TokenTypesOfferedTest.php b/tests/WSSecurity/XML/fed/TokenTypesOfferedTest.php index 11e4dfbe..f99ff079 100644 --- a/tests/WSSecurity/XML/fed/TokenTypesOfferedTest.php +++ b/tests/WSSecurity/XML/fed/TokenTypesOfferedTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -55,8 +57,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $child1 = DOMDocumentFactory::fromString( 'SomeChunk', ); @@ -65,7 +67,7 @@ public function testMarshalling(): void ); $tokenType = new TokenType( - 'urn:some:uri', + AnyURIValue::fromString('urn:some:uri'), [new Chunk($child1->documentElement)], [$attr2], ); diff --git a/tests/WSSecurity/XML/fed/WebBindingTest.php b/tests/WSSecurity/XML/fed/WebBindingTest.php index ecc19a11..2701b804 100644 --- a/tests/WSSecurity/XML/fed/WebBindingTest.php +++ b/tests/WSSecurity/XML/fed/WebBindingTest.php @@ -17,6 +17,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -42,6 +43,7 @@ final class WebBindingTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -52,7 +54,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/fed_WebBinding.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/mssp/RsaTokenTest.php b/tests/WSSecurity/XML/mssp/RsaTokenTest.php index 4c0ded89..ea3b8b09 100644 --- a/tests/WSSecurity/XML/mssp/RsaTokenTest.php +++ b/tests/WSSecurity/XML/mssp/RsaTokenTest.php @@ -12,11 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $rsaToken = new RsaToken([$chunk], [$includeToken, $attr]); + $rsaToken = new RsaToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($rsaToken), diff --git a/tests/WSSecurity/XML/mssp/SslContextTokenTest.php b/tests/WSSecurity/XML/mssp/SslContextTokenTest.php index 6e5d713b..7c52d477 100644 --- a/tests/WSSecurity/XML/mssp/SslContextTokenTest.php +++ b/tests/WSSecurity/XML/mssp/SslContextTokenTest.php @@ -12,11 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $sslContextToken = new SslContextToken([$chunk], [$includeToken, $attr]); + $sslContextToken = new SslContextToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($sslContextToken), diff --git a/tests/WSSecurity/XML/sp_200507/AlgorithmSuiteTest.php b/tests/WSSecurity/XML/sp_200507/AlgorithmSuiteTest.php index bc2487f5..48dfea5c 100644 --- a/tests/WSSecurity/XML/sp_200507/AlgorithmSuiteTest.php +++ b/tests/WSSecurity/XML/sp_200507/AlgorithmSuiteTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AlgorithmSuite; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/AlgorithmSuite.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/AsymmetricBindingTest.php b/tests/WSSecurity/XML/sp_200507/AsymmetricBindingTest.php index 76fd0c2a..2ee3b045 100644 --- a/tests/WSSecurity/XML/sp_200507/AsymmetricBindingTest.php +++ b/tests/WSSecurity/XML/sp_200507/AsymmetricBindingTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AsymmetricBinding; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -36,6 +39,7 @@ final class AsymmetricBindingTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $some */ protected static Chunk $some; @@ -59,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/AsymmetricBinding.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -69,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/BootstrapPolicyTest.php b/tests/WSSecurity/XML/sp_200507/BootstrapPolicyTest.php index 8d2ec91c..579a91f3 100644 --- a/tests/WSSecurity/XML/sp_200507/BootstrapPolicyTest.php +++ b/tests/WSSecurity/XML/sp_200507/BootstrapPolicyTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\BootstrapPolicy; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/BootstrapPolicy.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/EncryptedElementsTest.php b/tests/WSSecurity/XML/sp_200507/EncryptedElementsTest.php index 96ca15f8..edd5c547 100644 --- a/tests/WSSecurity/XML/sp_200507/EncryptedElementsTest.php +++ b/tests/WSSecurity/XML/sp_200507/EncryptedElementsTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,30 +54,35 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $EncryptedElements = new EncryptedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); - $EncryptedElementsElement = $EncryptedElements->toXML(); + $encryptedElements = new EncryptedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); + $encryptedElementsElement = $encryptedElements->toXML(); // Test for an XPath - $xpCache = XMLXPath::getXPath($EncryptedElementsElement); - $EncryptedElementsElements = XMLXPath::xpQuery($EncryptedElementsElement, './sp:XPath', $xpCache); - $this->assertCount(1, $EncryptedElementsElements); + $xpCache = XMLXPath::getXPath($encryptedElementsElement); + $encryptedElementsElements = XMLXPath::xpQuery($encryptedElementsElement, './sp:XPath', $xpCache); + $this->assertCount(1, $encryptedElementsElements); // Test ordering of EncryptedElements contents - /** @psalm-var \DOMElement[] $EncryptedElementsElements */ - $EncryptedElementsElements = XMLXPath::xpQuery( - $EncryptedElementsElement, + /** @var \DOMElement[] $encryptedElementsElements */ + $encryptedElementsElements = XMLXPath::xpQuery( + $encryptedElementsElement, './sp:XPath/following-sibling::*', $xpCache, ); - $this->assertCount(1, $EncryptedElementsElements); - $this->assertEquals('ssp:Chunk', $EncryptedElementsElements[0]->tagName); + $this->assertCount(1, $encryptedElementsElements); + $this->assertEquals('ssp:Chunk', $encryptedElementsElements[0]->tagName); } @@ -87,16 +94,22 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $EncryptedElements = new EncryptedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $encryptedElements = new EncryptedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); + $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($EncryptedElements), + strval($encryptedElements), ); } } diff --git a/tests/WSSecurity/XML/sp_200507/EncryptedPartsTest.php b/tests/WSSecurity/XML/sp_200507/EncryptedPartsTest.php index 9b751a3c..8667f493 100644 --- a/tests/WSSecurity/XML/sp_200507/EncryptedPartsTest.php +++ b/tests/WSSecurity/XML/sp_200507/EncryptedPartsTest.php @@ -19,6 +19,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -57,9 +60,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('name'), + [$attr], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); @@ -92,26 +99,31 @@ public function testMarshallingEmptyElement(): void */ public function testMarshallingElementOrdering(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('name'), + [$attr], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $EncryptedParts = new EncryptedParts($body, [$header], [$chunk], [$attr]); - $EncryptedPartsElement = $EncryptedParts->toXML(); + $encryptedParts = new EncryptedParts($body, [$header], [$chunk], [$attr]); + $encryptedPartsElement = $encryptedParts->toXML(); // Test for a Body - $xpCache = XPath::getXPath($EncryptedPartsElement); - $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body', $xpCache); - $this->assertCount(1, $EncryptedPartsElements); + $xpCache = XPath::getXPath($encryptedPartsElement); + $encryptedPartsElements = XPath::xpQuery($encryptedPartsElement, './sp:Body', $xpCache); + $this->assertCount(1, $encryptedPartsElements); // Test ordering of EncryptedParts contents - /** @psalm-var \DOMElement[] $EncryptedPartsElements */ - $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body/following-sibling::*', $xpCache); - $this->assertCount(2, $EncryptedPartsElements); - $this->assertEquals('sp:Header', $EncryptedPartsElements[0]->tagName); - $this->assertEquals('ssp:Chunk', $EncryptedPartsElements[1]->tagName); + /** @var \DOMElement[] $encryptedPartsElements */ + $encryptedPartsElements = XPath::xpQuery($encryptedPartsElement, './sp:Body/following-sibling::*', $xpCache); + + $this->assertCount(2, $encryptedPartsElements); + $this->assertEquals('sp:Header', $encryptedPartsElements[0]->tagName); + $this->assertEquals('ssp:Chunk', $encryptedPartsElements[1]->tagName); } } diff --git a/tests/WSSecurity/XML/sp_200507/EncryptionTokenTest.php b/tests/WSSecurity/XML/sp_200507/EncryptionTokenTest.php index 10d5a66a..826ceb19 100644 --- a/tests/WSSecurity/XML/sp_200507/EncryptionTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/EncryptionTokenTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\EncryptionToken; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/EncryptionToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/EndorsingSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200507/EndorsingSupportingTokensTest.php index b8e4cdd8..23b5b24e 100644 --- a/tests/WSSecurity/XML/sp_200507/EndorsingSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200507/EndorsingSupportingTokensTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\EndorsingSupportingTokens; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/EndorsingSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/HeaderTest.php b/tests/WSSecurity/XML/sp_200507/HeaderTest.php index dde6ec03..acae3993 100644 --- a/tests/WSSecurity/XML/sp_200507/HeaderTest.php +++ b/tests/WSSecurity/XML/sp_200507/HeaderTest.php @@ -14,6 +14,9 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -51,8 +54,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('name'), + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/sp_200507/HttpsTokenTest.php b/tests/WSSecurity/XML/sp_200507/HttpsTokenTest.php index f5987f06..5027a51c 100644 --- a/tests/WSSecurity/XML/sp_200507/HttpsTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/HttpsTokenTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -54,12 +56,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $httpsToken = new HttpsToken(true, [$chunk], [$attr]); + $httpsToken = new HttpsToken(BooleanValue::fromBoolean(true), [$chunk], [$attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($httpsToken), diff --git a/tests/WSSecurity/XML/sp_200507/InitiatorTokenTest.php b/tests/WSSecurity/XML/sp_200507/InitiatorTokenTest.php index 11a9f1d6..e4ea6119 100644 --- a/tests/WSSecurity/XML/sp_200507/InitiatorTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/InitiatorTokenTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\InitiatorToken; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/InitiatorToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/IssuedTokenTest.php b/tests/WSSecurity/XML/sp_200507/IssuedTokenTest.php index 119638e6..652e0967 100644 --- a/tests/WSSecurity/XML/sp_200507/IssuedTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/IssuedTokenTest.php @@ -12,10 +12,10 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractIssuedTokenType; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\IssuedToken; use SimpleSAML\WSSecurity\XML\sp_200507\Issuer; use SimpleSAML\WSSecurity\XML\sp_200507\RequestSecurityTokenTemplate; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\WSSecurity\XML\wsa_200408\Address; use SimpleSAML\WSSecurity\XML\wsa_200408\PortType; use SimpleSAML\WSSecurity\XML\wsa_200408\ReferenceParameters; @@ -26,6 +26,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -36,7 +40,6 @@ */ #[Group('sp')] #[CoversClass(IssuedToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractIssuedTokenType::class)] #[CoversClass(AbstractSpElement::class)] final class IssuedTokenTest extends TestCase @@ -44,6 +47,7 @@ final class IssuedTokenTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -75,23 +79,27 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -101,7 +109,7 @@ public function testMarshallingElementOrdering(): void ); $requestSecurityTokenTemplate = new RequestSecurityTokenTemplate( - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr1], ); @@ -109,7 +117,7 @@ public function testMarshallingElementOrdering(): void $issuedToken = new IssuedToken( $requestSecurityTokenTemplate, $issuer, - IncludeToken::Always, + IncludeTokenValue::fromEnum(IncludeToken::Always), [$chunk], [$attr1], ); @@ -121,8 +129,9 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $issuedTokenElements); // Test ordering of IssuedToken contents - /** @psalm-var \DOMElement[] $issuedTokenElements */ + /** @var \DOMElement[] $issuedTokenElements */ $issuedTokenElements = XPath::xpQuery($issuedTokenElement, './sp:Issuer/following-sibling::*', $xpCache); + $this->assertCount(2, $issuedTokenElements); $this->assertEquals('sp:RequestSecurityTokenTemplate', $issuedTokenElements[0]->tagName); $this->assertEquals('ssp:Chunk', $issuedTokenElements[1]->tagName); @@ -137,23 +146,27 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -163,7 +176,7 @@ public function testMarshalling(): void ); $requestSecurityTokenTemplate = new RequestSecurityTokenTemplate( - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr1], ); @@ -171,7 +184,7 @@ public function testMarshalling(): void $issuedToken = new IssuedToken( $requestSecurityTokenTemplate, $issuer, - IncludeToken::Always, + IncludeTokenValue::fromEnum(IncludeToken::Always), [$chunk], [$attr1], ); diff --git a/tests/WSSecurity/XML/sp_200507/IssuerTest.php b/tests/WSSecurity/XML/sp_200507/IssuerTest.php index deaaa03b..0b030b42 100644 --- a/tests/WSSecurity/XML/sp_200507/IssuerTest.php +++ b/tests/WSSecurity/XML/sp_200507/IssuerTest.php @@ -20,6 +20,10 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -37,6 +41,7 @@ final class IssuerTest extends TestCase { use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -79,20 +84,24 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, diff --git a/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php b/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php index 1f8800a1..7ce9b0a2 100644 --- a/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php @@ -12,11 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; use SimpleSAML\WSSecurity\XML\sp_200507\KerberosToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $KerberosToken = new KerberosToken([$chunk], [$includeToken, $attr]); + $KerberosToken = new KerberosToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($KerberosToken), diff --git a/tests/WSSecurity/XML/sp_200507/LayoutTest.php b/tests/WSSecurity/XML/sp_200507/LayoutTest.php index 011f5751..43357927 100644 --- a/tests/WSSecurity/XML/sp_200507/LayoutTest.php +++ b/tests/WSSecurity/XML/sp_200507/LayoutTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\Layout; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/Layout.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/ProtectionTokenTest.php b/tests/WSSecurity/XML/sp_200507/ProtectionTokenTest.php index be93ed7a..37ce3a80 100644 --- a/tests/WSSecurity/XML/sp_200507/ProtectionTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/ProtectionTokenTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\ProtectionToken; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/ProtectionToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/QNameAssertionTypeTestTrait.php b/tests/WSSecurity/XML/sp_200507/QNameAssertionTypeTestTrait.php index 13503a6c..24f56ec2 100644 --- a/tests/WSSecurity/XML/sp_200507/QNameAssertionTypeTestTrait.php +++ b/tests/WSSecurity/XML/sp_200507/QNameAssertionTypeTestTrait.php @@ -6,6 +6,7 @@ use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; +use SimpleSAML\XMLSchema\Type\StringValue; use function strval; @@ -24,7 +25,7 @@ trait QNameAssertionTypeTestTrait */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $qns = new static::$testedClass([$attr]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/sp_200507/RecipientTokenTest.php b/tests/WSSecurity/XML/sp_200507/RecipientTokenTest.php index 684bb11c..72ede9a7 100644 --- a/tests/WSSecurity/XML/sp_200507/RecipientTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/RecipientTokenTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\RecipientToken; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/RecipientToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/RelTokenTest.php b/tests/WSSecurity/XML/sp_200507/RelTokenTest.php index 16e9dbfc..9902cc11 100644 --- a/tests/WSSecurity/XML/sp_200507/RelTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/RelTokenTest.php @@ -12,11 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; use SimpleSAML\WSSecurity\XML\sp_200507\RelToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $relToken = new RelToken([$chunk], [$includeToken, $attr]); + $relToken = new RelToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($relToken), diff --git a/tests/WSSecurity/XML/sp_200507/RequestSecurityTokenTemplateTest.php b/tests/WSSecurity/XML/sp_200507/RequestSecurityTokenTemplateTest.php index 6e525b43..ae6d498b 100644 --- a/tests/WSSecurity/XML/sp_200507/RequestSecurityTokenTemplateTest.php +++ b/tests/WSSecurity/XML/sp_200507/RequestSecurityTokenTemplateTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,13 +54,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $RequestSecurityTokenTemplateElements = new RequestSecurityTokenTemplate( - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr], ); diff --git a/tests/WSSecurity/XML/sp_200507/RequiredElementsTest.php b/tests/WSSecurity/XML/sp_200507/RequiredElementsTest.php index b9a03dde..2fb15356 100644 --- a/tests/WSSecurity/XML/sp_200507/RequiredElementsTest.php +++ b/tests/WSSecurity/XML/sp_200507/RequiredElementsTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,13 +54,18 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $requiredElements = new RequiredElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $requiredElements = new RequiredElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); $requiredElementsElement = $requiredElements->toXML(); // Test for an XPath @@ -67,7 +74,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $requiredElementsElements); // Test ordering of RequiredElements contents - /** @psalm-var \DOMElement[] $requiredElementsElements */ + /** @var \DOMElement[] $requiredElementsElements */ $requiredElementsElements = XMLXPath::xpQuery( $requiredElementsElement, './sp:XPath/following-sibling::*', @@ -87,13 +94,19 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $requiredElements = new RequiredElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $requiredElements = new RequiredElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); + $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($requiredElements), diff --git a/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php b/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php index 9e7f62e0..1c352dc9 100644 --- a/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php @@ -12,11 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; use SimpleSAML\WSSecurity\XML\sp_200507\SamlToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SamlToken = new SamlToken([$chunk], [$includeToken, $attr]); + $SamlToken = new SamlToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($SamlToken), diff --git a/tests/WSSecurity/XML/sp_200507/SecureConversationTokenTest.php b/tests/WSSecurity/XML/sp_200507/SecureConversationTokenTest.php index edb67ce0..d53ae2b6 100644 --- a/tests/WSSecurity/XML/sp_200507/SecureConversationTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/SecureConversationTokenTest.php @@ -12,9 +12,9 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSecureConversationTokenType; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\Issuer; use SimpleSAML\WSSecurity\XML\sp_200507\SecureConversationToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\WSSecurity\XML\wsa_200408\Address; use SimpleSAML\WSSecurity\XML\wsa_200408\PortType; use SimpleSAML\WSSecurity\XML\wsa_200408\ReferenceParameters; @@ -25,6 +25,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -35,7 +39,6 @@ */ #[Group('sp')] #[CoversClass(SecureConversationToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractSecureConversationTokenType::class)] #[CoversClass(AbstractSpElement::class)] final class SecureConversationTokenTest extends TestCase @@ -43,6 +46,7 @@ final class SecureConversationTokenTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -74,23 +78,27 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -99,7 +107,12 @@ public function testMarshallingElementOrdering(): void [$attr2], ); - $secureConversationToken = new SecureConversationToken($issuer, IncludeToken::Always, [$chunk], [$attr1]); + $secureConversationToken = new SecureConversationToken( + $issuer, + IncludeTokenValue::fromEnum(IncludeToken::Always), + [$chunk], + [$attr1], + ); $secureConversationTokenElement = $secureConversationToken->toXML(); // Test for a Issuer @@ -108,12 +121,13 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $secureConversationTokenElements); // Test ordering of SecureConversationToken contents - /** @psalm-var \DOMElement[] $secureConversationTokenElements */ + /** @var \DOMElement[] $secureConversationTokenElements */ $secureConversationTokenElements = XPath::xpQuery( $secureConversationTokenElement, './sp:Issuer/following-sibling::*', $xpCache, ); + $this->assertCount(1, $secureConversationTokenElements); $this->assertEquals('ssp:Chunk', $secureConversationTokenElements[0]->tagName); } @@ -127,23 +141,27 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -152,7 +170,13 @@ public function testMarshalling(): void [$attr2], ); - $secureConversationToken = new SecureConversationToken($issuer, IncludeToken::Always, [$chunk], [$attr1]); + $secureConversationToken = new SecureConversationToken( + $issuer, + IncludeTokenValue::fromEnum(IncludeToken::Always), + [$chunk], + [$attr1], + ); + $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($secureConversationToken), diff --git a/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php b/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php index f8d92c87..3e02fb2a 100644 --- a/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php @@ -12,11 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; use SimpleSAML\WSSecurity\XML\sp_200507\SecurityContextToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,12 +58,12 @@ public static function setUpBeforeClass(): void public function testMarshallingEmptyElement(): void { $spns = C::NS_SEC_POLICY_11; - $SecurityContextToken = new SecurityContextToken(); + $securityContextToken = new SecurityContextToken(); $this->assertEquals( "", - strval($SecurityContextToken), + strval($securityContextToken), ); - $this->assertTrue($SecurityContextToken->isEmptyElement()); + $this->assertTrue($securityContextToken->isEmptyElement()); } @@ -70,16 +72,16 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SecurityContextToken = new SecurityContextToken([$chunk], [$includeToken, $attr]); + $securityContextToken = new SecurityContextToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($SecurityContextToken), + strval($securityContextToken), ); } } diff --git a/tests/WSSecurity/XML/sp_200507/SignatureTokenTest.php b/tests/WSSecurity/XML/sp_200507/SignatureTokenTest.php index da82c972..40f215db 100644 --- a/tests/WSSecurity/XML/sp_200507/SignatureTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/SignatureTokenTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\SignatureToken; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/SignatureToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/SignedElementsTest.php b/tests/WSSecurity/XML/sp_200507/SignedElementsTest.php index 74e2823f..45b27304 100644 --- a/tests/WSSecurity/XML/sp_200507/SignedElementsTest.php +++ b/tests/WSSecurity/XML/sp_200507/SignedElementsTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,13 +54,18 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SignedElements = new SignedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $SignedElements = new SignedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); $SignedElementsElement = $SignedElements->toXML(); // Test for an XPath @@ -67,15 +74,15 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $SignedElementsElements); // Test ordering of SignedElements contents - /** @psalm-var \DOMElement[] $SignedElementsElements */ - $SignedElementsElements = XMLXPath::xpQuery( + /** @var \DOMElement[] $signedElementsElements */ + $signedElementsElements = XMLXPath::xpQuery( $SignedElementsElement, './sp:XPath/following-sibling::*', $xpCache, ); - $this->assertCount(1, $SignedElementsElements); - $this->assertEquals('ssp:Chunk', $SignedElementsElements[0]->tagName); + $this->assertCount(1, $signedElementsElements); + $this->assertEquals('ssp:Chunk', $signedElementsElements[0]->tagName); } @@ -87,16 +94,22 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SignedElements = new SignedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $signedElements = new SignedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); + $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($SignedElements), + strval($signedElements), ); } } diff --git a/tests/WSSecurity/XML/sp_200507/SignedEndorsingSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200507/SignedEndorsingSupportingTokensTest.php index 4d0b3fb5..c6c7f34a 100644 --- a/tests/WSSecurity/XML/sp_200507/SignedEndorsingSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200507/SignedEndorsingSupportingTokensTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\SignedEndorsingSupportingTokens; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/SignedEndorsingSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/SignedPartsTest.php b/tests/WSSecurity/XML/sp_200507/SignedPartsTest.php index 3aa6eb12..9cfd5017 100644 --- a/tests/WSSecurity/XML/sp_200507/SignedPartsTest.php +++ b/tests/WSSecurity/XML/sp_200507/SignedPartsTest.php @@ -19,6 +19,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -72,9 +75,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); @@ -91,26 +98,31 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SignedParts = new SignedParts($body, [$header], [$chunk], [$attr]); - $SignedPartsElement = $SignedParts->toXML(); + $signedParts = new SignedParts($body, [$header], [$chunk], [$attr]); + $signedPartsElement = $signedParts->toXML(); // Test for a Body - $xpCache = XPath::getXPath($SignedPartsElement); - $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body', $xpCache); - $this->assertCount(1, $SignedPartsElements); + $xpCache = XPath::getXPath($signedPartsElement); + $signedPartsElements = XPath::xpQuery($signedPartsElement, './sp:Body', $xpCache); + $this->assertCount(1, $signedPartsElements); // Test ordering of SignedParts contents - /** @psalm-var \DOMElement[] $SignedPartsElements */ - $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body/following-sibling::*', $xpCache); - $this->assertCount(2, $SignedPartsElements); - $this->assertEquals('sp:Header', $SignedPartsElements[0]->tagName); - $this->assertEquals('ssp:Chunk', $SignedPartsElements[1]->tagName); + /** @var \DOMElement[] $signedPartsElements */ + $signedPartsElements = XPath::xpQuery($signedPartsElement, './sp:Body/following-sibling::*', $xpCache); + + $this->assertCount(2, $signedPartsElements); + $this->assertEquals('sp:Header', $signedPartsElements[0]->tagName); + $this->assertEquals('ssp:Chunk', $signedPartsElements[1]->tagName); } } diff --git a/tests/WSSecurity/XML/sp_200507/SignedSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200507/SignedSupportingTokensTest.php index 9d53bb74..3abcb185 100644 --- a/tests/WSSecurity/XML/sp_200507/SignedSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200507/SignedSupportingTokensTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\SignedSupportingTokens; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/SignedSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/SpnegoContextTokenTest.php b/tests/WSSecurity/XML/sp_200507/SpnegoContextTokenTest.php index ca7eba6a..7bb471d4 100644 --- a/tests/WSSecurity/XML/sp_200507/SpnegoContextTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/SpnegoContextTokenTest.php @@ -12,9 +12,9 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpnegoContextTokenType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\Issuer; use SimpleSAML\WSSecurity\XML\sp_200507\SpnegoContextToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\WSSecurity\XML\wsa_200408\Address; use SimpleSAML\WSSecurity\XML\wsa_200408\PortType; use SimpleSAML\WSSecurity\XML\wsa_200408\ReferenceParameters; @@ -25,6 +25,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -35,7 +39,6 @@ */ #[Group('sp')] #[CoversClass(SpnegoContextToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractSpnegoContextTokenType::class)] #[CoversClass(AbstractSpElement::class)] final class SpnegoContextTokenTest extends TestCase @@ -43,6 +46,7 @@ final class SpnegoContextTokenTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -74,23 +78,27 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -99,7 +107,12 @@ public function testMarshallingElementOrdering(): void [$attr2], ); - $spnegoContextToken = new SpnegoContextToken($issuer, IncludeToken::Always, [$chunk], [$attr1]); + $spnegoContextToken = new SpnegoContextToken( + $issuer, + IncludeTokenValue::fromEnum(IncludeToken::Always), + [$chunk], + [$attr1], + ); $spnegoContextTokenElement = $spnegoContextToken->toXML(); // Test for a Issuer @@ -108,12 +121,13 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $spnegoContextTokenElements); // Test ordering of SpnegoContextToken contents - /** @psalm-var \DOMElement[] $spnegoContextTokenElements */ + /** @var \DOMElement[] $spnegoContextTokenElements */ $spnegoContextTokenElements = XPath::xpQuery( $spnegoContextTokenElement, './sp:Issuer/following-sibling::*', $xpCache, ); + $this->assertCount(1, $spnegoContextTokenElements); $this->assertEquals('ssp:Chunk', $spnegoContextTokenElements[0]->tagName); } @@ -127,23 +141,27 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -152,7 +170,13 @@ public function testMarshalling(): void [$attr2], ); - $spnegoContextToken = new SpnegoContextToken($issuer, IncludeToken::Always, [$chunk], [$attr1]); + $spnegoContextToken = new SpnegoContextToken( + $issuer, + IncludeTokenValue::fromEnum(IncludeToken::Always), + [$chunk], + [$attr1], + ); + $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($spnegoContextToken), diff --git a/tests/WSSecurity/XML/sp_200507/SupportingTokensTest.php b/tests/WSSecurity/XML/sp_200507/SupportingTokensTest.php index 48771a7b..68fe218a 100644 --- a/tests/WSSecurity/XML/sp_200507/SupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200507/SupportingTokensTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\SupportingTokens; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/SupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/SymmetricBindingTest.php b/tests/WSSecurity/XML/sp_200507/SymmetricBindingTest.php index 687e68b8..05b63607 100644 --- a/tests/WSSecurity/XML/sp_200507/SymmetricBindingTest.php +++ b/tests/WSSecurity/XML/sp_200507/SymmetricBindingTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\SymmetricBinding; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/SymmetricBinding.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/TransportBindingTest.php b/tests/WSSecurity/XML/sp_200507/TransportBindingTest.php index 25608fde..86ff4b11 100644 --- a/tests/WSSecurity/XML/sp_200507/TransportBindingTest.php +++ b/tests/WSSecurity/XML/sp_200507/TransportBindingTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\TransportBinding; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/TransportBinding.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/TransportTokenTest.php b/tests/WSSecurity/XML/sp_200507/TransportTokenTest.php index 7e9a3279..5ab6bce4 100644 --- a/tests/WSSecurity/XML/sp_200507/TransportTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/TransportTokenTest.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\TransportToken; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/TransportToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/Trust10Test.php b/tests/WSSecurity/XML/sp_200507/Trust10Test.php index eaecd4d1..f33810ef 100644 --- a/tests/WSSecurity/XML/sp_200507/Trust10Test.php +++ b/tests/WSSecurity/XML/sp_200507/Trust10Test.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\Trust10; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/Trust10.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php b/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php index 531649d7..38824407 100644 --- a/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php @@ -11,12 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\WSSecurity\XML\sp_200507\UsernameToken; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $UsernameToken = new UsernameToken([$chunk], [$includeToken, $attr]); + $UsernameToken = new UsernameToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($UsernameToken), diff --git a/tests/WSSecurity/XML/sp_200507/Wss10Test.php b/tests/WSSecurity/XML/sp_200507/Wss10Test.php index 3108c3dd..d18a9400 100644 --- a/tests/WSSecurity/XML/sp_200507/Wss10Test.php +++ b/tests/WSSecurity/XML/sp_200507/Wss10Test.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\Wss10; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/Wss10.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/Wss11Test.php b/tests/WSSecurity/XML/sp_200507/Wss11Test.php index 5f94630c..4942c0ee 100644 --- a/tests/WSSecurity/XML/sp_200507/Wss11Test.php +++ b/tests/WSSecurity/XML/sp_200507/Wss11Test.php @@ -13,11 +13,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\Wss11; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -60,7 +63,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200507/Wss11.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -70,7 +73,12 @@ public static function setUpBeforeClass(): void 'Other', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - self::$policy = new Policy('phpunit', $Id, [new ExactlyOne()], [self::$other], [self::$attr]); + self::$policy = new Policy( + [new ExactlyOne()], + [self::$other], + AnyURIValue::fromString('phpunit'), + IDValue::fromString('MyId'), + [self::$attr], + ); } } diff --git a/tests/WSSecurity/XML/sp_200507/X509TokenTest.php b/tests/WSSecurity/XML/sp_200507/X509TokenTest.php index aac4c77d..7ec0aa84 100644 --- a/tests/WSSecurity/XML/sp_200507/X509TokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/X509TokenTest.php @@ -11,12 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; +use SimpleSAML\WSSecurity\XML\sp_200507\Type\IncludeTokenValue; use SimpleSAML\WSSecurity\XML\sp_200507\X509Token; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $X509Token = new X509Token([$chunk], [$includeToken, $attr]); + $X509Token = new X509Token([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($X509Token), diff --git a/tests/WSSecurity/XML/sp_200507/XPathTest.php b/tests/WSSecurity/XML/sp_200507/XPathTest.php index 21d4ff5d..92b1e30f 100644 --- a/tests/WSSecurity/XML/sp_200507/XPathTest.php +++ b/tests/WSSecurity/XML/sp_200507/XPathTest.php @@ -11,6 +11,7 @@ use SimpleSAML\WSSecurity\XML\sp_200507\XPath; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -48,7 +49,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/sp_200702/AlgorithmSuiteTest.php b/tests/WSSecurity/XML/sp_200702/AlgorithmSuiteTest.php index 2233b8fe..d7174c43 100644 --- a/tests/WSSecurity/XML/sp_200702/AlgorithmSuiteTest.php +++ b/tests/WSSecurity/XML/sp_200702/AlgorithmSuiteTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class AlgorithmSuiteTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/AlgorithmSuite.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/AsymmetricBindingTest.php b/tests/WSSecurity/XML/sp_200702/AsymmetricBindingTest.php index c0589887..b2a24c7d 100644 --- a/tests/WSSecurity/XML/sp_200702/AsymmetricBindingTest.php +++ b/tests/WSSecurity/XML/sp_200702/AsymmetricBindingTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -34,12 +35,14 @@ final class AsymmetricBindingTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \SimpleSAML\XML\Chunk $chunk */ protected static Chunk $chunk; /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -50,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/AsymmetricBinding.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/BootstrapPolicyTest.php b/tests/WSSecurity/XML/sp_200702/BootstrapPolicyTest.php index d74b6f66..5e6cf437 100644 --- a/tests/WSSecurity/XML/sp_200702/BootstrapPolicyTest.php +++ b/tests/WSSecurity/XML/sp_200702/BootstrapPolicyTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class BootstrapPolicyTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/BootstrapPolicy.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/ContentEncryptedElementsTest.php b/tests/WSSecurity/XML/sp_200702/ContentEncryptedElementsTest.php index ece573ed..b67a7950 100644 --- a/tests/WSSecurity/XML/sp_200702/ContentEncryptedElementsTest.php +++ b/tests/WSSecurity/XML/sp_200702/ContentEncryptedElementsTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,15 +54,15 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $contentEncryptedElements = new ContentEncryptedElements( [$xpath], - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr], ); @@ -76,12 +78,13 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $contentEncryptedElementsElements); // Test ordering of ContentEncryptedElements contents - /** @psalm-var \DOMElement[] $contentEncryptedElementsElements */ + /** @var \DOMElement[] $contentEncryptedElementsElements */ $contentEncryptedElementsElements = XMLXPath::xpQuery( $contentEncryptedElementsElement, './sp:XPath/following-sibling::*', $xpCache, ); + $this->assertCount(1, $contentEncryptedElementsElements); $this->assertEquals('ssp:Chunk', $contentEncryptedElementsElements[0]->tagName); } @@ -95,15 +98,15 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $contentEncryptedElements = new ContentEncryptedElements( [$xpath], - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr], ); diff --git a/tests/WSSecurity/XML/sp_200702/EncryptedElementsTest.php b/tests/WSSecurity/XML/sp_200702/EncryptedElementsTest.php index 6c52ff06..0c9ae08a 100644 --- a/tests/WSSecurity/XML/sp_200702/EncryptedElementsTest.php +++ b/tests/WSSecurity/XML/sp_200702/EncryptedElementsTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,30 +54,35 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $EncryptedElements = new EncryptedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); - $EncryptedElementsElement = $EncryptedElements->toXML(); + $encryptedElements = new EncryptedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); + $encryptedElementsElement = $encryptedElements->toXML(); // Test for an XPath - $xpCache = XMLXPath::getXPath($EncryptedElementsElement); - $EncryptedElementsElements = XMLXPath::xpQuery($EncryptedElementsElement, './sp:XPath', $xpCache); - $this->assertCount(1, $EncryptedElementsElements); + $xpCache = XMLXPath::getXPath($encryptedElementsElement); + $encryptedElementsElements = XMLXPath::xpQuery($encryptedElementsElement, './sp:XPath', $xpCache); + $this->assertCount(1, $encryptedElementsElements); // Test ordering of EncryptedElements contents - /** @psalm-var \DOMElement[] $EncryptedElementsElements */ - $EncryptedElementsElements = XMLXPath::xpQuery( - $EncryptedElementsElement, + /** @var \DOMElement[] $encryptedElementsElements */ + $encryptedElementsElements = XMLXPath::xpQuery( + $encryptedElementsElement, './sp:XPath/following-sibling::*', $xpCache, ); - $this->assertCount(1, $EncryptedElementsElements); - $this->assertEquals('ssp:Chunk', $EncryptedElementsElements[0]->tagName); + $this->assertCount(1, $encryptedElementsElements); + $this->assertEquals('ssp:Chunk', $encryptedElementsElements[0]->tagName); } @@ -87,16 +94,21 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $EncryptedElements = new EncryptedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $encryptedElements = new EncryptedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($EncryptedElements), + strval($encryptedElements), ); } } diff --git a/tests/WSSecurity/XML/sp_200702/EncryptedPartsTest.php b/tests/WSSecurity/XML/sp_200702/EncryptedPartsTest.php index 2f8d0e81..a8509cc3 100644 --- a/tests/WSSecurity/XML/sp_200702/EncryptedPartsTest.php +++ b/tests/WSSecurity/XML/sp_200702/EncryptedPartsTest.php @@ -20,6 +20,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -58,9 +61,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $attachments = new Attachments(); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', @@ -94,28 +101,32 @@ public function testMarshallingEmptyElement(): void */ public function testMarshallingElementOrdering(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $attachments = new Attachments(); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $EncryptedParts = new EncryptedParts($body, [$header], $attachments, [$chunk], [$attr]); - $EncryptedPartsElement = $EncryptedParts->toXML(); + $encryptedParts = new EncryptedParts($body, [$header], $attachments, [$chunk], [$attr]); + $encryptedPartsElement = $encryptedParts->toXML(); // Test for a Body - $xpCache = XPath::getXPath($EncryptedPartsElement); - $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body', $xpCache); - $this->assertCount(1, $EncryptedPartsElements); + $xpCache = XPath::getXPath($encryptedPartsElement); + $encryptedPartsElements = XPath::xpQuery($encryptedPartsElement, './sp:Body', $xpCache); + $this->assertCount(1, $encryptedPartsElements); // Test ordering of EncryptedParts contents - /** @psalm-var \DOMElement[] $EncryptedPartsElements */ - $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body/following-sibling::*', $xpCache); - $this->assertCount(3, $EncryptedPartsElements); - $this->assertEquals('sp:Header', $EncryptedPartsElements[0]->tagName); - $this->assertEquals('sp:Attachments', $EncryptedPartsElements[1]->tagName); - $this->assertEquals('ssp:Chunk', $EncryptedPartsElements[2]->tagName); + /** @var \DOMElement[] $encryptedPartsElements */ + $encryptedPartsElements = XPath::xpQuery($encryptedPartsElement, './sp:Body/following-sibling::*', $xpCache); + $this->assertCount(3, $encryptedPartsElements); + $this->assertEquals('sp:Header', $encryptedPartsElements[0]->tagName); + $this->assertEquals('sp:Attachments', $encryptedPartsElements[1]->tagName); + $this->assertEquals('ssp:Chunk', $encryptedPartsElements[2]->tagName); } } diff --git a/tests/WSSecurity/XML/sp_200702/EncryptedSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/EncryptedSupportingTokensTest.php index 882b8c38..42131dd0 100644 --- a/tests/WSSecurity/XML/sp_200702/EncryptedSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/EncryptedSupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class EncryptedSupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/EncryptedSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/EncryptionTokenTest.php b/tests/WSSecurity/XML/sp_200702/EncryptionTokenTest.php index d43f43f6..bc79d36c 100644 --- a/tests/WSSecurity/XML/sp_200702/EncryptionTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/EncryptionTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class EncryptionTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/EncryptionToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/EndorsingEncryptedSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/EndorsingEncryptedSupportingTokensTest.php index 6163a376..ab2eab98 100644 --- a/tests/WSSecurity/XML/sp_200702/EndorsingEncryptedSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/EndorsingEncryptedSupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class EndorsingEncryptedSupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/EndorsingEncryptedSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/EndorsingSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/EndorsingSupportingTokensTest.php index 2f52caea..6188944b 100644 --- a/tests/WSSecurity/XML/sp_200702/EndorsingSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/EndorsingSupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class EndorsingSupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/EndorsingSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/HeaderTest.php b/tests/WSSecurity/XML/sp_200702/HeaderTest.php index 9be4feaf..12114cfc 100644 --- a/tests/WSSecurity/XML/sp_200702/HeaderTest.php +++ b/tests/WSSecurity/XML/sp_200702/HeaderTest.php @@ -14,6 +14,9 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -51,8 +54,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/sp_200702/HttpsTokenTest.php b/tests/WSSecurity/XML/sp_200702/HttpsTokenTest.php index 527cf9e2..a6efba75 100644 --- a/tests/WSSecurity/XML/sp_200702/HttpsTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/HttpsTokenTest.php @@ -12,12 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\HttpsToken; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('sp')] #[CoversClass(HttpsToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class HttpsTokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(null, null, 'IncludeToken', IncludeToken::Always->value); - $httpsToken = new HttpsToken([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $httpsToken = new HttpsToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($httpsToken), diff --git a/tests/WSSecurity/XML/sp_200702/InitiatorEncryptionTokenTest.php b/tests/WSSecurity/XML/sp_200702/InitiatorEncryptionTokenTest.php index 6c6aea1f..0f05b6b7 100644 --- a/tests/WSSecurity/XML/sp_200702/InitiatorEncryptionTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/InitiatorEncryptionTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class InitiatorEncryptionTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/InitiatorEncryptionToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/InitiatorSignatureTokenTest.php b/tests/WSSecurity/XML/sp_200702/InitiatorSignatureTokenTest.php index 36877370..36965943 100644 --- a/tests/WSSecurity/XML/sp_200702/InitiatorSignatureTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/InitiatorSignatureTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class InitiatorSignatureTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/InitiatorSignatureToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/InitiatorTokenTest.php b/tests/WSSecurity/XML/sp_200702/InitiatorTokenTest.php index 63b04d16..28ce314d 100644 --- a/tests/WSSecurity/XML/sp_200702/InitiatorTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/InitiatorTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class InitiatorTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/InitiatorToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/IssuedTokenTest.php b/tests/WSSecurity/XML/sp_200702/IssuedTokenTest.php index c9868621..e21788d7 100644 --- a/tests/WSSecurity/XML/sp_200702/IssuedTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/IssuedTokenTest.php @@ -15,11 +15,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\IssuedToken; use SimpleSAML\WSSecurity\XML\sp_200702\IssuerName; use SimpleSAML\WSSecurity\XML\sp_200702\RequestSecurityTokenTemplate; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -54,19 +57,24 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $issuer = new IssuerName('urn:x-simplesamlphp:issuer'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $issuer = new IssuerName(AnyURIValue::fromString('urn:x-simplesamlphp:issuer')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $requestSecurityTokenTemplate = new RequestSecurityTokenTemplate( - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr], ); - $issuedToken = new IssuedToken($requestSecurityTokenTemplate, $issuer, [$chunk], [$includeToken, $attr]); + $issuedToken = new IssuedToken( + $requestSecurityTokenTemplate, + $issuer, + [$chunk], + [$includeToken->toAttribute(), $attr], + ); $issuedTokenElement = $issuedToken->toXML(); // Test for a Issuer @@ -75,8 +83,9 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $issuedTokenElements); // Test ordering of IssuedToken contents - /** @psalm-var \DOMElement[] $issuedTokenElements */ + /** @var \DOMElement[] $issuedTokenElements */ $issuedTokenElements = XPath::xpQuery($issuedTokenElement, './sp:IssuerName/following-sibling::*', $xpCache); + $this->assertCount(2, $issuedTokenElements); $this->assertEquals('sp:RequestSecurityTokenTemplate', $issuedTokenElements[0]->tagName); $this->assertEquals('ssp:Chunk', $issuedTokenElements[1]->tagName); @@ -91,20 +100,25 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $issuer = new IssuerName('urn:x-simplesamlphp:issuer'); + $issuer = new IssuerName(AnyURIValue::fromString('urn:x-simplesamlphp:issuer')); $requestSecurityTokenTemplate = new RequestSecurityTokenTemplate( - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr], ); - $issuedToken = new IssuedToken($requestSecurityTokenTemplate, $issuer, [$chunk], [$includeToken, $attr]); + $issuedToken = new IssuedToken( + $requestSecurityTokenTemplate, + $issuer, + [$chunk], + [$includeToken->toAttribute(), $attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($issuedToken), diff --git a/tests/WSSecurity/XML/sp_200702/IssuerNameTest.php b/tests/WSSecurity/XML/sp_200702/IssuerNameTest.php index efdec383..8f5f1783 100644 --- a/tests/WSSecurity/XML/sp_200702/IssuerNameTest.php +++ b/tests/WSSecurity/XML/sp_200702/IssuerNameTest.php @@ -11,6 +11,7 @@ use SimpleSAML\WSSecurity\XML\sp_200702\IssuerName; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; use function strval; @@ -48,7 +49,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $issuerName = new IssuerName('urn:x-simplesamlphp:namespace'); + $issuerName = new IssuerName(AnyURIValue::fromString('urn:x-simplesamlphp:namespace')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/sp_200702/IssuerTest.php b/tests/WSSecurity/XML/sp_200702/IssuerTest.php index 20ee9238..7e142d97 100644 --- a/tests/WSSecurity/XML/sp_200702/IssuerTest.php +++ b/tests/WSSecurity/XML/sp_200702/IssuerTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -35,6 +37,7 @@ final class IssuerTest extends TestCase { use SerializableElementTestTrait; + /** @var \DOMElement $referenceParametersContent */ protected static DOMElement $referenceParametersContent; @@ -77,17 +80,17 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/sp_200702/KerberosTokenTest.php b/tests/WSSecurity/XML/sp_200702/KerberosTokenTest.php index f205fc62..1a551268 100644 --- a/tests/WSSecurity/XML/sp_200702/KerberosTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/KerberosTokenTest.php @@ -11,13 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200702\KerberosToken; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('sp')] #[CoversClass(KerberosToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class KerberosTokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(null, null, 'IncludeToken', IncludeToken::Always->value); - $kerberosToken = new KerberosToken([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $kerberosToken = new KerberosToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($kerberosToken), diff --git a/tests/WSSecurity/XML/sp_200702/KeyValueTokenTest.php b/tests/WSSecurity/XML/sp_200702/KeyValueTokenTest.php index ca7d41cd..4d998fc5 100644 --- a/tests/WSSecurity/XML/sp_200702/KeyValueTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/KeyValueTokenTest.php @@ -12,11 +12,13 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; use SimpleSAML\WSSecurity\XML\sp_200702\KeyValueToken; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -70,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $keyValueToken = new KeyValueToken([$chunk], [$includeToken, $attr]); + $keyValueToken = new KeyValueToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($keyValueToken), diff --git a/tests/WSSecurity/XML/sp_200702/LayoutTest.php b/tests/WSSecurity/XML/sp_200702/LayoutTest.php index 1b888364..1b748bda 100644 --- a/tests/WSSecurity/XML/sp_200702/LayoutTest.php +++ b/tests/WSSecurity/XML/sp_200702/LayoutTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class LayoutTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/Layout.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/NestedPolicyTypeTestTrait.php b/tests/WSSecurity/XML/sp_200702/NestedPolicyTypeTestTrait.php index a4b7ea38..16d20644 100644 --- a/tests/WSSecurity/XML/sp_200702/NestedPolicyTypeTestTrait.php +++ b/tests/WSSecurity/XML/sp_200702/NestedPolicyTypeTestTrait.php @@ -40,8 +40,8 @@ public function testMarshalling(): void public function testMarshallingWithoutNSAttr(): void { $xml = << - Some +<%s:%s xmlns:%s="%s" xmlns:ssp="urn:x-simplesamlphp:namespace"> + Some XML; $localName = static::$testedClass::getLocalName(); @@ -108,8 +108,8 @@ public function testMarshallingEmptyElement(): void public function testUnmarshallingWithoutNSAttr(): void { $xml = << - Some +<%s:%s xmlns:%s="%s" xmlns:ssp="urn:x-simplesamlphp:namespace"> + Some XML; $localName = static::$testedClass::getLocalName(); diff --git a/tests/WSSecurity/XML/sp_200702/ProtectionTokenTest.php b/tests/WSSecurity/XML/sp_200702/ProtectionTokenTest.php index 773f307d..cf3729a9 100644 --- a/tests/WSSecurity/XML/sp_200702/ProtectionTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/ProtectionTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class ProtectionTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/ProtectionToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/QNameAssertionTypeTestTrait.php b/tests/WSSecurity/XML/sp_200702/QNameAssertionTypeTestTrait.php index 1f397bb5..2e245eb2 100644 --- a/tests/WSSecurity/XML/sp_200702/QNameAssertionTypeTestTrait.php +++ b/tests/WSSecurity/XML/sp_200702/QNameAssertionTypeTestTrait.php @@ -6,6 +6,7 @@ use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; +use SimpleSAML\XMLSchema\Type\StringValue; use function strval; @@ -24,7 +25,7 @@ trait QNameAssertionTypeTestTrait */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $qns = new static::$testedClass([$attr]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/sp_200702/RecipientEncryptionTokenTest.php b/tests/WSSecurity/XML/sp_200702/RecipientEncryptionTokenTest.php index 0a9fe64e..aee9f7fd 100644 --- a/tests/WSSecurity/XML/sp_200702/RecipientEncryptionTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/RecipientEncryptionTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class RecipientEncryptionTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/RecipientEncryptionToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/RecipientSignatureTokenTest.php b/tests/WSSecurity/XML/sp_200702/RecipientSignatureTokenTest.php index 0ec3e960..a71a69bd 100644 --- a/tests/WSSecurity/XML/sp_200702/RecipientSignatureTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/RecipientSignatureTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class RecipientSignatureTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/RecipientSignatureToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/RecipientTokenTest.php b/tests/WSSecurity/XML/sp_200702/RecipientTokenTest.php index 701c18d6..7f5c1a89 100644 --- a/tests/WSSecurity/XML/sp_200702/RecipientTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/RecipientTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class RecipientTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/RecipientToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/RelTokenTest.php b/tests/WSSecurity/XML/sp_200702/RelTokenTest.php index b4a04ff0..dff94fbd 100644 --- a/tests/WSSecurity/XML/sp_200702/RelTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/RelTokenTest.php @@ -11,13 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200702\RelToken; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('sp')] #[CoversClass(RelToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class RelTokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(null, null, 'IncludeToken', IncludeToken::Always->value); - $relToken = new RelToken([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $relToken = new RelToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($relToken), diff --git a/tests/WSSecurity/XML/sp_200702/RequestSecurityTokenTemplateTest.php b/tests/WSSecurity/XML/sp_200702/RequestSecurityTokenTemplateTest.php index d44a1a5f..1a189ea9 100644 --- a/tests/WSSecurity/XML/sp_200702/RequestSecurityTokenTemplateTest.php +++ b/tests/WSSecurity/XML/sp_200702/RequestSecurityTokenTemplateTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,13 +54,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); $RequestSecurityTokenTemplateElements = new RequestSecurityTokenTemplate( - 'urn:x-simplesamlphp:version', + AnyURIValue::fromString('urn:x-simplesamlphp:version'), [$chunk], [$attr], ); diff --git a/tests/WSSecurity/XML/sp_200702/RequiredElementsTest.php b/tests/WSSecurity/XML/sp_200702/RequiredElementsTest.php index f9938855..9a765e00 100644 --- a/tests/WSSecurity/XML/sp_200702/RequiredElementsTest.php +++ b/tests/WSSecurity/XML/sp_200702/RequiredElementsTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,13 +54,18 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $requiredElements = new RequiredElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $requiredElements = new RequiredElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); $requiredElementsElement = $requiredElements->toXML(); // Test for an XPath @@ -67,7 +74,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $requiredElementsElements); // Test ordering of RequiredElements contents - /** @psalm-var \DOMElement[] $requiredElementsElements */ + /** @var \DOMElement[] $requiredElementsElements */ $requiredElementsElements = XMLXPath::xpQuery( $requiredElementsElement, './sp:XPath/following-sibling::*', @@ -87,13 +94,18 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $requiredElements = new RequiredElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $requiredElements = new RequiredElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($requiredElements), diff --git a/tests/WSSecurity/XML/sp_200702/RequiredPartsTest.php b/tests/WSSecurity/XML/sp_200702/RequiredPartsTest.php index 0f66a36a..42a5db1a 100644 --- a/tests/WSSecurity/XML/sp_200702/RequiredPartsTest.php +++ b/tests/WSSecurity/XML/sp_200702/RequiredPartsTest.php @@ -18,6 +18,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -67,25 +70,30 @@ public function testMarshallingEmptyElement(): void */ public function testMarshallingElementOrdering(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $RequiredParts = new RequiredParts([$header], [$chunk], [$attr]); - $RequiredPartsElement = $RequiredParts->toXML(); + $requiredParts = new RequiredParts([$header], [$chunk], [$attr]); + $requiredPartsElement = $requiredParts->toXML(); // Test for a Header - $xpCache = XPath::getXPath($RequiredPartsElement); - $RequiredPartsElements = XPath::xpQuery($RequiredPartsElement, './sp:Header', $xpCache); - $this->assertCount(1, $RequiredPartsElements); + $xpCache = XPath::getXPath($requiredPartsElement); + $requiredPartsElements = XPath::xpQuery($requiredPartsElement, './sp:Header', $xpCache); + $this->assertCount(1, $requiredPartsElements); // Test ordering of RequiredParts contents - /** @psalm-var \DOMElement[] $RequiredPartsElements */ - $RequiredPartsElements = XPath::xpQuery($RequiredPartsElement, './sp:Header/following-sibling::*', $xpCache); - $this->assertCount(1, $RequiredPartsElements); - $this->assertEquals('ssp:Chunk', $RequiredPartsElements[0]->tagName); + /** @var \DOMElement[] $requiredPartsElements */ + $requiredPartsElements = XPath::xpQuery($requiredPartsElement, './sp:Header/following-sibling::*', $xpCache); + + $this->assertCount(1, $requiredPartsElements); + $this->assertEquals('ssp:Chunk', $requiredPartsElements[0]->tagName); } @@ -97,16 +105,20 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp}name'), + [$attr], + ); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $RequiredParts = new RequiredParts([$header], [$chunk], [$attr]); + $requiredParts = new RequiredParts([$header], [$chunk], [$attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($RequiredParts), + strval($requiredParts), ); } } diff --git a/tests/WSSecurity/XML/sp_200702/SamlTokenTest.php b/tests/WSSecurity/XML/sp_200702/SamlTokenTest.php index 1527cb32..2ff00b0e 100644 --- a/tests/WSSecurity/XML/sp_200702/SamlTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/SamlTokenTest.php @@ -11,13 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200702\SamlToken; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('sp')] #[CoversClass(SamlToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class SamlTokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(null, null, 'IncludeToken', IncludeToken::Always->value); - $samlToken = new SamlToken([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $samlToken = new SamlToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($samlToken), diff --git a/tests/WSSecurity/XML/sp_200702/SecureConversationTokenTest.php b/tests/WSSecurity/XML/sp_200702/SecureConversationTokenTest.php index 5e3befc9..8f2e4dfd 100644 --- a/tests/WSSecurity/XML/sp_200702/SecureConversationTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/SecureConversationTokenTest.php @@ -14,11 +14,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; use SimpleSAML\WSSecurity\XML\sp_200702\IssuerName; use SimpleSAML\WSSecurity\XML\sp_200702\SecureConversationToken; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,14 +56,18 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $issuer = new IssuerName('urn:x-simplesamlphp:issuer'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $issuer = new IssuerName(AnyURIValue::fromString('urn:x-simplesamlphp:issuer')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $secureConversationToken = new SecureConversationToken($issuer, [$chunk], [$includeToken, $attr]); + $secureConversationToken = new SecureConversationToken( + $issuer, + [$chunk], + [$includeToken->toAttribute(), $attr], + ); $secureConversationTokenElement = $secureConversationToken->toXML(); // Test for a IssuerName @@ -69,12 +76,13 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $secureConversationTokenElements); // Test ordering of SecureConversationToken contents - /** @psalm-var \DOMElement[] $secureConversationTokenElements */ + /** @var \DOMElement[] $secureConversationTokenElements */ $secureConversationTokenElements = XPath::xpQuery( $secureConversationTokenElement, './sp:IssuerName/following-sibling::*', $xpCache, ); + $this->assertCount(1, $secureConversationTokenElements); $this->assertEquals('ssp:Chunk', $secureConversationTokenElements[0]->tagName); } @@ -88,15 +96,20 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $issuer = new IssuerName('urn:x-simplesamlphp:issuer'); + $issuer = new IssuerName(AnyURIValue::fromString('urn:x-simplesamlphp:issuer')); + + $secureConversationToken = new SecureConversationToken( + $issuer, + [$chunk], + [$includeToken->toAttribute(), $attr], + ); - $secureConversationToken = new SecureConversationToken($issuer, [$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($secureConversationToken), diff --git a/tests/WSSecurity/XML/sp_200702/SecurityContextTokenTest.php b/tests/WSSecurity/XML/sp_200702/SecurityContextTokenTest.php index 9493e673..68d2cb7c 100644 --- a/tests/WSSecurity/XML/sp_200702/SecurityContextTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/SecurityContextTokenTest.php @@ -11,13 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200702\SecurityContextToken; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('sp')] #[CoversClass(SecurityContextToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class SecurityContextTokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(null, null, 'IncludeToken', IncludeToken::Always->value); - $securityContextToken = new SecurityContextToken([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $securityContextToken = new SecurityContextToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($securityContextToken), diff --git a/tests/WSSecurity/XML/sp_200702/SignatureTokenTest.php b/tests/WSSecurity/XML/sp_200702/SignatureTokenTest.php index 90b8a1b1..9832568e 100644 --- a/tests/WSSecurity/XML/sp_200702/SignatureTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/SignatureTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class SignatureTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/SignatureToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/SignedElementsTest.php b/tests/WSSecurity/XML/sp_200702/SignedElementsTest.php index 4e18349d..1b7d7218 100644 --- a/tests/WSSecurity/XML/sp_200702/SignedElementsTest.php +++ b/tests/WSSecurity/XML/sp_200702/SignedElementsTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -52,30 +54,35 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SignedElements = new SignedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); - $SignedElementsElement = $SignedElements->toXML(); + $signedElements = new SignedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); + $signedElementsElement = $signedElements->toXML(); // Test for an XPath - $xpCache = XMLXPath::getXPath($SignedElementsElement); - $SignedElementsElements = XMLXPath::xpQuery($SignedElementsElement, './sp:XPath', $xpCache); - $this->assertCount(1, $SignedElementsElements); + $xpCache = XMLXPath::getXPath($signedElementsElement); + $signedElementsElements = XMLXPath::xpQuery($signedElementsElement, './sp:XPath', $xpCache); + $this->assertCount(1, $signedElementsElements); // Test ordering of SignedElements contents - /** @psalm-var \DOMElement[] $SignedElementsElements */ - $SignedElementsElements = XMLXPath::xpQuery( - $SignedElementsElement, + /** @var \DOMElement[] $signedElementsElements */ + $signedElementsElements = XMLXPath::xpQuery( + $signedElementsElement, './sp:XPath/following-sibling::*', $xpCache, ); - $this->assertCount(1, $SignedElementsElements); - $this->assertEquals('ssp:Chunk', $SignedElementsElements[0]->tagName); + $this->assertCount(1, $signedElementsElements); + $this->assertEquals('ssp:Chunk', $signedElementsElements[0]->tagName); } @@ -87,16 +94,21 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SignedElements = new SignedElements([$xpath], 'urn:x-simplesamlphp:version', [$chunk], [$attr]); + $signedElements = new SignedElements( + [$xpath], + AnyURIValue::fromString('urn:x-simplesamlphp:version'), + [$chunk], + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($SignedElements), + strval($signedElements), ); } } diff --git a/tests/WSSecurity/XML/sp_200702/SignedEncryptedSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/SignedEncryptedSupportingTokensTest.php index 81dc08f9..682d5f33 100644 --- a/tests/WSSecurity/XML/sp_200702/SignedEncryptedSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/SignedEncryptedSupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class SignedEncryptedSupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/SignedEncryptedSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/SignedEndorsingEncryptedSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/SignedEndorsingEncryptedSupportingTokensTest.php index 29a1fb91..b2045d09 100644 --- a/tests/WSSecurity/XML/sp_200702/SignedEndorsingEncryptedSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/SignedEndorsingEncryptedSupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class SignedEndorsingEncryptedSupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/SignedEndorsingEncryptedSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/SignedEndorsingSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/SignedEndorsingSupportingTokensTest.php index c34848fa..5e4ed22e 100644 --- a/tests/WSSecurity/XML/sp_200702/SignedEndorsingSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/SignedEndorsingSupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class SignedEndorsingSupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/SignedEndorsingSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/SignedPartsTest.php b/tests/WSSecurity/XML/sp_200702/SignedPartsTest.php index c8694092..74d566e5 100644 --- a/tests/WSSecurity/XML/sp_200702/SignedPartsTest.php +++ b/tests/WSSecurity/XML/sp_200702/SignedPartsTest.php @@ -20,6 +20,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -73,9 +76,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $attachments = new Attachments(); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', @@ -93,28 +100,33 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $body = new Body(); - $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $header = new Header( + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}name'), + [$attr], + ); $attachments = new Attachments(); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SignedParts = new SignedParts($body, [$header], $attachments, [$chunk], [$attr]); - $SignedPartsElement = $SignedParts->toXML(); + $signedParts = new SignedParts($body, [$header], $attachments, [$chunk], [$attr]); + $signedPartsElement = $signedParts->toXML(); // Test for a Body - $xpCache = XPath::getXPath($SignedPartsElement); - $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body', $xpCache); - $this->assertCount(1, $SignedPartsElements); + $xpCache = XPath::getXPath($signedPartsElement); + $signedPartsElements = XPath::xpQuery($signedPartsElement, './sp:Body', $xpCache); + $this->assertCount(1, $signedPartsElements); // Test ordering of SignedParts contents - /** @psalm-var \DOMElement[] $SignedPartsElements */ - $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body/following-sibling::*', $xpCache); - $this->assertCount(3, $SignedPartsElements); - $this->assertEquals('sp:Header', $SignedPartsElements[0]->tagName); - $this->assertEquals('sp:Attachments', $SignedPartsElements[1]->tagName); - $this->assertEquals('ssp:Chunk', $SignedPartsElements[2]->tagName); + /** @var \DOMElement[] $signedPartsElements */ + $signedPartsElements = XPath::xpQuery($signedPartsElement, './sp:Body/following-sibling::*', $xpCache); + + $this->assertCount(3, $signedPartsElements); + $this->assertEquals('sp:Header', $signedPartsElements[0]->tagName); + $this->assertEquals('sp:Attachments', $signedPartsElements[1]->tagName); + $this->assertEquals('ssp:Chunk', $signedPartsElements[2]->tagName); } } diff --git a/tests/WSSecurity/XML/sp_200702/SignedSupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/SignedSupportingTokensTest.php index 725beedc..6fc774e5 100644 --- a/tests/WSSecurity/XML/sp_200702/SignedSupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/SignedSupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class SignedSupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/SignedSupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/SpnegoContextTokenTest.php b/tests/WSSecurity/XML/sp_200702/SpnegoContextTokenTest.php index 0d99cd15..10285878 100644 --- a/tests/WSSecurity/XML/sp_200702/SpnegoContextTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/SpnegoContextTokenTest.php @@ -14,11 +14,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; use SimpleSAML\WSSecurity\XML\sp_200702\IssuerName; use SimpleSAML\WSSecurity\XML\sp_200702\SpnegoContextToken; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,14 +56,14 @@ public static function setUpBeforeClass(): void */ public function testMarshallingElementOrdering(): void { - $issuer = new IssuerName('urn:x-simplesamlphp:issuer'); - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $issuer = new IssuerName(AnyURIValue::fromString('urn:x-simplesamlphp:issuer')); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $spnegoContextToken = new SpnegoContextToken($issuer, [$chunk], [$includeToken, $attr]); + $spnegoContextToken = new SpnegoContextToken($issuer, [$chunk], [$includeToken->toAttribute(), $attr]); $spnegoContextTokenElement = $spnegoContextToken->toXML(); // Test for a IssuerName @@ -69,12 +72,13 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $spnegoContextTokenElements); // Test ordering of SpnegoContextToken contents - /** @psalm-var \DOMElement[] $spnegoContextTokenElements */ + /** @var \DOMElement[] $spnegoContextTokenElements */ $spnegoContextTokenElements = XPath::xpQuery( $spnegoContextTokenElement, './sp:IssuerName/following-sibling::*', $xpCache, ); + $this->assertCount(1, $spnegoContextTokenElements); $this->assertEquals('ssp:Chunk', $spnegoContextTokenElements[0]->tagName); } @@ -88,15 +92,15 @@ public function testMarshallingElementOrdering(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $issuer = new IssuerName('urn:x-simplesamlphp:issuer'); + $issuer = new IssuerName(AnyURIValue::fromString('urn:x-simplesamlphp:issuer')); - $spnegoContextToken = new SpnegoContextToken($issuer, [$chunk], [$includeToken, $attr]); + $spnegoContextToken = new SpnegoContextToken($issuer, [$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($spnegoContextToken), diff --git a/tests/WSSecurity/XML/sp_200702/SupportingTokensTest.php b/tests/WSSecurity/XML/sp_200702/SupportingTokensTest.php index 643e29a1..0bbed549 100644 --- a/tests/WSSecurity/XML/sp_200702/SupportingTokensTest.php +++ b/tests/WSSecurity/XML/sp_200702/SupportingTokensTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class SupportingTokensTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/SupportingTokens.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/SymmetricBindingTest.php b/tests/WSSecurity/XML/sp_200702/SymmetricBindingTest.php index 23aa466e..46d7e7d1 100644 --- a/tests/WSSecurity/XML/sp_200702/SymmetricBindingTest.php +++ b/tests/WSSecurity/XML/sp_200702/SymmetricBindingTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class SymmetricBindingTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/SymmetricBinding.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/TransportBindingTest.php b/tests/WSSecurity/XML/sp_200702/TransportBindingTest.php index d9c28f29..00ffdd7b 100644 --- a/tests/WSSecurity/XML/sp_200702/TransportBindingTest.php +++ b/tests/WSSecurity/XML/sp_200702/TransportBindingTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class TransportBindingTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/TransportBinding.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/TransportTokenTest.php b/tests/WSSecurity/XML/sp_200702/TransportTokenTest.php index 62315b38..be00cb9d 100644 --- a/tests/WSSecurity/XML/sp_200702/TransportTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/TransportTokenTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class TransportTokenTest extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/TransportToken.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/Trust13Test.php b/tests/WSSecurity/XML/sp_200702/Trust13Test.php index a7986a56..d02b19d1 100644 --- a/tests/WSSecurity/XML/sp_200702/Trust13Test.php +++ b/tests/WSSecurity/XML/sp_200702/Trust13Test.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class Trust13Test extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/Trust13.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/UsernameTokenTest.php b/tests/WSSecurity/XML/sp_200702/UsernameTokenTest.php index ef128692..d2ded2f6 100644 --- a/tests/WSSecurity/XML/sp_200702/UsernameTokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/UsernameTokenTest.php @@ -11,13 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\WSSecurity\XML\sp_200702\UsernameToken; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('sp')] #[CoversClass(UsernameToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class UsernameTokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(null, null, 'IncludeToken', IncludeToken::Always->value); - $usernameToken = new UsernameToken([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $usernameToken = new UsernameToken([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($usernameToken), diff --git a/tests/WSSecurity/XML/sp_200702/Wss10Test.php b/tests/WSSecurity/XML/sp_200702/Wss10Test.php index cf38c6a7..2f456e87 100644 --- a/tests/WSSecurity/XML/sp_200702/Wss10Test.php +++ b/tests/WSSecurity/XML/sp_200702/Wss10Test.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class Wss10Test extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/Wss10.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/Wss11Test.php b/tests/WSSecurity/XML/sp_200702/Wss11Test.php index ad6bf580..eaa747e9 100644 --- a/tests/WSSecurity/XML/sp_200702/Wss11Test.php +++ b/tests/WSSecurity/XML/sp_200702/Wss11Test.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -41,6 +42,7 @@ final class Wss11Test extends TestCase /** @var \SimpleSAML\XML\Attribute $attr */ protected static XMLAttribute $attr; + /** */ public static function setUpBeforeClass(): void @@ -51,7 +53,7 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/sp/200702/Wss11.xml', ); - self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + self::$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); self::$chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/WSSecurity/XML/sp_200702/WssX509Pkcs7Token10Test.php b/tests/WSSecurity/XML/sp_200702/WssX509Pkcs7Token10Test.php index 11679c27..1667a805 100644 --- a/tests/WSSecurity/XML/sp_200702/WssX509Pkcs7Token10Test.php +++ b/tests/WSSecurity/XML/sp_200702/WssX509Pkcs7Token10Test.php @@ -22,7 +22,7 @@ * @package simplesamlphp/ws-security */ #[Group('sp')] -#[CoversClass(WssX509Pkcs7Token10Test::class)] +#[CoversClass(WssX509Pkcs7Token10::class)] #[CoversClass(AbstractQNameAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class WssX509Pkcs7Token10Test extends TestCase diff --git a/tests/WSSecurity/XML/sp_200702/X509TokenTest.php b/tests/WSSecurity/XML/sp_200702/X509TokenTest.php index 0d0e298b..12d7563e 100644 --- a/tests/WSSecurity/XML/sp_200702/X509TokenTest.php +++ b/tests/WSSecurity/XML/sp_200702/X509TokenTest.php @@ -11,13 +11,14 @@ use SimpleSAML\WSSecurity\XML\sp_200702\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200702\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200702\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200702\IncludeTokenTypeTrait; +use SimpleSAML\WSSecurity\XML\sp_200702\Type\IncludeTokenValue; use SimpleSAML\WSSecurity\XML\sp_200702\X509Token; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -28,7 +29,6 @@ */ #[Group('sp')] #[CoversClass(X509Token::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class X509TokenTest extends TestCase @@ -72,13 +72,13 @@ public function testMarshallingEmptyElement(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $includeToken = new XMLAttribute(null, null, 'IncludeToken', IncludeToken::Always->value); - $x509Token = new X509Token([$chunk], [$includeToken, $attr]); + $includeToken = IncludeTokenValue::fromEnum(IncludeToken::Always); + $x509Token = new X509Token([$chunk], [$includeToken->toAttribute(), $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($x509Token), diff --git a/tests/WSSecurity/XML/sp_200702/XPathTest.php b/tests/WSSecurity/XML/sp_200702/XPathTest.php index 83669661..262a68e5 100644 --- a/tests/WSSecurity/XML/sp_200702/XPathTest.php +++ b/tests/WSSecurity/XML/sp_200702/XPathTest.php @@ -11,6 +11,7 @@ use SimpleSAML\WSSecurity\XML\sp_200702\XPath; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -48,7 +49,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $xpath = new XPath('/bookstore/book[price>35.00]/title'); + $xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200408/ActionTest.php b/tests/WSSecurity/XML/wsa_200408/ActionTest.php index c8bb7387..18137c37 100644 --- a/tests/WSSecurity/XML/wsa_200408/ActionTest.php +++ b/tests/WSSecurity/XML/wsa_200408/ActionTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,8 +55,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $action = new Action('https://login.microsoftonline.com/login.srf', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $action = new Action(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200408/AddressTest.php b/tests/WSSecurity/XML/wsa_200408/AddressTest.php index e8fcfd37..a1d60f01 100644 --- a/tests/WSSecurity/XML/wsa_200408/AddressTest.php +++ b/tests/WSSecurity/XML/wsa_200408/AddressTest.php @@ -13,6 +13,8 @@ use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +53,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $Address = new Address('https://login.microsoftonline.com/login.srf', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $Address = new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php b/tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php index 25c87bec..ccce8b9f 100644 --- a/tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php +++ b/tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php @@ -22,6 +22,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -40,6 +44,7 @@ final class EndpointReferenceTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -82,20 +87,24 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -116,20 +125,24 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -145,7 +158,7 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $endpointReferenceElements); // Test ordering of EndpointReference contents - /** @psalm-var \DOMElement[] $endpointReferenceElements */ + /** @var \DOMElement[] $endpointReferenceElements */ $endpointReferenceElements = XPath::xpQuery( $endpointReferenceElement, './wsa:Address/following-sibling::*', diff --git a/tests/WSSecurity/XML/wsa_200408/FaultToTest.php b/tests/WSSecurity/XML/wsa_200408/FaultToTest.php index 092ba75f..d8220ee0 100644 --- a/tests/WSSecurity/XML/wsa_200408/FaultToTest.php +++ b/tests/WSSecurity/XML/wsa_200408/FaultToTest.php @@ -22,6 +22,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -40,6 +44,7 @@ final class FaultToTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -82,20 +87,24 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); - $FaultTo = new FaultTo( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $faultTo = new FaultTo( + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -106,7 +115,7 @@ public function testMarshalling(): void $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($FaultTo), + strval($faultTo), ); } @@ -116,20 +125,24 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); - $FaultTo = new FaultTo( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $faultTo = new FaultTo( + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -139,19 +152,20 @@ public function testMarshallingElementOrdering(): void ); // Test for an Address - $FaultToElement = $FaultTo->toXML(); - $xpCache = XPath::getXPath($FaultToElement); - $FaultToElements = XPath::xpQuery($FaultToElement, './wsa:Address', $xpCache); - $this->assertCount(1, $FaultToElements); + $faultToElement = $faultTo->toXML(); + $xpCache = XPath::getXPath($faultToElement); + $faultToElements = XPath::xpQuery($faultToElement, './wsa:Address', $xpCache); + $this->assertCount(1, $faultToElements); // Test ordering of FaultTo contents - /** @psalm-var \DOMElement[] $FaultToElements */ - $FaultToElements = XPath::xpQuery($FaultToElement, './wsa:Address/following-sibling::*', $xpCache); - $this->assertCount(5, $FaultToElements); - $this->assertEquals('wsa:ReferenceProperties', $FaultToElements[0]->tagName); - $this->assertEquals('wsa:ReferenceParameters', $FaultToElements[1]->tagName); - $this->assertEquals('wsa:PortType', $FaultToElements[2]->tagName); - $this->assertEquals('wsa:ServiceName', $FaultToElements[3]->tagName); - $this->assertEquals('ssp:Chunk', $FaultToElements[4]->tagName); + /** @var \DOMElement[] $faultToElements */ + $faultToElements = XPath::xpQuery($faultToElement, './wsa:Address/following-sibling::*', $xpCache); + + $this->assertCount(5, $faultToElements); + $this->assertEquals('wsa:ReferenceProperties', $faultToElements[0]->tagName); + $this->assertEquals('wsa:ReferenceParameters', $faultToElements[1]->tagName); + $this->assertEquals('wsa:PortType', $faultToElements[2]->tagName); + $this->assertEquals('wsa:ServiceName', $faultToElements[3]->tagName); + $this->assertEquals('ssp:Chunk', $faultToElements[4]->tagName); } } diff --git a/tests/WSSecurity/XML/wsa_200408/FromTest.php b/tests/WSSecurity/XML/wsa_200408/FromTest.php index f94fa766..8c2d2ba7 100644 --- a/tests/WSSecurity/XML/wsa_200408/FromTest.php +++ b/tests/WSSecurity/XML/wsa_200408/FromTest.php @@ -22,6 +22,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -40,6 +44,7 @@ final class FromTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -82,20 +87,24 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); - $From = new From( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $from = new From( + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -106,7 +115,7 @@ public function testMarshalling(): void $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($From), + strval($from), ); } @@ -116,20 +125,24 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); - $From = new From( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $from = new From( + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -139,19 +152,20 @@ public function testMarshallingElementOrdering(): void ); // Test for an Address - $FromElement = $From->toXML(); - $xpCache = XPath::getXPath($FromElement); - $FromElements = XPath::xpQuery($FromElement, './wsa:Address', $xpCache); - $this->assertCount(1, $FromElements); + $fromElement = $from->toXML(); + $xpCache = XPath::getXPath($fromElement); + $fromElements = XPath::xpQuery($fromElement, './wsa:Address', $xpCache); + $this->assertCount(1, $fromElements); // Test ordering of From contents - /** @psalm-var \DOMElement[] $FromElements */ - $FromElements = XPath::xpQuery($FromElement, './wsa:Address/following-sibling::*', $xpCache); - $this->assertCount(5, $FromElements); - $this->assertEquals('wsa:ReferenceProperties', $FromElements[0]->tagName); - $this->assertEquals('wsa:ReferenceParameters', $FromElements[1]->tagName); - $this->assertEquals('wsa:PortType', $FromElements[2]->tagName); - $this->assertEquals('wsa:ServiceName', $FromElements[3]->tagName); - $this->assertEquals('ssp:Chunk', $FromElements[4]->tagName); + /** @var \DOMElement[] $fromElements */ + $fromElements = XPath::xpQuery($fromElement, './wsa:Address/following-sibling::*', $xpCache); + + $this->assertCount(5, $fromElements); + $this->assertEquals('wsa:ReferenceProperties', $fromElements[0]->tagName); + $this->assertEquals('wsa:ReferenceParameters', $fromElements[1]->tagName); + $this->assertEquals('wsa:PortType', $fromElements[2]->tagName); + $this->assertEquals('wsa:ServiceName', $fromElements[3]->tagName); + $this->assertEquals('ssp:Chunk', $fromElements[4]->tagName); } } diff --git a/tests/WSSecurity/XML/wsa_200408/MessageIDTest.php b/tests/WSSecurity/XML/wsa_200408/MessageIDTest.php index 378668bb..9553054e 100644 --- a/tests/WSSecurity/XML/wsa_200408/MessageIDTest.php +++ b/tests/WSSecurity/XML/wsa_200408/MessageIDTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,8 +55,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $MessageID = new MessageID('https://login.microsoftonline.com/login.srf', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $MessageID = new MessageID(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200408/PortTypeTest.php b/tests/WSSecurity/XML/wsa_200408/PortTypeTest.php index 615a8f22..965729d1 100644 --- a/tests/WSSecurity/XML/wsa_200408/PortTypeTest.php +++ b/tests/WSSecurity/XML/wsa_200408/PortTypeTest.php @@ -13,6 +13,8 @@ use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +53,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $portType = new PortType('ssp:Chunk', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php b/tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php index ac4b36eb..279b15cb 100644 --- a/tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php +++ b/tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php @@ -29,6 +29,7 @@ final class ReferenceParametersTest extends TestCase { use SerializableElementTestTrait; + /** @var \DOMElement $referenceParametersContent */ private static DOMElement $referenceParametersContent; diff --git a/tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php b/tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php index 1bc87826..091b26c1 100644 --- a/tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php +++ b/tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php @@ -29,6 +29,7 @@ final class ReferencePropertiesTest extends TestCase { use SerializableElementTestTrait; + /** @var \DOMElement $ReferencePropertiesContent */ private static DOMElement $ReferencePropertiesContent; diff --git a/tests/WSSecurity/XML/wsa_200408/RelatesToTest.php b/tests/WSSecurity/XML/wsa_200408/RelatesToTest.php index 0382bfc0..b2097c50 100644 --- a/tests/WSSecurity/XML/wsa_200408/RelatesToTest.php +++ b/tests/WSSecurity/XML/wsa_200408/RelatesToTest.php @@ -14,6 +14,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,12 +56,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $RelatesTo = new RelatesTo('https://login.microsoftonline.com/login.srf', 'ssp:Chunk', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $relatesTo = new RelatesTo( + AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($RelatesTo), + strval($relatesTo), ); } } diff --git a/tests/WSSecurity/XML/wsa_200408/ReplyToTest.php b/tests/WSSecurity/XML/wsa_200408/ReplyToTest.php index 97b05684..eea70f50 100644 --- a/tests/WSSecurity/XML/wsa_200408/ReplyToTest.php +++ b/tests/WSSecurity/XML/wsa_200408/ReplyToTest.php @@ -22,6 +22,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -40,6 +44,7 @@ final class ReplyToTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referencePropertiesContent */ protected static DOMElement $referencePropertiesContent; @@ -82,20 +87,24 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); - $ReplyTo = new ReplyTo( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $replyTo = new ReplyTo( + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -106,7 +115,7 @@ public function testMarshalling(): void $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($ReplyTo), + strval($replyTo), ); } @@ -116,20 +125,24 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $referenceProperties = new ReferenceProperties([new Chunk(self::$referencePropertiesContent)]); - $portType = new PortType('ssp:Chunk', [$attr3]); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr4]); + $portType = new PortType(QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), [$attr3]); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr4], + ); $chunk = new Chunk(self::$customContent); - $ReplyTo = new ReplyTo( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $replyTo = new ReplyTo( + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceProperties, $referenceParameters, $portType, @@ -139,19 +152,20 @@ public function testMarshallingElementOrdering(): void ); // Test for an Address - $ReplyToElement = $ReplyTo->toXML(); - $xpCache = XPath::getXPath($ReplyToElement); - $ReplyToElements = XPath::xpQuery($ReplyToElement, './wsa:Address', $xpCache); - $this->assertCount(1, $ReplyToElements); + $replyToElement = $replyTo->toXML(); + $xpCache = XPath::getXPath($replyToElement); + $replyToElements = XPath::xpQuery($replyToElement, './wsa:Address', $xpCache); + $this->assertCount(1, $replyToElements); // Test ordering of ReplyTo contents - /** @psalm-var \DOMElement[] $ReplyToElements */ - $ReplyToElements = XPath::xpQuery($ReplyToElement, './wsa:Address/following-sibling::*', $xpCache); - $this->assertCount(5, $ReplyToElements); - $this->assertEquals('wsa:ReferenceProperties', $ReplyToElements[0]->tagName); - $this->assertEquals('wsa:ReferenceParameters', $ReplyToElements[1]->tagName); - $this->assertEquals('wsa:PortType', $ReplyToElements[2]->tagName); - $this->assertEquals('wsa:ServiceName', $ReplyToElements[3]->tagName); - $this->assertEquals('ssp:Chunk', $ReplyToElements[4]->tagName); + /** @var \DOMElement[] $replyToElements */ + $replyToElements = XPath::xpQuery($replyToElement, './wsa:Address/following-sibling::*', $xpCache); + + $this->assertCount(5, $replyToElements); + $this->assertEquals('wsa:ReferenceProperties', $replyToElements[0]->tagName); + $this->assertEquals('wsa:ReferenceParameters', $replyToElements[1]->tagName); + $this->assertEquals('wsa:PortType', $replyToElements[2]->tagName); + $this->assertEquals('wsa:ServiceName', $replyToElements[3]->tagName); + $this->assertEquals('ssp:Chunk', $replyToElements[4]->tagName); } } diff --git a/tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php b/tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php index 5a736b91..939a4cf2 100644 --- a/tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php +++ b/tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function dirname; use function strval; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $retryAfter = new RetryAfter(30); + $retryAfter = new RetryAfter(NonNegativeIntegerValue::fromInteger(30)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php b/tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php index c9a679ce..d248a25c 100644 --- a/tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php +++ b/tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php @@ -13,6 +13,9 @@ use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +54,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200408/ToTest.php b/tests/WSSecurity/XML/wsa_200408/ToTest.php index aac5ab6f..39dfe470 100644 --- a/tests/WSSecurity/XML/wsa_200408/ToTest.php +++ b/tests/WSSecurity/XML/wsa_200408/ToTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,8 +55,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $To = new To('https://login.microsoftonline.com/login.srf', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $To = new To(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/ActionTest.php b/tests/WSSecurity/XML/wsa_200508/ActionTest.php index d0d4d280..e5259930 100644 --- a/tests/WSSecurity/XML/wsa_200508/ActionTest.php +++ b/tests/WSSecurity/XML/wsa_200508/ActionTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,8 +55,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $action = new Action('https://login.microsoftonline.com/login.srf', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $action = new Action(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/AddressTest.php b/tests/WSSecurity/XML/wsa_200508/AddressTest.php index 8893107e..21ecc834 100644 --- a/tests/WSSecurity/XML/wsa_200508/AddressTest.php +++ b/tests/WSSecurity/XML/wsa_200508/AddressTest.php @@ -13,6 +13,8 @@ use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +53,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $address = new Address('https://login.microsoftonline.com/login.srf', [$attr1]); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $address = new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/EndpointReferenceTest.php b/tests/WSSecurity/XML/wsa_200508/EndpointReferenceTest.php index 65fcf9cb..3556b522 100644 --- a/tests/WSSecurity/XML/wsa_200508/EndpointReferenceTest.php +++ b/tests/WSSecurity/XML/wsa_200508/EndpointReferenceTest.php @@ -19,6 +19,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -37,6 +39,7 @@ final class EndpointReferenceTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referenceParametersContent */ protected static DOMElement $referenceParametersContent; @@ -79,17 +82,17 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/wsa_200508/FaultToTest.php b/tests/WSSecurity/XML/wsa_200508/FaultToTest.php index 72c7083f..58da1a69 100644 --- a/tests/WSSecurity/XML/wsa_200508/FaultToTest.php +++ b/tests/WSSecurity/XML/wsa_200508/FaultToTest.php @@ -19,6 +19,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -82,17 +84,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $faultTo = new FaultTo( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/wsa_200508/FromTest.php b/tests/WSSecurity/XML/wsa_200508/FromTest.php index d60d82fe..edbf9e27 100644 --- a/tests/WSSecurity/XML/wsa_200508/FromTest.php +++ b/tests/WSSecurity/XML/wsa_200508/FromTest.php @@ -19,6 +19,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -82,17 +84,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $from = new From( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/wsa_200508/MessageIDTest.php b/tests/WSSecurity/XML/wsa_200508/MessageIDTest.php index d26a3882..fc708d9b 100644 --- a/tests/WSSecurity/XML/wsa_200508/MessageIDTest.php +++ b/tests/WSSecurity/XML/wsa_200508/MessageIDTest.php @@ -7,14 +7,14 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\AbstractAttributedURIType; use SimpleSAML\WSSecurity\XML\wsa_200508\AbstractWsaElement; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; -use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; use function strval; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute(C::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/MetadataTest.php b/tests/WSSecurity/XML/wsa_200508/MetadataTest.php index 286d5b2f..20c083c6 100644 --- a/tests/WSSecurity/XML/wsa_200508/MetadataTest.php +++ b/tests/WSSecurity/XML/wsa_200508/MetadataTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -32,6 +33,7 @@ final class MetadataTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $MetadataContent */ private static DOMElement $metadataContent; @@ -56,7 +58,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $domAttr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'value1'); + $domAttr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1')); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$domAttr]); $this->assertFalse($metadata->isEmptyElement()); diff --git a/tests/WSSecurity/XML/wsa_200508/ProblemActionTest.php b/tests/WSSecurity/XML/wsa_200508/ProblemActionTest.php index 652a0fba..e185f947 100644 --- a/tests/WSSecurity/XML/wsa_200508/ProblemActionTest.php +++ b/tests/WSSecurity/XML/wsa_200508/ProblemActionTest.php @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -56,11 +58,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); $problemAction = new ProblemAction( - new Action('https://login.microsoftonline.com/login.srf', [$attr1]), - new SoapAction('http://www.example.com/'), + new Action(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]), + new SoapAction(AnyURIValue::fromString('http://www.example.com/')), [$attr1], ); diff --git a/tests/WSSecurity/XML/wsa_200508/ProblemHeaderQNameTest.php b/tests/WSSecurity/XML/wsa_200508/ProblemHeaderQNameTest.php index aec5174d..81867f94 100644 --- a/tests/WSSecurity/XML/wsa_200508/ProblemHeaderQNameTest.php +++ b/tests/WSSecurity/XML/wsa_200508/ProblemHeaderQNameTest.php @@ -14,6 +14,10 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,9 +57,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'value1'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1')); - $problemHeaderQName = new ProblemHeaderQName('wsa10:Action', [$attr1]); + $problemHeaderQName = new ProblemHeaderQName( + QNameValue::fromParts( + NCNameValue::fromString('Action'), + AnyURIValue::fromString(AbstractWsaElement::NS), + NCNameValue::fromString('wsa10'), + ), + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/ProblemIRITest.php b/tests/WSSecurity/XML/wsa_200508/ProblemIRITest.php index 69e899e4..4e7a24b5 100644 --- a/tests/WSSecurity/XML/wsa_200508/ProblemIRITest.php +++ b/tests/WSSecurity/XML/wsa_200508/ProblemIRITest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,9 +55,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'value1'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1')); - $problemIri = new ProblemIRI('https://login.microsoftonline.com/login.srf', [$attr1]); + $problemIri = new ProblemIRI(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/ReferenceParametersTest.php b/tests/WSSecurity/XML/wsa_200508/ReferenceParametersTest.php index 671c791d..42dd891f 100644 --- a/tests/WSSecurity/XML/wsa_200508/ReferenceParametersTest.php +++ b/tests/WSSecurity/XML/wsa_200508/ReferenceParametersTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -32,6 +33,7 @@ final class ReferenceParametersTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referenceParametersContent */ private static DOMElement $referenceParametersContent; @@ -56,7 +58,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $domAttr = new Attribute('urn:test:something', 'test', 'attr1', 'testval1'); + $domAttr = new Attribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$domAttr]); $this->assertFalse($referenceParameters->isEmptyElement()); diff --git a/tests/WSSecurity/XML/wsa_200508/RelatesToTest.php b/tests/WSSecurity/XML/wsa_200508/RelatesToTest.php index b7e21ef7..e80f397c 100644 --- a/tests/WSSecurity/XML/wsa_200508/RelatesToTest.php +++ b/tests/WSSecurity/XML/wsa_200508/RelatesToTest.php @@ -13,6 +13,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -30,6 +32,7 @@ final class RelatesToTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** */ public static function setUpBeforeClass(): void @@ -46,11 +49,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $domAttr = new Attribute('urn:test:something', 'test', 'attr1', 'testval1'); + $domAttr = new Attribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); $relatesTo = new RelatesTo( - 'urn:x-simplesamlphp:namespace', - 'http://www.w3.org/2005/08/addressing/reply', + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + AnyURIValue::fromString('http://www.w3.org/2005/08/addressing/reply'), [$domAttr], ); diff --git a/tests/WSSecurity/XML/wsa_200508/ReplyToTest.php b/tests/WSSecurity/XML/wsa_200508/ReplyToTest.php index 9a83f66c..8b23f946 100644 --- a/tests/WSSecurity/XML/wsa_200508/ReplyToTest.php +++ b/tests/WSSecurity/XML/wsa_200508/ReplyToTest.php @@ -19,6 +19,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -82,17 +84,17 @@ public function testMarshalling(): void { $doc = DOMDocumentFactory::fromString(''); - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $replyTo = new ReplyTo( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/wsa_200508/RetryAfterTest.php b/tests/WSSecurity/XML/wsa_200508/RetryAfterTest.php index d6e40cb3..8b477ac7 100644 --- a/tests/WSSecurity/XML/wsa_200508/RetryAfterTest.php +++ b/tests/WSSecurity/XML/wsa_200508/RetryAfterTest.php @@ -7,13 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\WSSecurity\XML\wsa_200508\AbstractAttributedLongType; +use SimpleSAML\WSSecurity\XML\wsa_200508\AbstractAttributedUnsignedLongType; use SimpleSAML\WSSecurity\XML\wsa_200508\AbstractWsaElement; use SimpleSAML\WSSecurity\XML\wsa_200508\RetryAfter; use SimpleSAML\XML\Attribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\Type\UnsignedLongValue; use function dirname; use function strval; @@ -25,7 +27,7 @@ */ #[Group('wsa')] #[CoversClass(RetryAfter::class)] -#[CoversClass(AbstractAttributedLongType::class)] +#[CoversClass(AbstractAttributedUnsignedLongType::class)] #[CoversClass(AbstractWsaElement::class)] final class RetryAfterTest extends TestCase { @@ -53,8 +55,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', 'value'); - $retryAfter = new RetryAfter('1234567890', [$attr]); + $attr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test', StringValue::fromString('value')); + $retryAfter = new RetryAfter(UnsignedLongValue::fromString('1234567890'), [$attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/SoapActionTest.php b/tests/WSSecurity/XML/wsa_200508/SoapActionTest.php index e19d184e..d8fcbd32 100644 --- a/tests/WSSecurity/XML/wsa_200508/SoapActionTest.php +++ b/tests/WSSecurity/XML/wsa_200508/SoapActionTest.php @@ -11,6 +11,7 @@ use SimpleSAML\WSSecurity\XML\wsa_200508\SoapAction; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; use function strval; @@ -48,7 +49,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $soapAction = new SoapAction('http://www.example.com/'); + $soapAction = new SoapAction(AnyURIValue::fromString('http://www.example.com/')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsa_200508/ToTest.php b/tests/WSSecurity/XML/wsa_200508/ToTest.php index 89c86839..2e9bfd53 100644 --- a/tests/WSSecurity/XML/wsa_200508/ToTest.php +++ b/tests/WSSecurity/XML/wsa_200508/ToTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,9 +55,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr', 'test'); + $attr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr', StringValue::fromString('test')); - $to = new To('https://login.microsoftonline.com/login.srf', [$attr]); + $to = new To(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsaw/AnonymousTest.php b/tests/WSSecurity/XML/wsaw/AnonymousTest.php index 65655549..fb9965cd 100644 --- a/tests/WSSecurity/XML/wsaw/AnonymousTest.php +++ b/tests/WSSecurity/XML/wsaw/AnonymousTest.php @@ -16,6 +16,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,7 +56,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $anonymous = new Anonymous(AnonymousEnum::Prohibited, [$attr]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wsaw/InterfaceNameTest.php b/tests/WSSecurity/XML/wsaw/InterfaceNameTest.php index c21c00c7..13f920eb 100644 --- a/tests/WSSecurity/XML/wsaw/InterfaceNameTest.php +++ b/tests/WSSecurity/XML/wsaw/InterfaceNameTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,8 +55,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $interfaceName = new InterfaceName('ssp:Chunk', [$attr]); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $interfaceName = new InterfaceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsaw/ServiceNameTest.php b/tests/WSSecurity/XML/wsaw/ServiceNameTest.php index 8e0a2b22..b01d6985 100644 --- a/tests/WSSecurity/XML/wsaw/ServiceNameTest.php +++ b/tests/WSSecurity/XML/wsaw/ServiceNameTest.php @@ -15,6 +15,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,8 +56,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); - $serviceName = new ServiceName('ssp:Chunk', 'PHPUnit', [$attr]); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); + $serviceName = new ServiceName( + QNameValue::fromString('{urn:x-simplesamlphp:namespace}ssp:Chunk'), + NCNameValue::fromString('PHPUnit'), + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsaw/UsingAddressingTest.php b/tests/WSSecurity/XML/wsaw/UsingAddressingTest.php index bd964cda..6a580529 100644 --- a/tests/WSSecurity/XML/wsaw/UsingAddressingTest.php +++ b/tests/WSSecurity/XML/wsaw/UsingAddressingTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -51,7 +52,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1')); $usingAddressing = new UsingAddressing([$attr]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wsp/AppliesToTest.php b/tests/WSSecurity/XML/wsp/AppliesToTest.php index e3352a46..a0d0a5fe 100644 --- a/tests/WSSecurity/XML/wsp/AppliesToTest.php +++ b/tests/WSSecurity/XML/wsp/AppliesToTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -49,10 +51,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $domAttr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'value1'); + $domAttr = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1')); $AppliesTo = new AppliesTo( - [new EndpointReference(new Address('http://www.fabrikam123.example.com/acct'))], + [ + new EndpointReference( + new Address( + AnyURIValue::fromString('http://www.fabrikam123.example.com/acct'), + ), + ), + ], [$domAttr], ); $this->assertFalse($AppliesTo->isEmptyElement()); diff --git a/tests/WSSecurity/XML/wsp/PolicyAttachmentTest.php b/tests/WSSecurity/XML/wsp/PolicyAttachmentTest.php index 75a2fecd..af36d626 100644 --- a/tests/WSSecurity/XML/wsp/PolicyAttachmentTest.php +++ b/tests/WSSecurity/XML/wsp/PolicyAttachmentTest.php @@ -17,11 +17,15 @@ use SimpleSAML\WSSecurity\XML\wsp\PolicyAttachment; use SimpleSAML\WSSecurity\XML\wsp\PolicyReference; use SimpleSAML\WSSecurity\XML\wsse\Security; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -60,11 +64,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); - $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr3', 'testval3'); - $attr4 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr4', 'testval4'); - $attr5 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr5', 'testval5'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); + $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr3', StringValue::fromString('testval3')); + $attr4 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr4', StringValue::fromString('testval4')); + $attr5 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr5', StringValue::fromString('testval5')); $some = new Chunk(DOMDocumentFactory::fromString( 'Some', @@ -77,17 +81,23 @@ public function testMarshalling(): void )->documentElement); $appliesTo = new AppliesTo( - [new EndpointReference(new Address('http://www.fabrikam123.example.com/acct'))], + [ + new EndpointReference( + new Address( + AnyURIValue::fromString('http://www.fabrikam123.example.com/acct'), + ), + ), + ], [$attr2], ); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - $policy = new Policy('phpunit', $Id, [new ExactlyOne([])], [$other], [$attr3]); + $Id = IDValue::fromString('MyId'); + $policy = new Policy([new ExactlyOne([])], [$other], AnyURIValue::fromString('phpunit'), $Id, [$attr3]); $policyReference = new PolicyReference( - 'urn:x-simplesamlphp:phpunit', - '/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=', - 'http://schemas.xmlsoap.org/ws/2004/09/policy/Sha1Exc', + AnyURIValue::fromString('urn:x-simplesamlphp:phpunit'), + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + AnyURIValue::fromString('http://schemas.xmlsoap.org/ws/2004/09/policy/Sha1Exc'), [$attr4], ); diff --git a/tests/WSSecurity/XML/wsp/PolicyReferenceTest.php b/tests/WSSecurity/XML/wsp/PolicyReferenceTest.php index b7626da6..8f6dbe95 100644 --- a/tests/WSSecurity/XML/wsp/PolicyReferenceTest.php +++ b/tests/WSSecurity/XML/wsp/PolicyReferenceTest.php @@ -14,6 +14,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -52,12 +55,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); $pr = new PolicyReference( - 'urn:x-simplesamlphp:phpunit', - '/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=', - 'http://schemas.xmlsoap.org/ws/2004/09/policy/Sha1Exc', + AnyURIValue::fromString('urn:x-simplesamlphp:phpunit'), + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + AnyURIValue::fromString('http://schemas.xmlsoap.org/ws/2004/09/policy/Sha1Exc'), [$attr], ); diff --git a/tests/WSSecurity/XML/wsp/PolicyTest.php b/tests/WSSecurity/XML/wsp/PolicyTest.php index a4bde4f4..f7e58dd0 100644 --- a/tests/WSSecurity/XML/wsp/PolicyTest.php +++ b/tests/WSSecurity/XML/wsp/PolicyTest.php @@ -12,11 +12,14 @@ use SimpleSAML\WSSecurity\XML\wsp\AbstractWspElement; use SimpleSAML\WSSecurity\XML\wsp\ExactlyOne; use SimpleSAML\WSSecurity\XML\wsp\Policy; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -56,13 +59,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); $chunk = new Chunk(DOMDocumentFactory::fromString( 'Some', )->documentElement); - $Id = new XMLAttribute(C::NS_SEC_UTIL, 'wsu', 'Id', 'MyId'); - $policy = new Policy('phpunit', $Id, [new ExactlyOne([])], [$chunk], [$attr]); + $Id = IDValue::fromString('MyId'); + $policy = new Policy([new ExactlyOne([])], [$chunk], AnyURIValue::fromString('phpunit'), $Id, [$attr]); $this->assertFalse($policy->isEmptyElement()); diff --git a/tests/WSSecurity/XML/wsse/BinarySecurityTokenTest.php b/tests/WSSecurity/XML/wsse/BinarySecurityTokenTest.php index a127443e..9d3eba78 100644 --- a/tests/WSSecurity/XML/wsse/BinarySecurityTokenTest.php +++ b/tests/WSSecurity/XML/wsse/BinarySecurityTokenTest.php @@ -12,10 +12,13 @@ use SimpleSAML\WSSecurity\XML\wsse\AbstractEncodedString; use SimpleSAML\WSSecurity\XML\wsse\AbstractWsseElement; use SimpleSAML\WSSecurity\XML\wsse\BinarySecurityToken; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -58,14 +61,18 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $content = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $binarySecurityToken = new BinarySecurityToken( - $content, - 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', - 'SomeID', - 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary', + StringValue::fromString($content), + IDValue::fromString('SomeID'), [$attr1], + AnyURIValue::fromString( + 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', + ), + AnyURIValue::fromString( + 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary', + ), ); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wsse/EmbeddedTest.php b/tests/WSSecurity/XML/wsse/EmbeddedTest.php index ed82f9c3..d22ea122 100644 --- a/tests/WSSecurity/XML/wsse/EmbeddedTest.php +++ b/tests/WSSecurity/XML/wsse/EmbeddedTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,13 +56,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $embedded = new Embedded( - 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', + AnyURIValue::fromString( + 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', + ), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/wsse/KeyIdentifierTest.php b/tests/WSSecurity/XML/wsse/KeyIdentifierTest.php index bdf1f96d..78d7153a 100644 --- a/tests/WSSecurity/XML/wsse/KeyIdentifierTest.php +++ b/tests/WSSecurity/XML/wsse/KeyIdentifierTest.php @@ -12,10 +12,13 @@ use SimpleSAML\WSSecurity\XML\wsse\AbstractKeyIdentifierType; use SimpleSAML\WSSecurity\XML\wsse\AbstractWsseElement; use SimpleSAML\WSSecurity\XML\wsse\KeyIdentifier; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -58,14 +61,18 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $content = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $keyIdentifier = new KeyIdentifier( - $content, - 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', - 'SomeID', - 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary', + StringValue::fromString($content), + IDValue::fromString('SomeID'), [$attr1], + AnyURIValue::fromString( + 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', + ), + AnyURIValue::fromString( + 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary', + ), ); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wsse/NonceTest.php b/tests/WSSecurity/XML/wsse/NonceTest.php index 8680e7ed..e8d59eee 100644 --- a/tests/WSSecurity/XML/wsse/NonceTest.php +++ b/tests/WSSecurity/XML/wsse/NonceTest.php @@ -11,10 +11,13 @@ use SimpleSAML\WSSecurity\XML\wsse\AbstractEncodedString; use SimpleSAML\WSSecurity\XML\wsse\AbstractWsseElement; use SimpleSAML\WSSecurity\XML\wsse\Nonce; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -56,13 +59,15 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $content = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $nonce = new Nonce( - $content, - 'SomeID', - 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary', + StringValue::fromString($content), + IDValue::fromString('SomeID'), [$attr1], + AnyURIValue::fromString( + 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary', + ), ); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wsse/PasswordTest.php b/tests/WSSecurity/XML/wsse/PasswordTest.php index b6c34658..aadb6706 100644 --- a/tests/WSSecurity/XML/wsse/PasswordTest.php +++ b/tests/WSSecurity/XML/wsse/PasswordTest.php @@ -11,9 +11,12 @@ use SimpleSAML\WSSecurity\XML\wsse\AbstractPasswordString; use SimpleSAML\WSSecurity\XML\wsse\AbstractWsseElement; use SimpleSAML\WSSecurity\XML\wsse\Password; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,8 +56,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $password = new Password('secret', 'SomeID', 'SomeType', [$attr]); + $attr = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $password = new Password( + StringValue::fromString('secret'), + IDValue::fromString('SomeID'), + [$attr], + AnyURIValue::fromString('SomeType'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsse/ReferenceTest.php b/tests/WSSecurity/XML/wsse/ReferenceTest.php index 2a8fe211..c2f7ca96 100644 --- a/tests/WSSecurity/XML/wsse/ReferenceTest.php +++ b/tests/WSSecurity/XML/wsse/ReferenceTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,11 +55,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $reference = new Reference( - 'urn:some:uri', - 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', + AnyURIValue::fromString('urn:some:uri'), + AnyURIValue::fromString( + 'http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentUserToken', + ), [$attr1], ); diff --git a/tests/WSSecurity/XML/wsse/SecurityTest.php b/tests/WSSecurity/XML/wsse/SecurityTest.php index 7e06c611..f042c81c 100644 --- a/tests/WSSecurity/XML/wsse/SecurityTest.php +++ b/tests/WSSecurity/XML/wsse/SecurityTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/wsse/SecurityTokenReferenceTest.php b/tests/WSSecurity/XML/wsse/SecurityTokenReferenceTest.php index 63d983b6..da1a84d3 100644 --- a/tests/WSSecurity/XML/wsse/SecurityTokenReferenceTest.php +++ b/tests/WSSecurity/XML/wsse/SecurityTokenReferenceTest.php @@ -10,11 +10,14 @@ use SimpleSAML\WSSecurity\XML\wsse\AbstractSecurityTokenReferenceType; use SimpleSAML\WSSecurity\XML\wsse\AbstractWsseElement; use SimpleSAML\WSSecurity\XML\wsse\SecurityTokenReference; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,14 +57,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $securityTokenReference = new SecurityTokenReference( - 'SomeID', - 'SomeUsage', + IDValue::fromString('SomeID'), + AnyURIValue::fromString('SomeUsage'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/wsse/TransformationParametersTest.php b/tests/WSSecurity/XML/wsse/TransformationParametersTest.php index 2955a4da..7db0b390 100644 --- a/tests/WSSecurity/XML/wsse/TransformationParametersTest.php +++ b/tests/WSSecurity/XML/wsse/TransformationParametersTest.php @@ -15,6 +15,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); diff --git a/tests/WSSecurity/XML/wsse/UsernameTest.php b/tests/WSSecurity/XML/wsse/UsernameTest.php index d0f1d668..1f9149d6 100644 --- a/tests/WSSecurity/XML/wsse/UsernameTest.php +++ b/tests/WSSecurity/XML/wsse/UsernameTest.php @@ -10,9 +10,11 @@ use SimpleSAML\WSSecurity\XML\wsse\AbstractAttributedString; use SimpleSAML\WSSecurity\XML\wsse\AbstractWsseElement; use SimpleSAML\WSSecurity\XML\wsse\Username; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -51,8 +53,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $username = new Username('johndoe@example.com', 'SomeID', [$attr]); + $attr = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $username = new Username( + StringValue::fromString('johndoe@example.com'), + IDValue::fromString('SomeID'), + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsse/UsernameTokenTest.php b/tests/WSSecurity/XML/wsse/UsernameTokenTest.php index ff5417e1..d9885209 100644 --- a/tests/WSSecurity/XML/wsse/UsernameTokenTest.php +++ b/tests/WSSecurity/XML/wsse/UsernameTokenTest.php @@ -11,11 +11,13 @@ use SimpleSAML\WSSecurity\XML\wsse\AbstractWsseElement; use SimpleSAML\WSSecurity\XML\wsse\Username; use SimpleSAML\WSSecurity\XML\wsse\UsernameToken; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -55,16 +57,20 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); - $username = new Username('johndoe@example.com', 'OtherID', [$attr2]); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); + $username = new Username( + StringValue::fromString('johndoe@example.com'), + IDValue::fromString('OtherID'), + [$attr2], + ); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $usernameToken = new UsernameToken( $username, - 'SomeID', + IDValue::fromString('SomeID'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/wst_200502/AuthenticationTypeTest.php b/tests/WSSecurity/XML/wst_200502/AuthenticationTypeTest.php index cb12750a..39315cd6 100644 --- a/tests/WSSecurity/XML/wst_200502/AuthenticationTypeTest.php +++ b/tests/WSSecurity/XML/wst_200502/AuthenticationTypeTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $authenticationType = new AuthenticationType(C::NAMESPACE); + $authenticationType = new AuthenticationType(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/AuthenticatorTest.php b/tests/WSSecurity/XML/wst_200502/AuthenticatorTest.php index 8e15f5e2..97f55ad0 100644 --- a/tests/WSSecurity/XML/wst_200502/AuthenticatorTest.php +++ b/tests/WSSecurity/XML/wst_200502/AuthenticatorTest.php @@ -7,16 +7,17 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractAuthenticatorType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\Authenticator; use SimpleSAML\WSSecurity\XML\wst_200502\CombinedHash; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use function dirname; @@ -57,10 +58,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $combinedHash = new CombinedHash('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); + $combinedHash = new CombinedHash( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + ); $authenticator = new Authenticator($combinedHash, [$msgId]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200502/BinaryExchangeTest.php b/tests/WSSecurity/XML/wst_200502/BinaryExchangeTest.php index f60a37ca..6500acdb 100644 --- a/tests/WSSecurity/XML/wst_200502/BinaryExchangeTest.php +++ b/tests/WSSecurity/XML/wst_200502/BinaryExchangeTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,8 +57,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $binaryExchange = new BinaryExchange('phpunit', C::NAMESPACE, C::NAMESPACE, [$attr1]); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $binaryExchange = new BinaryExchange( + StringValue::fromString('phpunit'), + AnyURIValue::fromString(C::NAMESPACE), + AnyURIValue::fromString(C::NAMESPACE), + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/BinarySecretTest.php b/tests/WSSecurity/XML/wst_200502/BinarySecretTest.php index 4bb4b80c..01d54a02 100644 --- a/tests/WSSecurity/XML/wst_200502/BinarySecretTest.php +++ b/tests/WSSecurity/XML/wst_200502/BinarySecretTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,10 +58,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); $binarySecret = new BinarySecret( - '/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=', + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), [BinarySecretTypeEnum::Nonce], [$attr1], ); diff --git a/tests/WSSecurity/XML/wst_200502/CancelTargetTest.php b/tests/WSSecurity/XML/wst_200502/CancelTargetTest.php index 9aa39757..1b26947f 100644 --- a/tests/WSSecurity/XML/wst_200502/CancelTargetTest.php +++ b/tests/WSSecurity/XML/wst_200502/CancelTargetTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractCancelTargetType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\CancelTarget; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $cancelTarget = new CancelTarget($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/CanonicalizationAlgorithmTest.php b/tests/WSSecurity/XML/wst_200502/CanonicalizationAlgorithmTest.php index 914b28c0..70f1ec77 100644 --- a/tests/WSSecurity/XML/wst_200502/CanonicalizationAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200502/CanonicalizationAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $canonicalizationAlgorithm = new CanonicalizationAlgorithm(C::NAMESPACE); + $canonicalizationAlgorithm = new CanonicalizationAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/ChallengeTest.php b/tests/WSSecurity/XML/wst_200502/ChallengeTest.php index 000bcb8b..b8f5229c 100644 --- a/tests/WSSecurity/XML/wst_200502/ChallengeTest.php +++ b/tests/WSSecurity/XML/wst_200502/ChallengeTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -51,7 +52,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $challenge = new Challenge('accepted'); + $challenge = new Challenge(StringValue::fromString('accepted')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/ClaimsTest.php b/tests/WSSecurity/XML/wst_200502/ClaimsTest.php index e5a994b2..98c9e29e 100644 --- a/tests/WSSecurity/XML/wst_200502/ClaimsTest.php +++ b/tests/WSSecurity/XML/wst_200502/ClaimsTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractClaimsType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -57,11 +59,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr2]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $claims = new Claims(C::NAMESPACE, [$msgId], [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $claims = new Claims(AnyURIValue::fromString(C::NAMESPACE), [$msgId], [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/CodeTest.php b/tests/WSSecurity/XML/wst_200502/CodeTest.php index 31b8d4f3..71440646 100644 --- a/tests/WSSecurity/XML/wst_200502/CodeTest.php +++ b/tests/WSSecurity/XML/wst_200502/CodeTest.php @@ -13,6 +13,7 @@ use SimpleSAML\WSSecurity\XML\wst_200502\StatusCodeEnum; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $code = new Code([StatusCodeEnum::Invalid]); + $code = new Code(AnyURIValue::fromString(StatusCodeEnum::Invalid->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/CombinedHashTest.php b/tests/WSSecurity/XML/wst_200502/CombinedHashTest.php index 4a26667b..6880d1d6 100644 --- a/tests/WSSecurity/XML/wst_200502/CombinedHashTest.php +++ b/tests/WSSecurity/XML/wst_200502/CombinedHashTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use function dirname; @@ -51,7 +52,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $combinedHash = new CombinedHash('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); + $combinedHash = new CombinedHash( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/ComputedKeyAlgorithmTest.php b/tests/WSSecurity/XML/wst_200502/ComputedKeyAlgorithmTest.php index 17e35bf3..3a71237b 100644 --- a/tests/WSSecurity/XML/wst_200502/ComputedKeyAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200502/ComputedKeyAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $computedKeyAlgorithm = new ComputedKeyAlgorithm(C::NAMESPACE); + $computedKeyAlgorithm = new ComputedKeyAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/ComputedKeyTest.php b/tests/WSSecurity/XML/wst_200502/ComputedKeyTest.php index 2ed60b88..3f7c4180 100644 --- a/tests/WSSecurity/XML/wst_200502/ComputedKeyTest.php +++ b/tests/WSSecurity/XML/wst_200502/ComputedKeyTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $computedKey = new ComputedKey([ComputedKeyEnum::PSHA1]); + $computedKey = new ComputedKey(AnyURIValue::fromString(ComputedKeyEnum::PSHA1->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/DelegatableTest.php b/tests/WSSecurity/XML/wst_200502/DelegatableTest.php index 7f35761d..5a256a6e 100644 --- a/tests/WSSecurity/XML/wst_200502/DelegatableTest.php +++ b/tests/WSSecurity/XML/wst_200502/DelegatableTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; @@ -51,7 +52,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $delegatable = new Delegatable('true'); + $delegatable = new Delegatable(BooleanValue::fromBoolean(true)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/DelegateToTest.php b/tests/WSSecurity/XML/wst_200502/DelegateToTest.php index b4325e9c..40d56781 100644 --- a/tests/WSSecurity/XML/wst_200502/DelegateToTest.php +++ b/tests/WSSecurity/XML/wst_200502/DelegateToTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractDelegateToType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\DelegateTo; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $delegateTo = new DelegateTo($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/EncryptWithTest.php b/tests/WSSecurity/XML/wst_200502/EncryptWithTest.php index a6f77f3f..f7a435b8 100644 --- a/tests/WSSecurity/XML/wst_200502/EncryptWithTest.php +++ b/tests/WSSecurity/XML/wst_200502/EncryptWithTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $encryptWith = new EncryptWith(C::NAMESPACE); + $encryptWith = new EncryptWith(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/EncryptionAlgorithmTest.php b/tests/WSSecurity/XML/wst_200502/EncryptionAlgorithmTest.php index a7536aa8..4f600899 100644 --- a/tests/WSSecurity/XML/wst_200502/EncryptionAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200502/EncryptionAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $encryptionAlgorithm = new EncryptionAlgorithm(C::NAMESPACE); + $encryptionAlgorithm = new EncryptionAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/EncryptionTest.php b/tests/WSSecurity/XML/wst_200502/EncryptionTest.php index e733095e..1fb3d331 100644 --- a/tests/WSSecurity/XML/wst_200502/EncryptionTest.php +++ b/tests/WSSecurity/XML/wst_200502/EncryptionTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractEncryptionType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\Encryption; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $encryption = new Encryption($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/EntropyTest.php b/tests/WSSecurity/XML/wst_200502/EntropyTest.php index 43cf49b2..86b75981 100644 --- a/tests/WSSecurity/XML/wst_200502/EntropyTest.php +++ b/tests/WSSecurity/XML/wst_200502/EntropyTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractEntropyType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -57,10 +59,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr2]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); $entropy = new Entropy([$msgId], [$attr1]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200502/ForwardableTest.php b/tests/WSSecurity/XML/wst_200502/ForwardableTest.php index 065cfa1e..b15c2d12 100644 --- a/tests/WSSecurity/XML/wst_200502/ForwardableTest.php +++ b/tests/WSSecurity/XML/wst_200502/ForwardableTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; @@ -51,7 +52,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $forwardable = new Forwardable('true'); + $forwardable = new Forwardable(BooleanValue::fromBoolean(true)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/IssuedTokensTest.php b/tests/WSSecurity/XML/wst_200502/IssuedTokensTest.php index 6dfdb8d3..858d542d 100644 --- a/tests/WSSecurity/XML/wst_200502/IssuedTokensTest.php +++ b/tests/WSSecurity/XML/wst_200502/IssuedTokensTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\AbstractEndpointReferenceType; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -58,16 +60,23 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $requestSecurityTokenResponse = new RequestSecurityTokenResponse(C::NAMESPACE, [$msgId], [$attr2]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); + $requestSecurityTokenResponse = new RequestSecurityTokenResponse( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $issuedTokens = new IssuedTokens( [$requestSecurityTokenResponse], - [$attr3], + [$attr2], ); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200502/IssuerTest.php b/tests/WSSecurity/XML/wst_200502/IssuerTest.php index c7aae1ea..0ca5fd05 100644 --- a/tests/WSSecurity/XML/wst_200502/IssuerTest.php +++ b/tests/WSSecurity/XML/wst_200502/IssuerTest.php @@ -17,6 +17,8 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -34,6 +36,7 @@ final class IssuerTest extends TestCase { use SerializableElementTestTrait; + /** @var \DOMElement $referenceParametersContent */ protected static DOMElement $referenceParametersContent; @@ -72,14 +75,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); $chunk = new Chunk(self::$customContent); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), null, $referenceParameters, null, diff --git a/tests/WSSecurity/XML/wst_200502/KeyExchangeTokenTest.php b/tests/WSSecurity/XML/wst_200502/KeyExchangeTokenTest.php index 109fc2de..5039885d 100644 --- a/tests/WSSecurity/XML/wst_200502/KeyExchangeTokenTest.php +++ b/tests/WSSecurity/XML/wst_200502/KeyExchangeTokenTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractKeyExchangeTokenType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\KeyExchangeToken; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $keyExchangeToken = new KeyExchangeToken([$msgId]); diff --git a/tests/WSSecurity/XML/wst_200502/KeySizeTest.php b/tests/WSSecurity/XML/wst_200502/KeySizeTest.php index 6d590962..ddcb924e 100644 --- a/tests/WSSecurity/XML/wst_200502/KeySizeTest.php +++ b/tests/WSSecurity/XML/wst_200502/KeySizeTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\UnsignedIntValue; use function dirname; @@ -51,7 +52,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $keySize = new KeySize('4096'); + $keySize = new KeySize(UnsignedIntValue::fromInteger(4096)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/KeyTypeTest.php b/tests/WSSecurity/XML/wst_200502/KeyTypeTest.php index c0d29bcc..705ff092 100644 --- a/tests/WSSecurity/XML/wst_200502/KeyTypeTest.php +++ b/tests/WSSecurity/XML/wst_200502/KeyTypeTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $keyType = new KeyType([KeyTypeEnum::PublicKey]); + $keyType = new KeyType(AnyURIValue::fromString(KeyTypeEnum::PublicKey->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/LifetimeTest.php b/tests/WSSecurity/XML/wst_200502/LifetimeTest.php index 7b8a1483..5a55a465 100644 --- a/tests/WSSecurity/XML/wst_200502/LifetimeTest.php +++ b/tests/WSSecurity/XML/wst_200502/LifetimeTest.php @@ -4,7 +4,6 @@ namespace SimpleSAML\Test\WSSecurity\XML\wst_200502; -use DateTimeImmutable; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -13,6 +12,7 @@ use SimpleSAML\WSSecurity\XML\wst_200502\Lifetime; use SimpleSAML\WSSecurity\XML\wsu\Created; use SimpleSAML\WSSecurity\XML\wsu\Expires; +use SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -56,8 +56,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $created = new Created(new DateTimeImmutable('2001-09-13T08:42:00Z')); - $expires = new Expires(new DateTimeImmutable('2001-10-13T09:00:00Z')); + $created = new Created(DateTimeValue::fromString('2001-09-13T08:42:00Z')); + $expires = new Expires(DateTimeValue::fromString('2001-10-13T09:00:00Z')); $lifetime = new Lifetime($created, $expires); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200502/OnBehalfOfTest.php b/tests/WSSecurity/XML/wst_200502/OnBehalfOfTest.php index 745080ce..432b5c4b 100644 --- a/tests/WSSecurity/XML/wst_200502/OnBehalfOfTest.php +++ b/tests/WSSecurity/XML/wst_200502/OnBehalfOfTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractOnBehalfOfType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\OnBehalfOf; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $onBehalfOf = new OnBehalfOf($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/ParticipantTest.php b/tests/WSSecurity/XML/wst_200502/ParticipantTest.php index b73803ed..317f6cd1 100644 --- a/tests/WSSecurity/XML/wst_200502/ParticipantTest.php +++ b/tests/WSSecurity/XML/wst_200502/ParticipantTest.php @@ -7,14 +7,14 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractParticipantType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\Participant; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,8 +52,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $participant = new Participant($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/ParticipantsTest.php b/tests/WSSecurity/XML/wst_200502/ParticipantsTest.php index 97af1c63..11f0382a 100644 --- a/tests/WSSecurity/XML/wst_200502/ParticipantsTest.php +++ b/tests/WSSecurity/XML/wst_200502/ParticipantsTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractParticipantsType; @@ -15,10 +15,10 @@ use SimpleSAML\WSSecurity\XML\wst_200502\Participant; use SimpleSAML\WSSecurity\XML\wst_200502\Participants; use SimpleSAML\WSSecurity\XML\wst_200502\Primary; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -59,8 +59,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $primary = new Primary($msgId); $participant = new Participant($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/PrimaryTest.php b/tests/WSSecurity/XML/wst_200502/PrimaryTest.php index 7aa94f55..ad247821 100644 --- a/tests/WSSecurity/XML/wst_200502/PrimaryTest.php +++ b/tests/WSSecurity/XML/wst_200502/PrimaryTest.php @@ -7,14 +7,14 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractParticipantType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\Primary; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,8 +52,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $primary = new Primary($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/ProofEncryptionTest.php b/tests/WSSecurity/XML/wst_200502/ProofEncryptionTest.php index 2748339c..e9b4430c 100644 --- a/tests/WSSecurity/XML/wst_200502/ProofEncryptionTest.php +++ b/tests/WSSecurity/XML/wst_200502/ProofEncryptionTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractProofEncryptionType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\ProofEncryption; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $proofEncryption = new ProofEncryption($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/ReasonTest.php b/tests/WSSecurity/XML/wst_200502/ReasonTest.php index 8ee6987b..c250d9e8 100644 --- a/tests/WSSecurity/XML/wst_200502/ReasonTest.php +++ b/tests/WSSecurity/XML/wst_200502/ReasonTest.php @@ -11,6 +11,7 @@ use SimpleSAML\WSSecurity\XML\wst_200502\Reason; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -47,7 +48,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $reason = new Reason('phpunit'); + $reason = new Reason(StringValue::fromString('phpunit')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/RenewTargetTest.php b/tests/WSSecurity/XML/wst_200502/RenewTargetTest.php index 03e97983..0dbea66d 100644 --- a/tests/WSSecurity/XML/wst_200502/RenewTargetTest.php +++ b/tests/WSSecurity/XML/wst_200502/RenewTargetTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRenewTargetType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\RenewTarget; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $renewTarget = new RenewTarget($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/RenewingTest.php b/tests/WSSecurity/XML/wst_200502/RenewingTest.php index 2f61f1f5..650e706a 100644 --- a/tests/WSSecurity/XML/wst_200502/RenewingTest.php +++ b/tests/WSSecurity/XML/wst_200502/RenewingTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $renewing = new Renewing(true, false); + $renewing = new Renewing(BooleanValue::fromBoolean(true), BooleanValue::fromBoolean(false)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseCollectionTest.php b/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseCollectionTest.php index 582232f2..9a78f9d6 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseCollectionTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseCollectionTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRequestSecurityTokenResponseCollectionType; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -58,16 +60,23 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $requestSecurityTokenResponse = new RequestSecurityTokenResponse(C::NAMESPACE, [$msgId], [$attr2]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); + $requestSecurityTokenResponse = new RequestSecurityTokenResponse( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $requestSecurityTokenResponseCollection = new RequestSecurityTokenResponseCollection( [$requestSecurityTokenResponse], - [$attr3], + [$attr2], ); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseTest.php b/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseTest.php index 3ae0f45b..03ebdac9 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenResponseTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRequestSecurityTokenResponseType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -57,15 +59,22 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $RequestSecurityTokenResponse = new RequestSecurityTokenResponse(C::NAMESPACE, [$msgId], [$attr2]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $requestSecurityTokenResponse = new RequestSecurityTokenResponse( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($RequestSecurityTokenResponse), + strval($requestSecurityTokenResponse), ); } @@ -75,8 +84,8 @@ public function testMarshalling(): void */ public function testMarshallingEmpty(): void { - $RequestSecurityTokenResponse = new RequestSecurityTokenResponse(); + $requestSecurityTokenResponse = new RequestSecurityTokenResponse(); - $this->assertTrue($RequestSecurityTokenResponse->isEmptyElement()); + $this->assertTrue($requestSecurityTokenResponse->isEmptyElement()); } } diff --git a/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenTest.php b/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenTest.php index 6308484d..f345fed6 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestSecurityTokenTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRequestSecurityTokenType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -57,15 +59,22 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $RequestSecurityToken = new RequestSecurityToken(C::NAMESPACE, [$msgId], [$attr2]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $requestSecurityToken = new RequestSecurityToken( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($RequestSecurityToken), + strval($requestSecurityToken), ); } @@ -75,8 +84,8 @@ public function testMarshalling(): void */ public function testMarshallingEmpty(): void { - $RequestSecurityToken = new RequestSecurityToken(); + $requestSecurityToken = new RequestSecurityToken(); - $this->assertTrue($RequestSecurityToken->isEmptyElement()); + $this->assertTrue($requestSecurityToken->isEmptyElement()); } } diff --git a/tests/WSSecurity/XML/wst_200502/RequestTypeTest.php b/tests/WSSecurity/XML/wst_200502/RequestTypeTest.php index 933cd1b8..6d0604c3 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestTypeTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestTypeTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,7 +55,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $requestType = new RequestType([RequestTypeEnum::Issue]); + $requestType = new RequestType(AnyURIValue::fromString(RequestTypeEnum::Issue->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/RequestedAttachedReferenceTest.php b/tests/WSSecurity/XML/wst_200502/RequestedAttachedReferenceTest.php index bdc2b463..fada2320 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestedAttachedReferenceTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestedAttachedReferenceTest.php @@ -11,11 +11,14 @@ use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRequestedReferenceType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\RequestedAttachedReference; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,14 +59,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $securityTokenReference = new SecurityTokenReference( - 'SomeID', - 'SomeUsage', + IDValue::fromString('SomeID'), + AnyURIValue::fromString('SomeUsage'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/wst_200502/RequestedProofTokenTest.php b/tests/WSSecurity/XML/wst_200502/RequestedProofTokenTest.php index fd6ee803..be97d25f 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestedProofTokenTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestedProofTokenTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRequestedProofTokenType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\RequestedProofToken; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $requestedProofToken = new RequestedProofToken($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/RequestedSecurityTokenTest.php b/tests/WSSecurity/XML/wst_200502/RequestedSecurityTokenTest.php index 949cecba..ef5fa80e 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestedSecurityTokenTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestedSecurityTokenTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRequestedSecurityTokenType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\RequestedSecurityToken; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -56,8 +56,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $requestedSecurityToken = new RequestedSecurityToken($msgId); diff --git a/tests/WSSecurity/XML/wst_200502/RequestedUnattachedReferenceTest.php b/tests/WSSecurity/XML/wst_200502/RequestedUnattachedReferenceTest.php index 24c238bb..f13717bd 100644 --- a/tests/WSSecurity/XML/wst_200502/RequestedUnattachedReferenceTest.php +++ b/tests/WSSecurity/XML/wst_200502/RequestedUnattachedReferenceTest.php @@ -11,11 +11,14 @@ use SimpleSAML\WSSecurity\XML\wst_200502\AbstractRequestedReferenceType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\RequestedUnattachedReference; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,14 +59,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $securityTokenReference = new SecurityTokenReference( - 'SomeID', - 'SomeUsage', + IDValue::fromString('SomeID'), + AnyURIValue::fromString('SomeUsage'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/wst_200502/SignChallengeResponseTest.php b/tests/WSSecurity/XML/wst_200502/SignChallengeResponseTest.php index 59ee1f1f..3ed82a55 100644 --- a/tests/WSSecurity/XML/wst_200502/SignChallengeResponseTest.php +++ b/tests/WSSecurity/XML/wst_200502/SignChallengeResponseTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractSignChallengeType; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -58,13 +60,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $challenge = new Challenge('accepted'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); + $challenge = new Challenge(StringValue::fromString('accepted')); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); - $signChallengeResponse = new SignChallengeResponse($challenge, [$msgId], [$attr2]); + $signChallengeResponse = new SignChallengeResponse($challenge, [$msgId], [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/SignChallengeTest.php b/tests/WSSecurity/XML/wst_200502/SignChallengeTest.php index fe5999de..90f4b21e 100644 --- a/tests/WSSecurity/XML/wst_200502/SignChallengeTest.php +++ b/tests/WSSecurity/XML/wst_200502/SignChallengeTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractSignChallengeType; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -58,12 +60,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $challenge = new Challenge('accepted'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $signChallenge = new SignChallenge($challenge, [$msgId], [$attr2]); + $challenge = new Challenge(StringValue::fromString('accepted')); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $signChallenge = new SignChallenge($challenge, [$msgId], [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/SignWithTest.php b/tests/WSSecurity/XML/wst_200502/SignWithTest.php index bcb8f67a..6e1046f5 100644 --- a/tests/WSSecurity/XML/wst_200502/SignWithTest.php +++ b/tests/WSSecurity/XML/wst_200502/SignWithTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $signWith = new SignWith(C::NAMESPACE); + $signWith = new SignWith(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/SignatureAlgorithmTest.php b/tests/WSSecurity/XML/wst_200502/SignatureAlgorithmTest.php index 024c7781..1b96391f 100644 --- a/tests/WSSecurity/XML/wst_200502/SignatureAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200502/SignatureAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $signatureAlgorithm = new SignatureAlgorithm(C::NAMESPACE); + $signatureAlgorithm = new SignatureAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/StatusTest.php b/tests/WSSecurity/XML/wst_200502/StatusTest.php index 765889c5..8d27dfdb 100644 --- a/tests/WSSecurity/XML/wst_200502/StatusTest.php +++ b/tests/WSSecurity/XML/wst_200502/StatusTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,8 +58,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $code = new Code([StatusCodeEnum::Invalid]); - $reason = new Reason('phpunit'); + $code = new Code(AnyURIValue::fromString(StatusCodeEnum::Invalid->value)); + $reason = new Reason(StringValue::fromString('phpunit')); $status = new Status($code, $reason); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200502/TokenTypeTest.php b/tests/WSSecurity/XML/wst_200502/TokenTypeTest.php index af796ab4..4650d717 100644 --- a/tests/WSSecurity/XML/wst_200502/TokenTypeTest.php +++ b/tests/WSSecurity/XML/wst_200502/TokenTypeTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $tokenType = new TokenType(C::NAMESPACE); + $tokenType = new TokenType(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200502/UseKeyTest.php b/tests/WSSecurity/XML/wst_200502/UseKeyTest.php index b28ac832..0b4c5fdd 100644 --- a/tests/WSSecurity/XML/wst_200502/UseKeyTest.php +++ b/tests/WSSecurity/XML/wst_200502/UseKeyTest.php @@ -7,16 +7,16 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200408\MessageID; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractUseKeyType; use SimpleSAML\WSSecurity\XML\wst_200502\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200502\UseKey; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -57,10 +57,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $useKey = new UseKey($msgId, C::NAMESPACE); + $useKey = new UseKey($msgId, AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/AuthenticationTypeTest.php b/tests/WSSecurity/XML/wst_200512/AuthenticationTypeTest.php index e77466d3..d2ece971 100644 --- a/tests/WSSecurity/XML/wst_200512/AuthenticationTypeTest.php +++ b/tests/WSSecurity/XML/wst_200512/AuthenticationTypeTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $authenticationType = new AuthenticationType(C::NAMESPACE); + $authenticationType = new AuthenticationType(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/AuthenticatorTest.php b/tests/WSSecurity/XML/wst_200512/AuthenticatorTest.php index 0d03fe34..d506fa0c 100644 --- a/tests/WSSecurity/XML/wst_200512/AuthenticatorTest.php +++ b/tests/WSSecurity/XML/wst_200512/AuthenticatorTest.php @@ -7,16 +7,17 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractAuthenticatorType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\Authenticator; use SimpleSAML\WSSecurity\XML\wst_200512\CombinedHash; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use function dirname; @@ -55,10 +56,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $combinedHash = new CombinedHash('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); + $combinedHash = new CombinedHash( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + ); $authenticator = new Authenticator($combinedHash, [$msgId]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200512/BinaryExchangeTest.php b/tests/WSSecurity/XML/wst_200512/BinaryExchangeTest.php index 8fcadef8..2b137187 100644 --- a/tests/WSSecurity/XML/wst_200512/BinaryExchangeTest.php +++ b/tests/WSSecurity/XML/wst_200512/BinaryExchangeTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -53,8 +55,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $binaryExchange = new BinaryExchange('phpunit', C::NAMESPACE, C::NAMESPACE, [$attr1]); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $binaryExchange = new BinaryExchange( + StringValue::fromString('phpunit'), + AnyURIValue::fromString(C::NAMESPACE), + AnyURIValue::fromString(C::NAMESPACE), + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/BinarySecretTest.php b/tests/WSSecurity/XML/wst_200512/BinarySecretTest.php index a5b19927..258775ef 100644 --- a/tests/WSSecurity/XML/wst_200512/BinarySecretTest.php +++ b/tests/WSSecurity/XML/wst_200512/BinarySecretTest.php @@ -16,6 +16,9 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -54,11 +57,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); $binarySecret = new BinarySecret( - '/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=', - [BinarySecretTypeEnum::Nonce], + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + AnyURIValue::fromString(BinarySecretTypeEnum::Nonce->value), [$attr1], ); diff --git a/tests/WSSecurity/XML/wst_200512/CancelTargetTest.php b/tests/WSSecurity/XML/wst_200512/CancelTargetTest.php index 02e77a84..543119d3 100644 --- a/tests/WSSecurity/XML/wst_200512/CancelTargetTest.php +++ b/tests/WSSecurity/XML/wst_200512/CancelTargetTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractCancelTargetType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\CancelTarget; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $cancelTarget = new CancelTarget($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/CanonicalizationAlgorithmTest.php b/tests/WSSecurity/XML/wst_200512/CanonicalizationAlgorithmTest.php index 6ad5c162..2637191b 100644 --- a/tests/WSSecurity/XML/wst_200512/CanonicalizationAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200512/CanonicalizationAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $canonicalizationAlgorithm = new CanonicalizationAlgorithm(C::NAMESPACE); + $canonicalizationAlgorithm = new CanonicalizationAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/ChallengeTest.php b/tests/WSSecurity/XML/wst_200512/ChallengeTest.php index d6696b40..da8880cf 100644 --- a/tests/WSSecurity/XML/wst_200512/ChallengeTest.php +++ b/tests/WSSecurity/XML/wst_200512/ChallengeTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -49,7 +50,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $challenge = new Challenge('accepted'); + $challenge = new Challenge(StringValue::fromString('accepted')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/ClaimsTest.php b/tests/WSSecurity/XML/wst_200512/ClaimsTest.php index b008bad1..6a768b81 100644 --- a/tests/WSSecurity/XML/wst_200512/ClaimsTest.php +++ b/tests/WSSecurity/XML/wst_200512/ClaimsTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractClaimsType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,11 +57,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr2]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $claims = new Claims(C::NAMESPACE, [$msgId], [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $claims = new Claims(AnyURIValue::fromString(C::NAMESPACE), [$msgId], [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/CodeTest.php b/tests/WSSecurity/XML/wst_200512/CodeTest.php index 657c110c..553d142f 100644 --- a/tests/WSSecurity/XML/wst_200512/CodeTest.php +++ b/tests/WSSecurity/XML/wst_200512/CodeTest.php @@ -13,6 +13,7 @@ use SimpleSAML\WSSecurity\XML\wst_200512\StatusCodeEnum; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $code = new Code([StatusCodeEnum::Invalid]); + $code = new Code(AnyURIValue::fromString(StatusCodeEnum::Invalid->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/CombinedHashTest.php b/tests/WSSecurity/XML/wst_200512/CombinedHashTest.php index 5c3166c2..96e04356 100644 --- a/tests/WSSecurity/XML/wst_200512/CombinedHashTest.php +++ b/tests/WSSecurity/XML/wst_200512/CombinedHashTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use function dirname; @@ -49,7 +50,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $combinedHash = new CombinedHash('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); + $combinedHash = new CombinedHash( + Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/ComputedKeyAlgorithmTest.php b/tests/WSSecurity/XML/wst_200512/ComputedKeyAlgorithmTest.php index bded6219..dd28eead 100644 --- a/tests/WSSecurity/XML/wst_200512/ComputedKeyAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200512/ComputedKeyAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $computedKeyAlgorithm = new ComputedKeyAlgorithm(C::NAMESPACE); + $computedKeyAlgorithm = new ComputedKeyAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/ComputedKeyTest.php b/tests/WSSecurity/XML/wst_200512/ComputedKeyTest.php index 86962494..cfc17f32 100644 --- a/tests/WSSecurity/XML/wst_200512/ComputedKeyTest.php +++ b/tests/WSSecurity/XML/wst_200512/ComputedKeyTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $computedKey = new ComputedKey([ComputedKeyEnum::PSHA1]); + $computedKey = new ComputedKey(AnyURIValue::fromString(ComputedKeyEnum::PSHA1->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/DelegatableTest.php b/tests/WSSecurity/XML/wst_200512/DelegatableTest.php index 39e01186..7c731c69 100644 --- a/tests/WSSecurity/XML/wst_200512/DelegatableTest.php +++ b/tests/WSSecurity/XML/wst_200512/DelegatableTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; @@ -49,7 +50,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $delegatable = new Delegatable('true'); + $delegatable = new Delegatable(BooleanValue::fromBoolean(true)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/DelegateToTest.php b/tests/WSSecurity/XML/wst_200512/DelegateToTest.php index 5af350c4..abea0913 100644 --- a/tests/WSSecurity/XML/wst_200512/DelegateToTest.php +++ b/tests/WSSecurity/XML/wst_200512/DelegateToTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractDelegateToType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\DelegateTo; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $delegateTo = new DelegateTo($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/EncryptWithTest.php b/tests/WSSecurity/XML/wst_200512/EncryptWithTest.php index 0466e9cd..839d7fff 100644 --- a/tests/WSSecurity/XML/wst_200512/EncryptWithTest.php +++ b/tests/WSSecurity/XML/wst_200512/EncryptWithTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $encryptWith = new EncryptWith(C::NAMESPACE); + $encryptWith = new EncryptWith(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/EncryptionAlgorithmTest.php b/tests/WSSecurity/XML/wst_200512/EncryptionAlgorithmTest.php index fa474c32..0fd1a837 100644 --- a/tests/WSSecurity/XML/wst_200512/EncryptionAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200512/EncryptionAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $encryptionAlgorithm = new EncryptionAlgorithm(C::NAMESPACE); + $encryptionAlgorithm = new EncryptionAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/EncryptionTest.php b/tests/WSSecurity/XML/wst_200512/EncryptionTest.php index a013c61a..9b199d5f 100644 --- a/tests/WSSecurity/XML/wst_200512/EncryptionTest.php +++ b/tests/WSSecurity/XML/wst_200512/EncryptionTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractEncryptionType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\Encryption; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $encryption = new Encryption($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/EntropyTest.php b/tests/WSSecurity/XML/wst_200512/EntropyTest.php index a14e9901..f310bfb7 100644 --- a/tests/WSSecurity/XML/wst_200512/EntropyTest.php +++ b/tests/WSSecurity/XML/wst_200512/EntropyTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractEntropyType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,10 +57,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr2 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr2]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); $entropy = new Entropy([$msgId], [$attr1]); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200512/ForwardableTest.php b/tests/WSSecurity/XML/wst_200512/ForwardableTest.php index 66b917c7..25b4bbb3 100644 --- a/tests/WSSecurity/XML/wst_200512/ForwardableTest.php +++ b/tests/WSSecurity/XML/wst_200512/ForwardableTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; @@ -49,7 +50,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $forwardable = new Forwardable('true'); + $forwardable = new Forwardable(BooleanValue::fromBoolean(true)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/IssuedTokensTest.php b/tests/WSSecurity/XML/wst_200512/IssuedTokensTest.php index 69c6ba86..61ed42ca 100644 --- a/tests/WSSecurity/XML/wst_200512/IssuedTokensTest.php +++ b/tests/WSSecurity/XML/wst_200512/IssuedTokensTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\AbstractEndpointReferenceType; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,16 +58,23 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $requestSecurityTokenResponse = new RequestSecurityTokenResponse(C::NAMESPACE, [$msgId], [$attr2]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); + $requestSecurityTokenResponse = new RequestSecurityTokenResponse( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $issuedTokens = new IssuedTokens( [$requestSecurityTokenResponse], - [$attr3], + [$attr2], ); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200512/IssuerTest.php b/tests/WSSecurity/XML/wst_200512/IssuerTest.php index 67d8a74b..0a34641f 100644 --- a/tests/WSSecurity/XML/wst_200512/IssuerTest.php +++ b/tests/WSSecurity/XML/wst_200512/IssuerTest.php @@ -18,6 +18,8 @@ use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -35,6 +37,7 @@ final class IssuerTest extends TestCase { use SerializableElementTestTrait; + /** @var \DOMElement $referenceParametersContent */ protected static DOMElement $referenceParametersContent; @@ -77,17 +80,20 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); - $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', 'value3'); - $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', 'value4'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); + $attr3 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test3', StringValue::fromString('value3')); + $attr4 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test4', StringValue::fromString('value4')); $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)], [$attr4]); $metadata = new Metadata([new Chunk(self::$metadataContent)], [$attr3]); $chunk = new Chunk(self::$customContent); $issuer = new Issuer( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address( + AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), + [$attr2], + ), $referenceParameters, $metadata, [$chunk], diff --git a/tests/WSSecurity/XML/wst_200512/KeyExchangeTokenTest.php b/tests/WSSecurity/XML/wst_200512/KeyExchangeTokenTest.php index 7a9f4885..6cb92af0 100644 --- a/tests/WSSecurity/XML/wst_200512/KeyExchangeTokenTest.php +++ b/tests/WSSecurity/XML/wst_200512/KeyExchangeTokenTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractKeyExchangeTokenType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\KeyExchangeToken; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $keyExchangeToken = new KeyExchangeToken([$msgId]); diff --git a/tests/WSSecurity/XML/wst_200512/KeySizeTest.php b/tests/WSSecurity/XML/wst_200512/KeySizeTest.php index d90f374b..14a812ed 100644 --- a/tests/WSSecurity/XML/wst_200512/KeySizeTest.php +++ b/tests/WSSecurity/XML/wst_200512/KeySizeTest.php @@ -12,6 +12,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\UnsignedIntValue; use function dirname; @@ -49,7 +50,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $keySize = new KeySize('4096'); + $keySize = new KeySize(UnsignedIntValue::fromInteger(4096)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/KeyTypeTest.php b/tests/WSSecurity/XML/wst_200512/KeyTypeTest.php index 48ebfbf6..6481c408 100644 --- a/tests/WSSecurity/XML/wst_200512/KeyTypeTest.php +++ b/tests/WSSecurity/XML/wst_200512/KeyTypeTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $keyType = new KeyType([KeyTypeEnum::PublicKey]); + $keyType = new KeyType(AnyURIValue::fromString(KeyTypeEnum::PublicKey->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/KeyWrapAlgorithmTest.php b/tests/WSSecurity/XML/wst_200512/KeyWrapAlgorithmTest.php index a14cf062..23d74d08 100644 --- a/tests/WSSecurity/XML/wst_200512/KeyWrapAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200512/KeyWrapAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $keyWrapAlgorithm = new KeyWrapAlgorithm(C::NAMESPACE); + $keyWrapAlgorithm = new KeyWrapAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/LifetimeTest.php b/tests/WSSecurity/XML/wst_200512/LifetimeTest.php index ffacfbad..2b48f45a 100644 --- a/tests/WSSecurity/XML/wst_200512/LifetimeTest.php +++ b/tests/WSSecurity/XML/wst_200512/LifetimeTest.php @@ -4,7 +4,6 @@ namespace SimpleSAML\Test\WSSecurity\XML\wst_200512; -use DateTimeImmutable; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -13,6 +12,7 @@ use SimpleSAML\WSSecurity\XML\wst_200512\Lifetime; use SimpleSAML\WSSecurity\XML\wsu\Created; use SimpleSAML\WSSecurity\XML\wsu\Expires; +use SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -54,8 +54,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $created = new Created(new DateTimeImmutable('2001-09-13T08:42:00Z')); - $expires = new Expires(new DateTimeImmutable('2001-10-13T09:00:00Z')); + $created = new Created(DateTimeValue::fromString('2001-09-13T08:42:00Z')); + $expires = new Expires(DateTimeValue::fromString('2001-10-13T09:00:00Z')); $lifetime = new Lifetime($created, $expires); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200512/OnBehalfOfTest.php b/tests/WSSecurity/XML/wst_200512/OnBehalfOfTest.php index 91361557..5b02e06a 100644 --- a/tests/WSSecurity/XML/wst_200512/OnBehalfOfTest.php +++ b/tests/WSSecurity/XML/wst_200512/OnBehalfOfTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractOnBehalfOfType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\OnBehalfOf; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $onBehalfOf = new OnBehalfOf($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/ParticipantTest.php b/tests/WSSecurity/XML/wst_200512/ParticipantTest.php index 89aa30da..a3899052 100644 --- a/tests/WSSecurity/XML/wst_200512/ParticipantTest.php +++ b/tests/WSSecurity/XML/wst_200512/ParticipantTest.php @@ -7,14 +7,14 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractParticipantType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\Participant; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,8 +52,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $participant = new Participant($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/ParticipantsTest.php b/tests/WSSecurity/XML/wst_200512/ParticipantsTest.php index adb70862..c93bf708 100644 --- a/tests/WSSecurity/XML/wst_200512/ParticipantsTest.php +++ b/tests/WSSecurity/XML/wst_200512/ParticipantsTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractParticipantsType; @@ -15,10 +15,10 @@ use SimpleSAML\WSSecurity\XML\wst_200512\Participant; use SimpleSAML\WSSecurity\XML\wst_200512\Participants; use SimpleSAML\WSSecurity\XML\wst_200512\Primary; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -57,8 +57,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $primary = new Primary($msgId); $participant = new Participant($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/PrimaryTest.php b/tests/WSSecurity/XML/wst_200512/PrimaryTest.php index 46ba105f..d06a2936 100644 --- a/tests/WSSecurity/XML/wst_200512/PrimaryTest.php +++ b/tests/WSSecurity/XML/wst_200512/PrimaryTest.php @@ -7,14 +7,14 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractParticipantType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\Primary; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,8 +52,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $primary = new Primary($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/ProofEncryptionTest.php b/tests/WSSecurity/XML/wst_200512/ProofEncryptionTest.php index 23dd4877..be53f1e9 100644 --- a/tests/WSSecurity/XML/wst_200512/ProofEncryptionTest.php +++ b/tests/WSSecurity/XML/wst_200512/ProofEncryptionTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractProofEncryptionType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\ProofEncryption; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $proofEncryption = new ProofEncryption($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/ReasonTest.php b/tests/WSSecurity/XML/wst_200512/ReasonTest.php index d778efad..d289b548 100644 --- a/tests/WSSecurity/XML/wst_200512/ReasonTest.php +++ b/tests/WSSecurity/XML/wst_200512/ReasonTest.php @@ -11,6 +11,7 @@ use SimpleSAML\WSSecurity\XML\wst_200512\Reason; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -47,7 +48,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $reason = new Reason('phpunit'); + $reason = new Reason(StringValue::fromString('phpunit')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/RenewTargetTest.php b/tests/WSSecurity/XML/wst_200512/RenewTargetTest.php index 79f80d76..e6b510a0 100644 --- a/tests/WSSecurity/XML/wst_200512/RenewTargetTest.php +++ b/tests/WSSecurity/XML/wst_200512/RenewTargetTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRenewTargetType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\RenewTarget; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $renewTarget = new RenewTarget($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/RenewingTest.php b/tests/WSSecurity/XML/wst_200512/RenewingTest.php index e0869366..a57dc7ed 100644 --- a/tests/WSSecurity/XML/wst_200512/RenewingTest.php +++ b/tests/WSSecurity/XML/wst_200512/RenewingTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; @@ -51,7 +52,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $renewing = new Renewing(true, false); + $renewing = new Renewing( + BooleanValue::fromBoolean(true), + BooleanValue::fromBoolean(false), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenCollectionTest.php b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenCollectionTest.php index 31a29747..cc28eb4d 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenCollectionTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenCollectionTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestSecurityTokenCollectionType; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,14 +58,20 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); - $msgId1 = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); - $msgId2 = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7df', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId1 = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); + $msgId2 = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7df'), + [$mustUnderstand->toAttribute()], + ); - $requestSecurityToken1 = new RequestSecurityToken(C::NAMESPACE, [$msgId1], [$attr2]); - $requestSecurityToken2 = new RequestSecurityToken(C::NAMESPACE, [$msgId2], [$attr3]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); + $requestSecurityToken1 = new RequestSecurityToken(AnyURIValue::fromString(C::NAMESPACE), [$msgId1], [$attr1]); + $requestSecurityToken2 = new RequestSecurityToken(AnyURIValue::fromSTring(C::NAMESPACE), [$msgId2], [$attr2]); $requestSecurityTokenCollection = new RequestSecurityTokenCollection([ $requestSecurityToken1, diff --git a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseCollectionTest.php b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseCollectionTest.php index acff6f7e..7b3cf187 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseCollectionTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseCollectionTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestSecurityTokenResponseCollectionType; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,16 +58,23 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $attr3 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', 'testval2'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $requestSecurityTokenResponse = new RequestSecurityTokenResponse(C::NAMESPACE, [$msgId], [$attr2]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr2', StringValue::fromString('testval2')); + $requestSecurityTokenResponse = new RequestSecurityTokenResponse( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $requestSecurityTokenResponseCollection = new RequestSecurityTokenResponseCollection( [$requestSecurityTokenResponse], - [$attr3], + [$attr2], ); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseTest.php b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseTest.php index 0a789498..96c59ab1 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenResponseTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestSecurityTokenResponseType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,15 +57,22 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $RequestSecurityTokenResponse = new RequestSecurityTokenResponse(C::NAMESPACE, [$msgId], [$attr2]); + $requestSecurityTokenResponse = new RequestSecurityTokenResponse( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($RequestSecurityTokenResponse), + strval($requestSecurityTokenResponse), ); } diff --git a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenTest.php b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenTest.php index d05a3919..86c12da4 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestSecurityTokenTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestSecurityTokenType; @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -55,15 +57,22 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $RequestSecurityToken = new RequestSecurityToken(C::NAMESPACE, [$msgId], [$attr2]); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $requestSecurityToken = new RequestSecurityToken( + AnyURIValue::fromString(C::NAMESPACE), + [$msgId], + [$attr1], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($RequestSecurityToken), + strval($requestSecurityToken), ); } @@ -73,8 +82,8 @@ public function testMarshalling(): void */ public function testMarshallingEmpty(): void { - $RequestSecurityToken = new RequestSecurityToken(); + $requestSecurityToken = new RequestSecurityToken(); - $this->assertTrue($RequestSecurityToken->isEmptyElement()); + $this->assertTrue($requestSecurityToken->isEmptyElement()); } } diff --git a/tests/WSSecurity/XML/wst_200512/RequestTypeTest.php b/tests/WSSecurity/XML/wst_200512/RequestTypeTest.php index aca16e70..cd98f3d0 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestTypeTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestTypeTest.php @@ -14,6 +14,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -52,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $requestType = new RequestType([RequestTypeEnum::Issue]); + $requestType = new RequestType(AnyURIValue::fromString(RequestTypeEnum::Issue->value)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/RequestedAttachedReferenceTest.php b/tests/WSSecurity/XML/wst_200512/RequestedAttachedReferenceTest.php index 276299d4..e9740105 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestedAttachedReferenceTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestedAttachedReferenceTest.php @@ -11,11 +11,14 @@ use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestedReferenceType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\RequestedAttachedReference; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -54,14 +57,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $securityTokenReference = new SecurityTokenReference( - 'SomeID', - 'SomeUsage', + IDValue::fromString('SomeID'), + AnyURIValue::fromString('SomeUsage'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/wst_200512/RequestedProofTokenTest.php b/tests/WSSecurity/XML/wst_200512/RequestedProofTokenTest.php index 9177ea78..f8314015 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestedProofTokenTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestedProofTokenTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestedProofTokenType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\RequestedProofToken; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $requestedProofToken = new RequestedProofToken($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/RequestedSecurityTokenTest.php b/tests/WSSecurity/XML/wst_200512/RequestedSecurityTokenTest.php index ea0743cf..7ee08173 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestedSecurityTokenTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestedSecurityTokenTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestedSecurityTokenType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\RequestedSecurityToken; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $requestedSecurityToken = new RequestedSecurityToken($msgId); diff --git a/tests/WSSecurity/XML/wst_200512/RequestedUnattachedReferenceTest.php b/tests/WSSecurity/XML/wst_200512/RequestedUnattachedReferenceTest.php index 5e68c0c9..18c34869 100644 --- a/tests/WSSecurity/XML/wst_200512/RequestedUnattachedReferenceTest.php +++ b/tests/WSSecurity/XML/wst_200512/RequestedUnattachedReferenceTest.php @@ -11,11 +11,14 @@ use SimpleSAML\WSSecurity\XML\wst_200512\AbstractRequestedReferenceType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\RequestedUnattachedReference; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -54,14 +57,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $child = DOMDocumentFactory::fromString( 'SomeChunk', ); $securityTokenReference = new SecurityTokenReference( - 'SomeID', - 'SomeUsage', + IDValue::fromString('SomeID'), + AnyURIValue::fromString('SomeUsage'), [new Chunk($child->documentElement)], [$attr1], ); diff --git a/tests/WSSecurity/XML/wst_200512/SignChallengeResponseTest.php b/tests/WSSecurity/XML/wst_200512/SignChallengeResponseTest.php index 4fb5fdc8..19d1e836 100644 --- a/tests/WSSecurity/XML/wst_200512/SignChallengeResponseTest.php +++ b/tests/WSSecurity/XML/wst_200512/SignChallengeResponseTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractSignChallengeType; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,13 +58,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $challenge = new Challenge('accepted'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); + $challenge = new Challenge(StringValue::fromString('accepted')); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); - $signChallengeResponse = new SignChallengeResponse($challenge, [$msgId], [$attr2]); + $signChallengeResponse = new SignChallengeResponse($challenge, [$msgId], [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/SignChallengeTest.php b/tests/WSSecurity/XML/wst_200512/SignChallengeTest.php index 21cb8657..ea22c2c6 100644 --- a/tests/WSSecurity/XML/wst_200512/SignChallengeTest.php +++ b/tests/WSSecurity/XML/wst_200512/SignChallengeTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractSignChallengeType; @@ -18,6 +18,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -56,12 +58,15 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $challenge = new Challenge('accepted'); - $attr2 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'testval1'); - $signChallenge = new SignChallenge($challenge, [$msgId], [$attr2]); + $challenge = new Challenge(StringValue::fromString('accepted')); + $attr1 = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('testval1')); + $signChallenge = new SignChallenge($challenge, [$msgId], [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/SignWithTest.php b/tests/WSSecurity/XML/wst_200512/SignWithTest.php index b39f2b3f..e0582c55 100644 --- a/tests/WSSecurity/XML/wst_200512/SignWithTest.php +++ b/tests/WSSecurity/XML/wst_200512/SignWithTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $signWith = new SignWith(C::NAMESPACE); + $signWith = new SignWith(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/SignatureAlgorithmTest.php b/tests/WSSecurity/XML/wst_200512/SignatureAlgorithmTest.php index 5d3e58f7..ae441e19 100644 --- a/tests/WSSecurity/XML/wst_200512/SignatureAlgorithmTest.php +++ b/tests/WSSecurity/XML/wst_200512/SignatureAlgorithmTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $signatureAlgorithm = new SignatureAlgorithm(C::NAMESPACE); + $signatureAlgorithm = new SignatureAlgorithm(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/StatusTest.php b/tests/WSSecurity/XML/wst_200512/StatusTest.php index ca3c51bc..9f3d3760 100644 --- a/tests/WSSecurity/XML/wst_200512/StatusTest.php +++ b/tests/WSSecurity/XML/wst_200512/StatusTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; @@ -54,8 +56,8 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $code = new Code([StatusCodeEnum::Invalid]); - $reason = new Reason('phpunit'); + $code = new Code(AnyURIValue::fromString(StatusCodeEnum::Invalid->value)); + $reason = new Reason(StringValue::fromString('phpunit')); $status = new Status($code, $reason); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wst_200512/TokenTypeTest.php b/tests/WSSecurity/XML/wst_200512/TokenTypeTest.php index 085adb30..0b000ae9 100644 --- a/tests/WSSecurity/XML/wst_200512/TokenTypeTest.php +++ b/tests/WSSecurity/XML/wst_200512/TokenTypeTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $tokenType = new TokenType(C::NAMESPACE); + $tokenType = new TokenType(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/UseKeyTest.php b/tests/WSSecurity/XML/wst_200512/UseKeyTest.php index 99ef39c9..6b63f19f 100644 --- a/tests/WSSecurity/XML/wst_200512/UseKeyTest.php +++ b/tests/WSSecurity/XML/wst_200512/UseKeyTest.php @@ -7,16 +7,16 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\Test\WSSecurity\Constants as C; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractUseKeyType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\UseKey; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -55,10 +55,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); - $useKey = new UseKey($msgId, C::NAMESPACE); + $useKey = new UseKey($msgId, AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wst_200512/ValidateTargetTest.php b/tests/WSSecurity/XML/wst_200512/ValidateTargetTest.php index 780eaacc..3c9c9eb5 100644 --- a/tests/WSSecurity/XML/wst_200512/ValidateTargetTest.php +++ b/tests/WSSecurity/XML/wst_200512/ValidateTargetTest.php @@ -7,15 +7,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\WSSecurity\XML\wsa_200508\MessageID; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractValidateTargetType; use SimpleSAML\WSSecurity\XML\wst_200512\AbstractWstElement; use SimpleSAML\WSSecurity\XML\wst_200512\ValidateTarget; -use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -54,8 +54,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute(SOAP::NS_SOAP_ENV_11, 'soapenv', 'mustUnderstand', '1'); - $msgId = new MessageID('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de', [$attr1]); + $mustUnderstand = MustUnderstandValue::fromBoolean(true); + $msgId = new MessageID( + AnyURIValue::fromString('uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de'), + [$mustUnderstand->toAttribute()], + ); $validateTarget = new ValidateTarget($msgId); diff --git a/tests/WSSecurity/XML/wsu/CreatedTest.php b/tests/WSSecurity/XML/wsu/CreatedTest.php index f8358341..ebbc42ab 100644 --- a/tests/WSSecurity/XML/wsu/CreatedTest.php +++ b/tests/WSSecurity/XML/wsu/CreatedTest.php @@ -4,13 +4,13 @@ namespace SimpleSAML\Test\WSSecurity\XML\wsu; -use DateTimeImmutable; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\WSSecurity\XML\wsu\AbstractAttributedDateTime; use SimpleSAML\WSSecurity\XML\wsu\AbstractWsuElement; use SimpleSAML\WSSecurity\XML\wsu\Created; +use SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -53,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $created = new Created(new DateTimeImmutable('2001-09-13T08:42:00Z')); + $created = new Created(DateTimeValue::fromString('2001-09-13T08:42:00Z')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsu/ExpiresTest.php b/tests/WSSecurity/XML/wsu/ExpiresTest.php index 2be5e2db..fcf67f49 100644 --- a/tests/WSSecurity/XML/wsu/ExpiresTest.php +++ b/tests/WSSecurity/XML/wsu/ExpiresTest.php @@ -4,13 +4,13 @@ namespace SimpleSAML\Test\WSSecurity\XML\wsu; -use DateTimeImmutable; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\WSSecurity\XML\wsu\AbstractAttributedDateTime; use SimpleSAML\WSSecurity\XML\wsu\AbstractWsuElement; use SimpleSAML\WSSecurity\XML\wsu\Expires; +use SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -53,7 +53,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $expires = new Expires(new DateTimeImmutable('2001-10-13T09:00:00Z')); + $expires = new Expires(DateTimeValue::fromString('2001-10-13T09:00:00Z')); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsu/TimestampTest.php b/tests/WSSecurity/XML/wsu/TimestampTest.php index 81224846..b542589a 100644 --- a/tests/WSSecurity/XML/wsu/TimestampTest.php +++ b/tests/WSSecurity/XML/wsu/TimestampTest.php @@ -4,7 +4,6 @@ namespace SimpleSAML\Test\WSSecurity\XML\wsu; -use DateTimeImmutable; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; @@ -13,6 +12,8 @@ use SimpleSAML\WSSecurity\XML\wsu\Created; use SimpleSAML\WSSecurity\XML\wsu\Expires; use SimpleSAML\WSSecurity\XML\wsu\Timestamp; +use SimpleSAML\WSSecurity\XML\wsu\Type\DateTimeValue; +use SimpleSAML\WSSecurity\XML\wsu\Type\IDValue; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -55,9 +56,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $created = new Created(new DateTimeImmutable('2001-09-13T08:42:00Z')); - $expires = new Expires(new DateTimeImmutable('2001-10-13T09:00:00Z')); - $timestamp = new Timestamp($created, $expires, 'abc123', [], []); + $created = new Created(DateTimeValue::fromString('2001-09-13T08:42:00Z')); + $expires = new Expires(DateTimeValue::fromString('2001-10-13T09:00:00Z')); + $timestamp = new Timestamp($created, $expires, IDValue::fromString('abc123'), [], []); $this->assertFalse($timestamp->isEmptyElement()); $this->assertEquals( diff --git a/tests/WSSecurity/XML/wsx/DialectTest.php b/tests/WSSecurity/XML/wsx/DialectTest.php index 4b7cd6cc..ed990ffe 100644 --- a/tests/WSSecurity/XML/wsx/DialectTest.php +++ b/tests/WSSecurity/XML/wsx/DialectTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $dialect = new Dialect(C::NAMESPACE); + $dialect = new Dialect(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsx/GetMetadataTest.php b/tests/WSSecurity/XML/wsx/GetMetadataTest.php index 27abde75..5ab39797 100644 --- a/tests/WSSecurity/XML/wsx/GetMetadataTest.php +++ b/tests/WSSecurity/XML/wsx/GetMetadataTest.php @@ -15,6 +15,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -53,11 +55,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $getMetadata = new GetMetadata( - new Dialect('urn:x-simplesamlphp:namespace'), - new Identifier('urn:x-simplesamlphp:namespace'), + new Dialect(AnyURIValue::fromString('urn:x-simplesamlphp:namespace')), + new Identifier(AnyURIValue::fromString('urn:x-simplesamlphp:namespace')), [$attr1], ); diff --git a/tests/WSSecurity/XML/wsx/IdentifierTest.php b/tests/WSSecurity/XML/wsx/IdentifierTest.php index 8001562c..2ec227f8 100644 --- a/tests/WSSecurity/XML/wsx/IdentifierTest.php +++ b/tests/WSSecurity/XML/wsx/IdentifierTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $identifier = new Identifier(C::NAMESPACE); + $identifier = new Identifier(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsx/LocationTest.php b/tests/WSSecurity/XML/wsx/LocationTest.php index 72d14aa7..588f6398 100644 --- a/tests/WSSecurity/XML/wsx/LocationTest.php +++ b/tests/WSSecurity/XML/wsx/LocationTest.php @@ -13,6 +13,7 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function dirname; @@ -50,7 +51,7 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $location = new Location(C::NAMESPACE); + $location = new Location(AnyURIValue::fromString(C::NAMESPACE)); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/WSSecurity/XML/wsx/MetadataReferenceTest.php b/tests/WSSecurity/XML/wsx/MetadataReferenceTest.php index afe27d22..b4894b21 100644 --- a/tests/WSSecurity/XML/wsx/MetadataReferenceTest.php +++ b/tests/WSSecurity/XML/wsx/MetadataReferenceTest.php @@ -17,6 +17,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -34,6 +36,7 @@ final class MetadataReferenceTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMElement $referenceParametersContent */ protected static DOMElement $referenceParametersContent; @@ -68,13 +71,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', 'value1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', 'value2'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test1', StringValue::fromString('value1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'test2', StringValue::fromString('value2')); $chunk = new Chunk(self::$customContent); $endpointReference = new EndpointReference( - new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + new Address(AnyURIValue::fromString('https://login.microsoftonline.com/login.srf'), [$attr2]), null, null, [$chunk], diff --git a/tests/WSSecurity/XML/wsx/MetadataSectionTest.php b/tests/WSSecurity/XML/wsx/MetadataSectionTest.php index 8ab37710..8cf6735a 100644 --- a/tests/WSSecurity/XML/wsx/MetadataSectionTest.php +++ b/tests/WSSecurity/XML/wsx/MetadataSectionTest.php @@ -14,6 +14,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -52,12 +54,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); $metadataSection = new MetadataSection( - new Location('urn:x-simplesamlphp:namespace'), - 'urn:x-simplesamlphp:namespace', - 'urn:x-simplesamlphp:namespace', + new Location(AnyURIValue::fromString('urn:x-simplesamlphp:namespace')), + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), [$attr1], ); diff --git a/tests/WSSecurity/XML/wsx/MetadataTest.php b/tests/WSSecurity/XML/wsx/MetadataTest.php index 03def486..292cf612 100644 --- a/tests/WSSecurity/XML/wsx/MetadataTest.php +++ b/tests/WSSecurity/XML/wsx/MetadataTest.php @@ -16,6 +16,8 @@ use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; @@ -54,17 +56,17 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); - $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', 'testval2'); + $attr1 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')); + $attr2 = new Attribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('testval2')); $child = DOMDocumentFactory::fromString( 'Some', ); $metadataSection = new MetadataSection( - new Location('urn:x-simplesamlphp:namespace'), - 'urn:x-simplesamlphp:namespace', - 'urn:x-simplesamlphp:namespace', + new Location(AnyURIValue::fromString('urn:x-simplesamlphp:namespace')), + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + AnyURIValue::fromString('urn:x-simplesamlphp:namespace'), [$attr2], ); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c66a4c65..8333a485 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,4 +6,4 @@ require_once($projectRoot . '/vendor/autoload.php'); $registry = \SimpleSAML\XML\Registry\ElementRegistry::getInstance(); -$registry->importFromFile(dirname(__FILE__, 2) . '/src/XML/element.registry.php'); +$registry->importFromFile(dirname(__FILE__, 2) . '/classes/element.registry.php'); diff --git a/tests/resources/xml/auth_ConstrainedValueWithValueInRangen.xml b/tests/resources/xml/auth_ConstrainedValueWithValueInRangen.xml index 25fbfbfb..c5312b09 100644 --- a/tests/resources/xml/auth_ConstrainedValueWithValueInRangen.xml +++ b/tests/resources/xml/auth_ConstrainedValueWithValueInRangen.xml @@ -1,7 +1,7 @@ - + - + SomeChunk diff --git a/tests/resources/xml/auth_ConstrainedValueWithValueOneOf.xml b/tests/resources/xml/auth_ConstrainedValueWithValueOneOf.xml index 75b79a5a..4d08c75f 100644 --- a/tests/resources/xml/auth_ConstrainedValueWithValueOneOf.xml +++ b/tests/resources/xml/auth_ConstrainedValueWithValueOneOf.xml @@ -1,9 +1,9 @@ - + - + SomeChunk - + SomeOtherChunk diff --git a/tests/resources/xml/auth_EncryptedValue.xml b/tests/resources/xml/auth_EncryptedValue.xml index d0d1c472..474a5234 100644 --- a/tests/resources/xml/auth_EncryptedValue.xml +++ b/tests/resources/xml/auth_EncryptedValue.xml @@ -1,7 +1,7 @@ - - + + - + diff --git a/tests/resources/xml/auth_ValueGreaterThan.xml b/tests/resources/xml/auth_ValueGreaterThan.xml index 50c21f42..0aa717e3 100644 --- a/tests/resources/xml/auth_ValueGreaterThan.xml +++ b/tests/resources/xml/auth_ValueGreaterThan.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/auth_ValueGreaterThanOrEqual.xml b/tests/resources/xml/auth_ValueGreaterThanOrEqual.xml index 47085c7b..6f1fec1b 100644 --- a/tests/resources/xml/auth_ValueGreaterThanOrEqual.xml +++ b/tests/resources/xml/auth_ValueGreaterThanOrEqual.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/auth_ValueInRangen.xml b/tests/resources/xml/auth_ValueInRangen.xml index c027c9a3..4f29765d 100644 --- a/tests/resources/xml/auth_ValueInRangen.xml +++ b/tests/resources/xml/auth_ValueInRangen.xml @@ -1,6 +1,6 @@ - + - + SomeChunk diff --git a/tests/resources/xml/auth_ValueLessThan.xml b/tests/resources/xml/auth_ValueLessThan.xml index 2ea0e287..0a738662 100644 --- a/tests/resources/xml/auth_ValueLessThan.xml +++ b/tests/resources/xml/auth_ValueLessThan.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/auth_ValueLessThanOrEqual.xml b/tests/resources/xml/auth_ValueLessThanOrEqual.xml index f9ee4739..77000308 100644 --- a/tests/resources/xml/auth_ValueLessThanOrEqual.xml +++ b/tests/resources/xml/auth_ValueLessThanOrEqual.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/auth_ValueOneOfWithStructuredValues.xml b/tests/resources/xml/auth_ValueOneOfWithStructuredValues.xml index aeed7fb2..ecf967fb 100644 --- a/tests/resources/xml/auth_ValueOneOfWithStructuredValues.xml +++ b/tests/resources/xml/auth_ValueOneOfWithStructuredValues.xml @@ -1,8 +1,8 @@ - - + + SomeChunk - + SomeOtherChunk diff --git a/tests/resources/xml/auth_ValueUpperBound.xml b/tests/resources/xml/auth_ValueUpperBound.xml index 76e20866..0f197c84 100644 --- a/tests/resources/xml/auth_ValueUpperBound.xml +++ b/tests/resources/xml/auth_ValueUpperBound.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/fed_ApplicationServiceEndpoint.xml b/tests/resources/xml/fed_ApplicationServiceEndpoint.xml index 186204ce..6f572ddb 100644 --- a/tests/resources/xml/fed_ApplicationServiceEndpoint.xml +++ b/tests/resources/xml/fed_ApplicationServiceEndpoint.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_AttributeServiceEndpoint.xml b/tests/resources/xml/fed_AttributeServiceEndpoint.xml index 360ed792..1cc98632 100644 --- a/tests/resources/xml/fed_AttributeServiceEndpoint.xml +++ b/tests/resources/xml/fed_AttributeServiceEndpoint.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_AttributeServiceEndpoints.xml b/tests/resources/xml/fed_AttributeServiceEndpoints.xml index 55aded81..87a49bd5 100644 --- a/tests/resources/xml/fed_AttributeServiceEndpoints.xml +++ b/tests/resources/xml/fed_AttributeServiceEndpoints.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_ClaimTypesOffered.xml b/tests/resources/xml/fed_ClaimTypesOffered.xml index 9bbfc07c..3ddebce0 100644 --- a/tests/resources/xml/fed_ClaimTypesOffered.xml +++ b/tests/resources/xml/fed_ClaimTypesOffered.xml @@ -1,5 +1,5 @@ - - + + someDisplayName someDescription someDisplayValue diff --git a/tests/resources/xml/fed_ClaimTypesRequested.xml b/tests/resources/xml/fed_ClaimTypesRequested.xml index 6f956868..53b578c3 100644 --- a/tests/resources/xml/fed_ClaimTypesRequested.xml +++ b/tests/resources/xml/fed_ClaimTypesRequested.xml @@ -1,5 +1,5 @@ - - + + someDisplayName someDescription someDisplayValue diff --git a/tests/resources/xml/fed_ClientPseudonym.xml b/tests/resources/xml/fed_ClientPseudonym.xml index 2e6f72a6..4667c010 100644 --- a/tests/resources/xml/fed_ClientPseudonym.xml +++ b/tests/resources/xml/fed_ClientPseudonym.xml @@ -1,6 +1,6 @@ MyPPID MyDisplayName - MyEMail + example@simplesamlphp.org Some diff --git a/tests/resources/xml/fed_EMail.xml b/tests/resources/xml/fed_EMail.xml index 97931a02..7e22c53e 100644 --- a/tests/resources/xml/fed_EMail.xml +++ b/tests/resources/xml/fed_EMail.xml @@ -1 +1 @@ -phpunit +example@simplesamlphp.org diff --git a/tests/resources/xml/fed_FederationMetadata.xml b/tests/resources/xml/fed_FederationMetadata.xml index 811078fa..5867a537 100644 --- a/tests/resources/xml/fed_FederationMetadata.xml +++ b/tests/resources/xml/fed_FederationMetadata.xml @@ -1,5 +1,5 @@ - + Some Other diff --git a/tests/resources/xml/fed_FilterPseudonyms.xml b/tests/resources/xml/fed_FilterPseudonyms.xml index 62fe5774..194a0f21 100644 --- a/tests/resources/xml/fed_FilterPseudonyms.xml +++ b/tests/resources/xml/fed_FilterPseudonyms.xml @@ -1,9 +1,9 @@ - + Basis Relative - + diff --git a/tests/resources/xml/fed_PassiveRequestorEndpoint.xml b/tests/resources/xml/fed_PassiveRequestorEndpoint.xml index 213a89a3..c5d808a4 100644 --- a/tests/resources/xml/fed_PassiveRequestorEndpoint.xml +++ b/tests/resources/xml/fed_PassiveRequestorEndpoint.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_PassiveRequestorEndpoints.xml b/tests/resources/xml/fed_PassiveRequestorEndpoints.xml index e2d380ae..153420f4 100644 --- a/tests/resources/xml/fed_PassiveRequestorEndpoints.xml +++ b/tests/resources/xml/fed_PassiveRequestorEndpoints.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_Pseudonym.xml b/tests/resources/xml/fed_Pseudonym.xml index 2298a7cf..4d8564f0 100644 --- a/tests/resources/xml/fed_Pseudonym.xml +++ b/tests/resources/xml/fed_Pseudonym.xml @@ -1,11 +1,11 @@ - + Basis Relative - 2001-10-13T09:00:00Z + 2001-10-13T09:00:00Z Security diff --git a/tests/resources/xml/fed_PseudonymServiceEndpoint.xml b/tests/resources/xml/fed_PseudonymServiceEndpoint.xml index 48f3bfd9..ee323780 100644 --- a/tests/resources/xml/fed_PseudonymServiceEndpoint.xml +++ b/tests/resources/xml/fed_PseudonymServiceEndpoint.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_PseudonymServiceEndpoints.xml b/tests/resources/xml/fed_PseudonymServiceEndpoints.xml index 2f5715b3..46262e6c 100644 --- a/tests/resources/xml/fed_PseudonymServiceEndpoints.xml +++ b/tests/resources/xml/fed_PseudonymServiceEndpoints.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_ReferenceEPR.xml b/tests/resources/xml/fed_ReferenceEPR.xml index e5cf7b91..d5b2c02f 100644 --- a/tests/resources/xml/fed_ReferenceEPR.xml +++ b/tests/resources/xml/fed_ReferenceEPR.xml @@ -1,12 +1,12 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Pears - - + + Apples diff --git a/tests/resources/xml/fed_SecurityTokenServiceEndpoint.xml b/tests/resources/xml/fed_SecurityTokenServiceEndpoint.xml index 0b9b22dd..d468eef8 100644 --- a/tests/resources/xml/fed_SecurityTokenServiceEndpoint.xml +++ b/tests/resources/xml/fed_SecurityTokenServiceEndpoint.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_SingleSignOutNotificationEndpoint.xml b/tests/resources/xml/fed_SingleSignOutNotificationEndpoint.xml index f3303fc0..b117cf02 100644 --- a/tests/resources/xml/fed_SingleSignOutNotificationEndpoint.xml +++ b/tests/resources/xml/fed_SingleSignOutNotificationEndpoint.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_SingleSignOutNotificationEndpoints.xml b/tests/resources/xml/fed_SingleSignOutNotificationEndpoints.xml index 2c719398..563c00b6 100644 --- a/tests/resources/xml/fed_SingleSignOutNotificationEndpoints.xml +++ b/tests/resources/xml/fed_SingleSignOutNotificationEndpoints.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoint.xml b/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoint.xml index 7896d018..c9bcf276 100644 --- a/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoint.xml +++ b/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoint.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoints.xml b/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoints.xml index e9f501e1..b1b525f9 100644 --- a/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoints.xml +++ b/tests/resources/xml/fed_SingleSignOutSubscriptionEndpoints.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/fed_TargetScopes.xml b/tests/resources/xml/fed_TargetScopes.xml index 0dee9e47..60d50222 100644 --- a/tests/resources/xml/fed_TargetScopes.xml +++ b/tests/resources/xml/fed_TargetScopes.xml @@ -1,16 +1,16 @@ - - + + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples - SomeChunk + SomeChunk diff --git a/tests/resources/xml/mssp/RsaToken.xml b/tests/resources/xml/mssp/RsaToken.xml index f74c8e23..7808eacb 100644 --- a/tests/resources/xml/mssp/RsaToken.xml +++ b/tests/resources/xml/mssp/RsaToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/mssp/SslContextToken.xml b/tests/resources/xml/mssp/SslContextToken.xml index 34b75b0d..465b92c4 100644 --- a/tests/resources/xml/mssp/SslContextToken.xml +++ b/tests/resources/xml/mssp/SslContextToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200507/AlgorithmSuite.xml b/tests/resources/xml/sp/200507/AlgorithmSuite.xml index 19a0a412..a5c59799 100644 --- a/tests/resources/xml/sp/200507/AlgorithmSuite.xml +++ b/tests/resources/xml/sp/200507/AlgorithmSuite.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/AsymmetricBinding.xml b/tests/resources/xml/sp/200507/AsymmetricBinding.xml index 7ee314a4..78819612 100644 --- a/tests/resources/xml/sp/200507/AsymmetricBinding.xml +++ b/tests/resources/xml/sp/200507/AsymmetricBinding.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/BootstrapPolicy.xml b/tests/resources/xml/sp/200507/BootstrapPolicy.xml index 85fc737e..e1947052 100644 --- a/tests/resources/xml/sp/200507/BootstrapPolicy.xml +++ b/tests/resources/xml/sp/200507/BootstrapPolicy.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/EncryptedParts.xml b/tests/resources/xml/sp/200507/EncryptedParts.xml index 77e05f80..4df83ac9 100644 --- a/tests/resources/xml/sp/200507/EncryptedParts.xml +++ b/tests/resources/xml/sp/200507/EncryptedParts.xml @@ -1,5 +1,5 @@ - - + + some diff --git a/tests/resources/xml/sp/200507/EncryptionToken.xml b/tests/resources/xml/sp/200507/EncryptionToken.xml index 1ac9ca44..792f9999 100644 --- a/tests/resources/xml/sp/200507/EncryptionToken.xml +++ b/tests/resources/xml/sp/200507/EncryptionToken.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/EndorsingSupportingTokens.xml b/tests/resources/xml/sp/200507/EndorsingSupportingTokens.xml index 341f7232..5f8c1b0a 100644 --- a/tests/resources/xml/sp/200507/EndorsingSupportingTokens.xml +++ b/tests/resources/xml/sp/200507/EndorsingSupportingTokens.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/Header.xml b/tests/resources/xml/sp/200507/Header.xml index 34f59e85..f7616715 100644 --- a/tests/resources/xml/sp/200507/Header.xml +++ b/tests/resources/xml/sp/200507/Header.xml @@ -1 +1 @@ - + diff --git a/tests/resources/xml/sp/200507/InitiatorToken.xml b/tests/resources/xml/sp/200507/InitiatorToken.xml index d4df08cd..dc8e21ab 100644 --- a/tests/resources/xml/sp/200507/InitiatorToken.xml +++ b/tests/resources/xml/sp/200507/InitiatorToken.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/IssuedToken.xml b/tests/resources/xml/sp/200507/IssuedToken.xml index ccf4cd05..ae7550df 100644 --- a/tests/resources/xml/sp/200507/IssuedToken.xml +++ b/tests/resources/xml/sp/200507/IssuedToken.xml @@ -1,18 +1,18 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Apples - - + + Pears - ssp:Chunk - ssp:Chunk + ssp:Chunk + ssp:Chunk some diff --git a/tests/resources/xml/sp/200507/Issuer.xml b/tests/resources/xml/sp/200507/Issuer.xml index 7d0323d5..0f9a1667 100644 --- a/tests/resources/xml/sp/200507/Issuer.xml +++ b/tests/resources/xml/sp/200507/Issuer.xml @@ -1,16 +1,16 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Apples - - + + Pears - ssp:Chunk - ssp:Chunk + ssp:Chunk + ssp:Chunk some diff --git a/tests/resources/xml/sp/200507/Layout.xml b/tests/resources/xml/sp/200507/Layout.xml index b4ab9272..5e848034 100644 --- a/tests/resources/xml/sp/200507/Layout.xml +++ b/tests/resources/xml/sp/200507/Layout.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/ProtectionToken.xml b/tests/resources/xml/sp/200507/ProtectionToken.xml index 09eb52de..5517fa04 100644 --- a/tests/resources/xml/sp/200507/ProtectionToken.xml +++ b/tests/resources/xml/sp/200507/ProtectionToken.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/RecipientToken.xml b/tests/resources/xml/sp/200507/RecipientToken.xml index d1e7f6c4..323199ca 100644 --- a/tests/resources/xml/sp/200507/RecipientToken.xml +++ b/tests/resources/xml/sp/200507/RecipientToken.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/SecureConversationToken.xml b/tests/resources/xml/sp/200507/SecureConversationToken.xml index 3d0bac06..964928f2 100644 --- a/tests/resources/xml/sp/200507/SecureConversationToken.xml +++ b/tests/resources/xml/sp/200507/SecureConversationToken.xml @@ -1,18 +1,18 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Apples - - + + Pears - ssp:Chunk - ssp:Chunk + ssp:Chunk + ssp:Chunk some some diff --git a/tests/resources/xml/sp/200507/SignatureToken.xml b/tests/resources/xml/sp/200507/SignatureToken.xml index aede00b2..279f6e5b 100644 --- a/tests/resources/xml/sp/200507/SignatureToken.xml +++ b/tests/resources/xml/sp/200507/SignatureToken.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/SignedEndorsingSupportingTokens.xml b/tests/resources/xml/sp/200507/SignedEndorsingSupportingTokens.xml index 0c4a35fb..6e541f7a 100644 --- a/tests/resources/xml/sp/200507/SignedEndorsingSupportingTokens.xml +++ b/tests/resources/xml/sp/200507/SignedEndorsingSupportingTokens.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/SignedParts.xml b/tests/resources/xml/sp/200507/SignedParts.xml index 039deebb..0b2634f0 100644 --- a/tests/resources/xml/sp/200507/SignedParts.xml +++ b/tests/resources/xml/sp/200507/SignedParts.xml @@ -1,5 +1,5 @@ - - + + some diff --git a/tests/resources/xml/sp/200507/SignedSupportingTokens.xml b/tests/resources/xml/sp/200507/SignedSupportingTokens.xml index 52949b4c..891fdd00 100644 --- a/tests/resources/xml/sp/200507/SignedSupportingTokens.xml +++ b/tests/resources/xml/sp/200507/SignedSupportingTokens.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/SpnegoContextToken.xml b/tests/resources/xml/sp/200507/SpnegoContextToken.xml index f125696c..4577d679 100644 --- a/tests/resources/xml/sp/200507/SpnegoContextToken.xml +++ b/tests/resources/xml/sp/200507/SpnegoContextToken.xml @@ -1,18 +1,18 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Apples - - + + Pears - ssp:Chunk - ssp:Chunk + ssp:Chunk + ssp:Chunk some some diff --git a/tests/resources/xml/sp/200507/SupportingTokens.xml b/tests/resources/xml/sp/200507/SupportingTokens.xml index e112c4f3..ab338aef 100644 --- a/tests/resources/xml/sp/200507/SupportingTokens.xml +++ b/tests/resources/xml/sp/200507/SupportingTokens.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/SymmetricBinding.xml b/tests/resources/xml/sp/200507/SymmetricBinding.xml index 6e42e19e..0bf6ef29 100644 --- a/tests/resources/xml/sp/200507/SymmetricBinding.xml +++ b/tests/resources/xml/sp/200507/SymmetricBinding.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/TransportBinding.xml b/tests/resources/xml/sp/200507/TransportBinding.xml index 59f0bf5e..61589e92 100644 --- a/tests/resources/xml/sp/200507/TransportBinding.xml +++ b/tests/resources/xml/sp/200507/TransportBinding.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/TransportToken.xml b/tests/resources/xml/sp/200507/TransportToken.xml index ac8e88ce..062acc0a 100644 --- a/tests/resources/xml/sp/200507/TransportToken.xml +++ b/tests/resources/xml/sp/200507/TransportToken.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/Trust10.xml b/tests/resources/xml/sp/200507/Trust10.xml index 47091eac..f809154a 100644 --- a/tests/resources/xml/sp/200507/Trust10.xml +++ b/tests/resources/xml/sp/200507/Trust10.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/Wss10.xml b/tests/resources/xml/sp/200507/Wss10.xml index 9b4693e4..b89a5905 100644 --- a/tests/resources/xml/sp/200507/Wss10.xml +++ b/tests/resources/xml/sp/200507/Wss10.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200507/Wss11.xml b/tests/resources/xml/sp/200507/Wss11.xml index a4e9713f..8a2a66b3 100644 --- a/tests/resources/xml/sp/200507/Wss11.xml +++ b/tests/resources/xml/sp/200507/Wss11.xml @@ -1,5 +1,5 @@ - - + + Other diff --git a/tests/resources/xml/sp/200702/EncryptedParts.xml b/tests/resources/xml/sp/200702/EncryptedParts.xml index c9ce63b1..c221ada1 100644 --- a/tests/resources/xml/sp/200702/EncryptedParts.xml +++ b/tests/resources/xml/sp/200702/EncryptedParts.xml @@ -1,6 +1,6 @@ - - - + + + some diff --git a/tests/resources/xml/sp/200702/Header.xml b/tests/resources/xml/sp/200702/Header.xml index 56ef7fc3..8ebbda0c 100644 --- a/tests/resources/xml/sp/200702/Header.xml +++ b/tests/resources/xml/sp/200702/Header.xml @@ -1 +1 @@ - + diff --git a/tests/resources/xml/sp/200702/HttpsToken.xml b/tests/resources/xml/sp/200702/HttpsToken.xml index e8a2406e..66a90768 100644 --- a/tests/resources/xml/sp/200702/HttpsToken.xml +++ b/tests/resources/xml/sp/200702/HttpsToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200702/Issuer.xml b/tests/resources/xml/sp/200702/Issuer.xml index 1bbf720d..0f2359d2 100644 --- a/tests/resources/xml/sp/200702/Issuer.xml +++ b/tests/resources/xml/sp/200702/Issuer.xml @@ -1,12 +1,12 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Pears - - + + Apples diff --git a/tests/resources/xml/sp/200702/KerberosToken.xml b/tests/resources/xml/sp/200702/KerberosToken.xml index 2cc83de2..bbfb9651 100644 --- a/tests/resources/xml/sp/200702/KerberosToken.xml +++ b/tests/resources/xml/sp/200702/KerberosToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200702/RelToken.xml b/tests/resources/xml/sp/200702/RelToken.xml index f52e9302..bb61bda7 100644 --- a/tests/resources/xml/sp/200702/RelToken.xml +++ b/tests/resources/xml/sp/200702/RelToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200702/RequiredParts.xml b/tests/resources/xml/sp/200702/RequiredParts.xml index 45ddb1e9..29edf0cd 100644 --- a/tests/resources/xml/sp/200702/RequiredParts.xml +++ b/tests/resources/xml/sp/200702/RequiredParts.xml @@ -1,4 +1,4 @@ - + some diff --git a/tests/resources/xml/sp/200702/SamlToken.xml b/tests/resources/xml/sp/200702/SamlToken.xml index 5b858c6c..cfc9f205 100644 --- a/tests/resources/xml/sp/200702/SamlToken.xml +++ b/tests/resources/xml/sp/200702/SamlToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200702/SecurityContextToken.xml b/tests/resources/xml/sp/200702/SecurityContextToken.xml index cefa9b0a..d6f1545c 100644 --- a/tests/resources/xml/sp/200702/SecurityContextToken.xml +++ b/tests/resources/xml/sp/200702/SecurityContextToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200702/SignedParts.xml b/tests/resources/xml/sp/200702/SignedParts.xml index 87c91e57..4e2325e8 100644 --- a/tests/resources/xml/sp/200702/SignedParts.xml +++ b/tests/resources/xml/sp/200702/SignedParts.xml @@ -1,6 +1,6 @@ - - - + + + some diff --git a/tests/resources/xml/sp/200702/UsernameToken.xml b/tests/resources/xml/sp/200702/UsernameToken.xml index 11f5291a..07a44a02 100644 --- a/tests/resources/xml/sp/200702/UsernameToken.xml +++ b/tests/resources/xml/sp/200702/UsernameToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200702/X509Token.xml b/tests/resources/xml/sp/200702/X509Token.xml index 7cd7f958..d4a54563 100644 --- a/tests/resources/xml/sp/200702/X509Token.xml +++ b/tests/resources/xml/sp/200702/X509Token.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/wsa/200408/EndpointReference.xml b/tests/resources/xml/wsa/200408/EndpointReference.xml index 909ea666..e8c8b4ab 100644 --- a/tests/resources/xml/wsa/200408/EndpointReference.xml +++ b/tests/resources/xml/wsa/200408/EndpointReference.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - + Apples - + Pears diff --git a/tests/resources/xml/wsa/200408/FaultTo.xml b/tests/resources/xml/wsa/200408/FaultTo.xml index 0c8cd7f3..f4c0746b 100644 --- a/tests/resources/xml/wsa/200408/FaultTo.xml +++ b/tests/resources/xml/wsa/200408/FaultTo.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - + Apples - + Pears diff --git a/tests/resources/xml/wsa/200408/From.xml b/tests/resources/xml/wsa/200408/From.xml index f4d8267f..c7be563a 100644 --- a/tests/resources/xml/wsa/200408/From.xml +++ b/tests/resources/xml/wsa/200408/From.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - + Apples - + Pears diff --git a/tests/resources/xml/wsa/200408/ReferenceParameters.xml b/tests/resources/xml/wsa/200408/ReferenceParameters.xml index 73aa6838..ca50575c 100644 --- a/tests/resources/xml/wsa/200408/ReferenceParameters.xml +++ b/tests/resources/xml/wsa/200408/ReferenceParameters.xml @@ -1,5 +1,5 @@ - - + + Apples diff --git a/tests/resources/xml/wsa/200408/ReferenceProperties.xml b/tests/resources/xml/wsa/200408/ReferenceProperties.xml index a0783086..b7a8dd3a 100644 --- a/tests/resources/xml/wsa/200408/ReferenceProperties.xml +++ b/tests/resources/xml/wsa/200408/ReferenceProperties.xml @@ -1,5 +1,5 @@ - - + + Apples diff --git a/tests/resources/xml/wsa/200408/ReplyTo.xml b/tests/resources/xml/wsa/200408/ReplyTo.xml index 30507f05..c700af13 100644 --- a/tests/resources/xml/wsa/200408/ReplyTo.xml +++ b/tests/resources/xml/wsa/200408/ReplyTo.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - + Apples - + Pears diff --git a/tests/resources/xml/wsa/200508/EndpointReference.xml b/tests/resources/xml/wsa/200508/EndpointReference.xml index 70fa00c8..a008b392 100644 --- a/tests/resources/xml/wsa/200508/EndpointReference.xml +++ b/tests/resources/xml/wsa/200508/EndpointReference.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples diff --git a/tests/resources/xml/wsa/200508/FaultTo.xml b/tests/resources/xml/wsa/200508/FaultTo.xml index 5b0e6ea4..b6c25391 100644 --- a/tests/resources/xml/wsa/200508/FaultTo.xml +++ b/tests/resources/xml/wsa/200508/FaultTo.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples diff --git a/tests/resources/xml/wsa/200508/From.xml b/tests/resources/xml/wsa/200508/From.xml index 320a2a0b..b9f6c191 100644 --- a/tests/resources/xml/wsa/200508/From.xml +++ b/tests/resources/xml/wsa/200508/From.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - - + + Pears - + Apples diff --git a/tests/resources/xml/wsa/200508/MessageID.xml b/tests/resources/xml/wsa/200508/MessageID.xml index 5dad329b..f8aab786 100644 --- a/tests/resources/xml/wsa/200508/MessageID.xml +++ b/tests/resources/xml/wsa/200508/MessageID.xml @@ -1 +1 @@ -uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de +uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wsa/200508/Metadata.xml b/tests/resources/xml/wsa/200508/Metadata.xml index ae1cc617..6f075a89 100644 --- a/tests/resources/xml/wsa/200508/Metadata.xml +++ b/tests/resources/xml/wsa/200508/Metadata.xml @@ -1,5 +1,5 @@ - - + + Apples diff --git a/tests/resources/xml/wsa/200508/ReferenceParameters.xml b/tests/resources/xml/wsa/200508/ReferenceParameters.xml index 1b5f6b02..137b4b95 100644 --- a/tests/resources/xml/wsa/200508/ReferenceParameters.xml +++ b/tests/resources/xml/wsa/200508/ReferenceParameters.xml @@ -1,5 +1,5 @@ - - + + Apples diff --git a/tests/resources/xml/wsa/200508/ReplyTo.xml b/tests/resources/xml/wsa/200508/ReplyTo.xml index 21e197d3..6eaf12e9 100644 --- a/tests/resources/xml/wsa/200508/ReplyTo.xml +++ b/tests/resources/xml/wsa/200508/ReplyTo.xml @@ -1,12 +1,12 @@ - + https://login.microsoftonline.com/login.srf - + Pears - + Apples diff --git a/tests/resources/xml/wsp_All.xml b/tests/resources/xml/wsp_All.xml index fe19ce60..0c0bbb80 100644 --- a/tests/resources/xml/wsp_All.xml +++ b/tests/resources/xml/wsp_All.xml @@ -1,4 +1,4 @@ - + - Some + Some diff --git a/tests/resources/xml/wsp_AppliesTo.xml b/tests/resources/xml/wsp_AppliesTo.xml index c4aef33b..ebbbf8fc 100644 --- a/tests/resources/xml/wsp_AppliesTo.xml +++ b/tests/resources/xml/wsp_AppliesTo.xml @@ -1,5 +1,5 @@ - - + + http://www.fabrikam123.example.com/acct diff --git a/tests/resources/xml/wsp_ExactlyOne.xml b/tests/resources/xml/wsp_ExactlyOne.xml index a4dcd8e1..9c6f5368 100644 --- a/tests/resources/xml/wsp_ExactlyOne.xml +++ b/tests/resources/xml/wsp_ExactlyOne.xml @@ -1,4 +1,4 @@ - + - Some + Some diff --git a/tests/resources/xml/wsp_PolicyAttachment.xml b/tests/resources/xml/wsp_PolicyAttachment.xml index 642fda22..8ecc70b7 100644 --- a/tests/resources/xml/wsp_PolicyAttachment.xml +++ b/tests/resources/xml/wsp_PolicyAttachment.xml @@ -1,4 +1,4 @@ - + http://www.fabrikam123.example.com/acct @@ -9,7 +9,7 @@ Other - + Security Some diff --git a/tests/resources/xml/wst/200502/Authenticator.xml b/tests/resources/xml/wst/200502/Authenticator.xml index 73809aa4..51867d56 100644 --- a/tests/resources/xml/wst/200502/Authenticator.xml +++ b/tests/resources/xml/wst/200502/Authenticator.xml @@ -1,4 +1,4 @@ - + /CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI= - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/CancelTarget.xml b/tests/resources/xml/wst/200502/CancelTarget.xml index b4add4ad..d62c92a3 100644 --- a/tests/resources/xml/wst/200502/CancelTarget.xml +++ b/tests/resources/xml/wst/200502/CancelTarget.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Claims.xml b/tests/resources/xml/wst/200502/Claims.xml index 92964edc..a9094222 100644 --- a/tests/resources/xml/wst/200502/Claims.xml +++ b/tests/resources/xml/wst/200502/Claims.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/DelegateTo.xml b/tests/resources/xml/wst/200502/DelegateTo.xml index 5af4856f..e946cdc3 100644 --- a/tests/resources/xml/wst/200502/DelegateTo.xml +++ b/tests/resources/xml/wst/200502/DelegateTo.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Encryption.xml b/tests/resources/xml/wst/200502/Encryption.xml index ac9605e1..a9f56b28 100644 --- a/tests/resources/xml/wst/200502/Encryption.xml +++ b/tests/resources/xml/wst/200502/Encryption.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Entropy.xml b/tests/resources/xml/wst/200502/Entropy.xml index f4bc387b..d7e2baec 100644 --- a/tests/resources/xml/wst/200502/Entropy.xml +++ b/tests/resources/xml/wst/200502/Entropy.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/IssuedTokens.xml b/tests/resources/xml/wst/200502/IssuedTokens.xml index 9ddb5249..a4907a57 100644 --- a/tests/resources/xml/wst/200502/IssuedTokens.xml +++ b/tests/resources/xml/wst/200502/IssuedTokens.xml @@ -1,5 +1,5 @@ - + - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Issuer.xml b/tests/resources/xml/wst/200502/Issuer.xml index 01557133..1aca10f7 100644 --- a/tests/resources/xml/wst/200502/Issuer.xml +++ b/tests/resources/xml/wst/200502/Issuer.xml @@ -1,7 +1,7 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Pears diff --git a/tests/resources/xml/wst/200502/KeyExchangeToken.xml b/tests/resources/xml/wst/200502/KeyExchangeToken.xml index 1e244361..e9d1374e 100644 --- a/tests/resources/xml/wst/200502/KeyExchangeToken.xml +++ b/tests/resources/xml/wst/200502/KeyExchangeToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Lifetime.xml b/tests/resources/xml/wst/200502/Lifetime.xml index 4e68c2eb..748d9fba 100644 --- a/tests/resources/xml/wst/200502/Lifetime.xml +++ b/tests/resources/xml/wst/200502/Lifetime.xml @@ -1,4 +1,4 @@ - - 2001-09-13T08:42:00Z - 2001-10-13T09:00:00Z + + 2001-09-13T08:42:00Z + 2001-10-13T09:00:00Z diff --git a/tests/resources/xml/wst/200502/OnBehalfOf.xml b/tests/resources/xml/wst/200502/OnBehalfOf.xml index ae77c8be..d63452a5 100644 --- a/tests/resources/xml/wst/200502/OnBehalfOf.xml +++ b/tests/resources/xml/wst/200502/OnBehalfOf.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Participant.xml b/tests/resources/xml/wst/200502/Participant.xml index 93a8505c..f1a367d4 100644 --- a/tests/resources/xml/wst/200502/Participant.xml +++ b/tests/resources/xml/wst/200502/Participant.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Participants.xml b/tests/resources/xml/wst/200502/Participants.xml index f880db69..27eecc2a 100644 --- a/tests/resources/xml/wst/200502/Participants.xml +++ b/tests/resources/xml/wst/200502/Participants.xml @@ -1,9 +1,9 @@ - + - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/Primary.xml b/tests/resources/xml/wst/200502/Primary.xml index 68da9af0..c2421575 100644 --- a/tests/resources/xml/wst/200502/Primary.xml +++ b/tests/resources/xml/wst/200502/Primary.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/ProofEncryption.xml b/tests/resources/xml/wst/200502/ProofEncryption.xml index d32fd451..314a01bb 100644 --- a/tests/resources/xml/wst/200502/ProofEncryption.xml +++ b/tests/resources/xml/wst/200502/ProofEncryption.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/RenewTarget.xml b/tests/resources/xml/wst/200502/RenewTarget.xml index 76b10231..64927670 100644 --- a/tests/resources/xml/wst/200502/RenewTarget.xml +++ b/tests/resources/xml/wst/200502/RenewTarget.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/RequestSecurityToken.xml b/tests/resources/xml/wst/200502/RequestSecurityToken.xml index 6779655e..780b0495 100644 --- a/tests/resources/xml/wst/200502/RequestSecurityToken.xml +++ b/tests/resources/xml/wst/200502/RequestSecurityToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/RequestSecurityTokenResponse.xml b/tests/resources/xml/wst/200502/RequestSecurityTokenResponse.xml index 40b9ec2a..83188885 100644 --- a/tests/resources/xml/wst/200502/RequestSecurityTokenResponse.xml +++ b/tests/resources/xml/wst/200502/RequestSecurityTokenResponse.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/RequestSecurityTokenResponseCollection.xml b/tests/resources/xml/wst/200502/RequestSecurityTokenResponseCollection.xml index 2cb47e75..b0fa04ea 100644 --- a/tests/resources/xml/wst/200502/RequestSecurityTokenResponseCollection.xml +++ b/tests/resources/xml/wst/200502/RequestSecurityTokenResponseCollection.xml @@ -1,5 +1,5 @@ - + - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/RequestedAttachedReference.xml b/tests/resources/xml/wst/200502/RequestedAttachedReference.xml index e8b56c33..8103766b 100644 --- a/tests/resources/xml/wst/200502/RequestedAttachedReference.xml +++ b/tests/resources/xml/wst/200502/RequestedAttachedReference.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/wst/200502/RequestedProofToken.xml b/tests/resources/xml/wst/200502/RequestedProofToken.xml index 34bcc821..950d0e23 100644 --- a/tests/resources/xml/wst/200502/RequestedProofToken.xml +++ b/tests/resources/xml/wst/200502/RequestedProofToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/RequestedSecurityToken.xml b/tests/resources/xml/wst/200502/RequestedSecurityToken.xml index f0ce634d..d9356383 100644 --- a/tests/resources/xml/wst/200502/RequestedSecurityToken.xml +++ b/tests/resources/xml/wst/200502/RequestedSecurityToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/RequestedUnattachedReference.xml b/tests/resources/xml/wst/200502/RequestedUnattachedReference.xml index 3d44296c..a49634ee 100644 --- a/tests/resources/xml/wst/200502/RequestedUnattachedReference.xml +++ b/tests/resources/xml/wst/200502/RequestedUnattachedReference.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/wst/200502/SignChallenge.xml b/tests/resources/xml/wst/200502/SignChallenge.xml index 285fd6a1..8404a875 100644 --- a/tests/resources/xml/wst/200502/SignChallenge.xml +++ b/tests/resources/xml/wst/200502/SignChallenge.xml @@ -1,4 +1,4 @@ - + accepted - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/SignChallengeResponse.xml b/tests/resources/xml/wst/200502/SignChallengeResponse.xml index 6116428b..2ef3f2fd 100644 --- a/tests/resources/xml/wst/200502/SignChallengeResponse.xml +++ b/tests/resources/xml/wst/200502/SignChallengeResponse.xml @@ -1,4 +1,4 @@ - + accepted - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200502/UseKey.xml b/tests/resources/xml/wst/200502/UseKey.xml index 54474e5a..5be13dbf 100644 --- a/tests/resources/xml/wst/200502/UseKey.xml +++ b/tests/resources/xml/wst/200502/UseKey.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Authenticator.xml b/tests/resources/xml/wst/200512/Authenticator.xml index 77969174..c7f474ca 100644 --- a/tests/resources/xml/wst/200512/Authenticator.xml +++ b/tests/resources/xml/wst/200512/Authenticator.xml @@ -1,4 +1,4 @@ - + /CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI= - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/CancelTarget.xml b/tests/resources/xml/wst/200512/CancelTarget.xml index 29c3da18..45947213 100644 --- a/tests/resources/xml/wst/200512/CancelTarget.xml +++ b/tests/resources/xml/wst/200512/CancelTarget.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Claims.xml b/tests/resources/xml/wst/200512/Claims.xml index 25c6d237..6df6511d 100644 --- a/tests/resources/xml/wst/200512/Claims.xml +++ b/tests/resources/xml/wst/200512/Claims.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/DelegateTo.xml b/tests/resources/xml/wst/200512/DelegateTo.xml index 40804dfd..49621099 100644 --- a/tests/resources/xml/wst/200512/DelegateTo.xml +++ b/tests/resources/xml/wst/200512/DelegateTo.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Encryption.xml b/tests/resources/xml/wst/200512/Encryption.xml index b9c397e7..be813e2c 100644 --- a/tests/resources/xml/wst/200512/Encryption.xml +++ b/tests/resources/xml/wst/200512/Encryption.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Entropy.xml b/tests/resources/xml/wst/200512/Entropy.xml index 502011e7..728bcc7a 100644 --- a/tests/resources/xml/wst/200512/Entropy.xml +++ b/tests/resources/xml/wst/200512/Entropy.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/IssuedTokens.xml b/tests/resources/xml/wst/200512/IssuedTokens.xml index 4910c249..4ae34000 100644 --- a/tests/resources/xml/wst/200512/IssuedTokens.xml +++ b/tests/resources/xml/wst/200512/IssuedTokens.xml @@ -1,5 +1,5 @@ - + - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Issuer.xml b/tests/resources/xml/wst/200512/Issuer.xml index 43de3c34..9492e37d 100644 --- a/tests/resources/xml/wst/200512/Issuer.xml +++ b/tests/resources/xml/wst/200512/Issuer.xml @@ -1,12 +1,12 @@ - - https://login.microsoftonline.com/login.srf - - + + https://login.microsoftonline.com/login.srf + + Pears - - + + Apples diff --git a/tests/resources/xml/wst/200512/KeyExchangeToken.xml b/tests/resources/xml/wst/200512/KeyExchangeToken.xml index 90bb2e47..dddf5bb5 100644 --- a/tests/resources/xml/wst/200512/KeyExchangeToken.xml +++ b/tests/resources/xml/wst/200512/KeyExchangeToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Lifetime.xml b/tests/resources/xml/wst/200512/Lifetime.xml index 03ce16c8..1dd883e7 100644 --- a/tests/resources/xml/wst/200512/Lifetime.xml +++ b/tests/resources/xml/wst/200512/Lifetime.xml @@ -1,4 +1,4 @@ - - 2001-09-13T08:42:00Z - 2001-10-13T09:00:00Z + + 2001-09-13T08:42:00Z + 2001-10-13T09:00:00Z diff --git a/tests/resources/xml/wst/200512/OnBehalfOf.xml b/tests/resources/xml/wst/200512/OnBehalfOf.xml index 87805a6e..31cadf7e 100644 --- a/tests/resources/xml/wst/200512/OnBehalfOf.xml +++ b/tests/resources/xml/wst/200512/OnBehalfOf.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Participant.xml b/tests/resources/xml/wst/200512/Participant.xml index 514dbfb6..47d03ea3 100644 --- a/tests/resources/xml/wst/200512/Participant.xml +++ b/tests/resources/xml/wst/200512/Participant.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Participants.xml b/tests/resources/xml/wst/200512/Participants.xml index f8a0168e..70b243c1 100644 --- a/tests/resources/xml/wst/200512/Participants.xml +++ b/tests/resources/xml/wst/200512/Participants.xml @@ -1,9 +1,9 @@ - + - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/Primary.xml b/tests/resources/xml/wst/200512/Primary.xml index c3086ab2..bfaac22e 100644 --- a/tests/resources/xml/wst/200512/Primary.xml +++ b/tests/resources/xml/wst/200512/Primary.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/ProofEncryption.xml b/tests/resources/xml/wst/200512/ProofEncryption.xml index 38f5b27e..3bd6b5ea 100644 --- a/tests/resources/xml/wst/200512/ProofEncryption.xml +++ b/tests/resources/xml/wst/200512/ProofEncryption.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/RenewTarget.xml b/tests/resources/xml/wst/200512/RenewTarget.xml index 1bbc923f..4cc499a6 100644 --- a/tests/resources/xml/wst/200512/RenewTarget.xml +++ b/tests/resources/xml/wst/200512/RenewTarget.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/RequestSecurityToken.xml b/tests/resources/xml/wst/200512/RequestSecurityToken.xml index 95ff109d..c3843732 100644 --- a/tests/resources/xml/wst/200512/RequestSecurityToken.xml +++ b/tests/resources/xml/wst/200512/RequestSecurityToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/RequestSecurityTokenCollection.xml b/tests/resources/xml/wst/200512/RequestSecurityTokenCollection.xml index 48b24e73..dd4c31b0 100644 --- a/tests/resources/xml/wst/200512/RequestSecurityTokenCollection.xml +++ b/tests/resources/xml/wst/200512/RequestSecurityTokenCollection.xml @@ -1,8 +1,8 @@ - - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7df + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7df diff --git a/tests/resources/xml/wst/200512/RequestSecurityTokenResponse.xml b/tests/resources/xml/wst/200512/RequestSecurityTokenResponse.xml index d00d29bf..5ba013ee 100644 --- a/tests/resources/xml/wst/200512/RequestSecurityTokenResponse.xml +++ b/tests/resources/xml/wst/200512/RequestSecurityTokenResponse.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/RequestSecurityTokenResponseCollection.xml b/tests/resources/xml/wst/200512/RequestSecurityTokenResponseCollection.xml index 67a127f8..39487460 100644 --- a/tests/resources/xml/wst/200512/RequestSecurityTokenResponseCollection.xml +++ b/tests/resources/xml/wst/200512/RequestSecurityTokenResponseCollection.xml @@ -1,5 +1,5 @@ - + - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/RequestedAttachedReference.xml b/tests/resources/xml/wst/200512/RequestedAttachedReference.xml index 459d5382..89435bd7 100644 --- a/tests/resources/xml/wst/200512/RequestedAttachedReference.xml +++ b/tests/resources/xml/wst/200512/RequestedAttachedReference.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/wst/200512/RequestedProofToken.xml b/tests/resources/xml/wst/200512/RequestedProofToken.xml index ec561bc3..e54c12db 100644 --- a/tests/resources/xml/wst/200512/RequestedProofToken.xml +++ b/tests/resources/xml/wst/200512/RequestedProofToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/RequestedSecurityToken.xml b/tests/resources/xml/wst/200512/RequestedSecurityToken.xml index a2f6feb5..203acc5a 100644 --- a/tests/resources/xml/wst/200512/RequestedSecurityToken.xml +++ b/tests/resources/xml/wst/200512/RequestedSecurityToken.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/RequestedUnattachedReference.xml b/tests/resources/xml/wst/200512/RequestedUnattachedReference.xml index 89308d25..1da8ce15 100644 --- a/tests/resources/xml/wst/200512/RequestedUnattachedReference.xml +++ b/tests/resources/xml/wst/200512/RequestedUnattachedReference.xml @@ -1,5 +1,5 @@ - - + + SomeChunk diff --git a/tests/resources/xml/wst/200512/SignChallenge.xml b/tests/resources/xml/wst/200512/SignChallenge.xml index c6e26b84..b8ac1312 100644 --- a/tests/resources/xml/wst/200512/SignChallenge.xml +++ b/tests/resources/xml/wst/200512/SignChallenge.xml @@ -1,4 +1,4 @@ - + accepted - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/SignChallengeResponse.xml b/tests/resources/xml/wst/200512/SignChallengeResponse.xml index 79e35a50..128ebd05 100644 --- a/tests/resources/xml/wst/200512/SignChallengeResponse.xml +++ b/tests/resources/xml/wst/200512/SignChallengeResponse.xml @@ -1,4 +1,4 @@ - + accepted - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/UseKey.xml b/tests/resources/xml/wst/200512/UseKey.xml index 8658b5d5..322fba8b 100644 --- a/tests/resources/xml/wst/200512/UseKey.xml +++ b/tests/resources/xml/wst/200512/UseKey.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wst/200512/ValidateTarget.xml b/tests/resources/xml/wst/200512/ValidateTarget.xml index 711035de..8fdb83b7 100644 --- a/tests/resources/xml/wst/200512/ValidateTarget.xml +++ b/tests/resources/xml/wst/200512/ValidateTarget.xml @@ -1,3 +1,3 @@ - - uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de + + uuid:d0ccf3cd-2dce-4c1a-a5d6-be8912ecd7de diff --git a/tests/resources/xml/wsx_MetadataReference.xml b/tests/resources/xml/wsx_MetadataReference.xml index 7692170c..57b6c6ba 100644 --- a/tests/resources/xml/wsx_MetadataReference.xml +++ b/tests/resources/xml/wsx_MetadataReference.xml @@ -1,5 +1,5 @@ - - + + https://login.microsoftonline.com/login.srf SomeChunk