From db626cf1dcae6798af48eb5200437d4094d33f5a Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 10 Sep 2024 00:02:50 +0200 Subject: [PATCH] Add ws-addr 200408 elements --- src/Constants.php | 3 +- src/Utils/XPath.php | 3 +- .../AbstractAttributedQNameType.php | 80 +++++++ .../wsa_200408/AbstractAttributedURIType.php | 79 +++++++ .../AbstractEndpointReferenceType.php | 215 ++++++++++++++++++ .../wsa_200408/AbstractRelationshipType.php | 102 +++++++++ src/XML/wsa_200408/AbstractRetryAfterType.php | 93 ++++++++ .../wsa_200408/AbstractServiceNameType.php | 104 +++++++++ src/XML/wsa_200408/AbstractWsaElement.php | 22 ++ src/XML/wsa_200408/Action.php | 14 ++ src/XML/wsa_200408/Address.php | 14 ++ src/XML/wsa_200408/EndpointReference.php | 14 ++ src/XML/wsa_200408/FaultTo.php | 14 ++ src/XML/wsa_200408/From.php | 14 ++ src/XML/wsa_200408/MessageID.php | 14 ++ src/XML/wsa_200408/PortType.php | 14 ++ src/XML/wsa_200408/ReferenceParameters.php | 95 ++++++++ src/XML/wsa_200408/ReferenceProperties.php | 95 ++++++++ src/XML/wsa_200408/RelatesTo.php | 12 + src/XML/wsa_200408/ReplyTo.php | 14 ++ src/XML/wsa_200408/RetryAfter.php | 12 + src/XML/wsa_200408/ServiceName.php | 14 ++ src/XML/wsa_200408/To.php | 14 ++ .../AbstractEndpointReferenceType.php | 38 ++-- src/XML/wsa_200508/AbstractWsaElement.php | 2 +- .../WSSecurity/XML/wsa_200408/ActionTest.php | 66 ++++++ .../WSSecurity/XML/wsa_200408/AddressTest.php | 62 +++++ .../XML/wsa_200408/EndpointReferenceTest.php | 164 +++++++++++++ .../WSSecurity/XML/wsa_200408/FaultToTest.php | 159 +++++++++++++ tests/WSSecurity/XML/wsa_200408/FromTest.php | 159 +++++++++++++ .../XML/wsa_200408/MessageIDTest.php | 66 ++++++ .../XML/wsa_200408/PortTypeTest.php | 62 +++++ .../wsa_200408/ReferenceParametersTest.php | 77 +++++++ .../wsa_200408/ReferencePropertiesTest.php | 77 +++++++ .../XML/wsa_200408/RelatesToTest.php | 66 ++++++ .../WSSecurity/XML/wsa_200408/ReplyToTest.php | 159 +++++++++++++ .../XML/wsa_200408/RetryAfterTest.php | 64 ++++++ .../XML/wsa_200408/ServiceNameTest.php | 62 +++++ tests/WSSecurity/XML/wsa_200408/ToTest.php | 66 ++++++ tests/resources/xml/wsa/200408/Action.xml | 1 + tests/resources/xml/wsa/200408/Address.xml | 1 + .../xml/wsa/200408/EndpointReference.xml | 16 ++ tests/resources/xml/wsa/200408/FaultTo.xml | 16 ++ tests/resources/xml/wsa/200408/From.xml | 16 ++ tests/resources/xml/wsa/200408/MessageID.xml | 1 + tests/resources/xml/wsa/200408/PortType.xml | 1 + .../xml/wsa/200408/ReferenceParameters.xml | 5 + .../xml/wsa/200408/ReferenceProperties.xml | 5 + tests/resources/xml/wsa/200408/RelatesTo.xml | 1 + tests/resources/xml/wsa/200408/ReplyTo.xml | 16 ++ tests/resources/xml/wsa/200408/RetryAfter.xml | 1 + .../resources/xml/wsa/200408/ServiceName.xml | 1 + tests/resources/xml/wsa/200408/To.xml | 1 + 53 files changed, 2461 insertions(+), 25 deletions(-) create mode 100644 src/XML/wsa_200408/AbstractAttributedQNameType.php create mode 100644 src/XML/wsa_200408/AbstractAttributedURIType.php create mode 100644 src/XML/wsa_200408/AbstractEndpointReferenceType.php create mode 100644 src/XML/wsa_200408/AbstractRelationshipType.php create mode 100644 src/XML/wsa_200408/AbstractRetryAfterType.php create mode 100644 src/XML/wsa_200408/AbstractServiceNameType.php create mode 100644 src/XML/wsa_200408/AbstractWsaElement.php create mode 100644 src/XML/wsa_200408/Action.php create mode 100644 src/XML/wsa_200408/Address.php create mode 100644 src/XML/wsa_200408/EndpointReference.php create mode 100644 src/XML/wsa_200408/FaultTo.php create mode 100644 src/XML/wsa_200408/From.php create mode 100644 src/XML/wsa_200408/MessageID.php create mode 100644 src/XML/wsa_200408/PortType.php create mode 100644 src/XML/wsa_200408/ReferenceParameters.php create mode 100644 src/XML/wsa_200408/ReferenceProperties.php create mode 100644 src/XML/wsa_200408/RelatesTo.php create mode 100644 src/XML/wsa_200408/ReplyTo.php create mode 100644 src/XML/wsa_200408/RetryAfter.php create mode 100644 src/XML/wsa_200408/ServiceName.php create mode 100644 src/XML/wsa_200408/To.php create mode 100644 tests/WSSecurity/XML/wsa_200408/ActionTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/AddressTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/FaultToTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/FromTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/MessageIDTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/PortTypeTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/RelatesToTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/ReplyToTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php create mode 100644 tests/WSSecurity/XML/wsa_200408/ToTest.php create mode 100644 tests/resources/xml/wsa/200408/Action.xml create mode 100644 tests/resources/xml/wsa/200408/Address.xml create mode 100644 tests/resources/xml/wsa/200408/EndpointReference.xml create mode 100644 tests/resources/xml/wsa/200408/FaultTo.xml create mode 100644 tests/resources/xml/wsa/200408/From.xml create mode 100644 tests/resources/xml/wsa/200408/MessageID.xml create mode 100644 tests/resources/xml/wsa/200408/PortType.xml create mode 100644 tests/resources/xml/wsa/200408/ReferenceParameters.xml create mode 100644 tests/resources/xml/wsa/200408/ReferenceProperties.xml create mode 100644 tests/resources/xml/wsa/200408/RelatesTo.xml create mode 100644 tests/resources/xml/wsa/200408/ReplyTo.xml create mode 100644 tests/resources/xml/wsa/200408/RetryAfter.xml create mode 100644 tests/resources/xml/wsa/200408/ServiceName.xml create mode 100644 tests/resources/xml/wsa/200408/To.xml diff --git a/src/Constants.php b/src/Constants.php index b2bfe5a..d84ec2c 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -15,7 +15,8 @@ class Constants extends \SimpleSAML\SAML2\Constants /** * The namespace for WS-Addressing protocol. */ - public const NS_ADDR = 'http://www.w3.org/2005/08/addressing'; + 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'; /** * The namespace for WS-Authorization protocol. diff --git a/src/Utils/XPath.php b/src/Utils/XPath.php index 536b1a7..6e02b8d 100644 --- a/src/Utils/XPath.php +++ b/src/Utils/XPath.php @@ -27,7 +27,8 @@ public static function getXPath(DOMNode $node): DOMXPath { $xp = parent::getXPath($node); - $xp->registerNamespace('addr', C::NS_ADDR); + $xp->registerNamespace('wsa', C::NS_ADDR_200508); + $xp->registerNamespace('wsa', C::NS_ADDR_200408); $xp->registerNamespace('auth', C::NS_AUTH); $xp->registerNamespace('fed', C::NS_FED); $xp->registerNamespace('trust', C::NS_TRUST); diff --git a/src/XML/wsa_200408/AbstractAttributedQNameType.php b/src/XML/wsa_200408/AbstractAttributedQNameType.php new file mode 100644 index 0000000..6ab6f91 --- /dev/null +++ b/src/XML/wsa_200408/AbstractAttributedQNameType.php @@ -0,0 +1,80 @@ + $namespacedAttributes + */ + final public function __construct(string $value, array $namespacedAttributes = []) + { + $this->setContent($value); + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * 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($xml->textContent, self::getAttributesNSFromXML($xml)); + } + + + /** + * 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(); + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/AbstractAttributedURIType.php b/src/XML/wsa_200408/AbstractAttributedURIType.php new file mode 100644 index 0000000..9851c64 --- /dev/null +++ b/src/XML/wsa_200408/AbstractAttributedURIType.php @@ -0,0 +1,79 @@ + $namespacedAttributes + */ + final public function __construct(string $value, array $namespacedAttributes = []) + { + $this->setContent($value); + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * 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($xml->textContent, self::getAttributesNSFromXML($xml)); + } + + + /** + * 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(); + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/AbstractEndpointReferenceType.php b/src/XML/wsa_200408/AbstractEndpointReferenceType.php new file mode 100644 index 0000000..2651eb3 --- /dev/null +++ b/src/XML/wsa_200408/AbstractEndpointReferenceType.php @@ -0,0 +1,215 @@ + $namespacedAttributes + * + * @throws \SimpleSAML\Assert\AssertionFailedException + */ + final public function __construct( + protected Address $address, + protected ?ReferenceProperties $referenceProperties = null, + protected ?ReferenceParameters $referenceParameters = null, + protected ?PortType $portType = null, + protected ?ServiceName $serviceName = null, + array $children = [], + array $namespacedAttributes = [], + ) { + $this->setElements($children); + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * Collect the value of the address property. + * + * @return \SimpleSAML\WSSecurity\XML\wsa_200408\Address + */ + public function getAddress(): Address + { + return $this->address; + } + + + /** + * Collect the value of the referenceProperties property. + * + * @return \SimpleSAML\WSSecurity\XML\wsa_200408\ReferenceProperties|null + */ + public function getReferenceProperties(): ?ReferenceProperties + { + return $this->referenceProperties; + } + + + /** + * Collect the value of the referenceParameters property. + * + * @return \SimpleSAML\WSSecurity\XML\wsa_200408\ReferenceParameters|null + */ + public function getReferenceParameters(): ?ReferenceParameters + { + return $this->referenceParameters; + } + + + /** + * Collect the value of the portType property. + * + * @return \SimpleSAML\WSSecurity\XML\wsa_200408\PortType|null + */ + public function getPortType(): ?PortType + { + return $this->portType; + } + + + /** + * Collect the value of the serviceName property. + * + * @return \SimpleSAML\WSSecurity\XML\wsa_200408\ServiceName|null + */ + public function getServiceName(): ?ServiceName + { + return $this->serviceName; + } + + + /** + * Initialize an EndpointReferenceType. + * + * Note: this method cannot be used when extending this class, if the constructor has a different signature. + * + * @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 + * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * if the supplied element is missing any of the mandatory attributes + */ + public static function fromXML(DOMElement $xml): static + { + $qualifiedName = static::getClassName(static::class); + Assert::eq( + $xml->localName, + $qualifiedName, + sprintf('Unexpected name for endpoint reference: %s. Expected: %s.', $xml->localName, $qualifiedName), + InvalidDOMElementException::class, + ); + + $address = Address::getChildrenOfClass($xml); + Assert::minCount($address, 1, MissingElementException::class); + Assert::maxCount($address, 1, TooManyElementsException::class); + + $referenceProperties = ReferenceProperties::getChildrenOfClass($xml); + Assert::maxCount($referenceProperties, 1, TooManyElementsException::class); + + $referenceParameters = ReferenceParameters::getChildrenOfClass($xml); + Assert::maxCount($referenceParameters, 1, TooManyElementsException::class); + + $portType = PortType::getChildrenOfClass($xml); + Assert::maxCount($portType, 1, TooManyElementsException::class); + + $serviceName = ServiceName::getChildrenOfClass($xml); + Assert::maxCount($serviceName, 1, TooManyElementsException::class); + + $children = []; + foreach ($xml->childNodes as $child) { + if (!($child instanceof DOMElement)) { + continue; + } elseif ($child->namespaceURI === C::NS_ADDR_200408) { + continue; + } + + $children[] = new Chunk($child); + } + + return new static( + array_pop($address), + array_pop($referenceProperties), + array_pop($referenceParameters), + array_pop($portType), + array_pop($serviceName), + $children, + self::getAttributesNSFromXML($xml), + ); + } + + + /** + * Add this endpoint reference to an XML element. + * + * @param \DOMElement $parent The element we should append this endpoint to. + * @return \DOMElement + */ + public function toXML(DOMElement $parent = null): DOMElement + { + $e = parent::instantiateParentElement($parent); + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + $this->getAddress()->toXML($e); + + $this->getReferenceProperties()?->toXML($e); + $this->getReferenceParameters()?->toXML($e); + $this->getPortType()?->toXML($e); + $this->getServiceName()?->toXML($e); + + foreach ($this->getElements() as $child) { + if (!$child->isEmptyElement()) { + $child->toXML($e); + } + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/AbstractRelationshipType.php b/src/XML/wsa_200408/AbstractRelationshipType.php new file mode 100644 index 0000000..f91020e --- /dev/null +++ b/src/XML/wsa_200408/AbstractRelationshipType.php @@ -0,0 +1,102 @@ + $namespacedAttributes + */ + final public function __construct( + string $value, + protected ?string $relationshipType = null, + array $namespacedAttributes = [], + ) { + Assert::validQName($relationshipType); + + $this->setContent($value); + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * Retrieve the value of the relationshipType property + */ + public function getRelationshipType(): ?string + { + return $this->relationshipType; + } + + + /** + * 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( + $xml->textContent, + self::getOptionalAttribute($xml, 'RelationshipType', null), + self::getAttributesNSFromXML($xml), + ); + } + + + /** + * 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(); + + if ($this->getRelationshipType() !== null) { + $e->setAttribute('RelationshipType', $this->getRelationshipType()); + } + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/AbstractRetryAfterType.php b/src/XML/wsa_200408/AbstractRetryAfterType.php new file mode 100644 index 0000000..801bfd8 --- /dev/null +++ b/src/XML/wsa_200408/AbstractRetryAfterType.php @@ -0,0 +1,93 @@ + $namespacedAttributes + */ + final public function __construct( + protected int $value, + array $namespacedAttributes = [], + ) { + Assert::natural($value, SchemaViolationException::class); // Allows 0 as allowed by xs:nonNegativeInteger + + $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 + * 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(intval($xml->textContent), self::getAttributesNSFromXML($xml)); + } + + + /** + * 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 = strval($this->getValue()); + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/AbstractServiceNameType.php b/src/XML/wsa_200408/AbstractServiceNameType.php new file mode 100644 index 0000000..eaccfa5 --- /dev/null +++ b/src/XML/wsa_200408/AbstractServiceNameType.php @@ -0,0 +1,104 @@ + $namespacedAttributes + */ + final public function __construct( + string $value, + protected ?string $portName = null, + array $namespacedAttributes = [], + ) { + Assert::nullOrValidNCName($portName, SchemaViolationException::class); + + $this->setContent($value); + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * Get the value of the portName property + */ + public function getPortName(): ?string + { + return $this->portName; + } + + + /** + * 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( + $xml->textContent, + self::getOptionalAttribute($xml, 'PortName', null), + self::getAttributesNSFromXML($xml), + ); + } + + + /** + * 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(); + + if ($this->getPortName() !== null) { + $e->setAttribute('PortName', $this->getPortName()); + } + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/AbstractWsaElement.php b/src/XML/wsa_200408/AbstractWsaElement.php new file mode 100644 index 0000000..60e88ff --- /dev/null +++ b/src/XML/wsa_200408/AbstractWsaElement.php @@ -0,0 +1,22 @@ +setElements($children); + } + + + /** + * Test if an object, at the state it's in, would produce an empty XML-element + * + * @return bool + */ + public function isEmptyElement(): bool + { + return empty($this->elements); + } + + + /* + * Convert XML into an ReferenceParameters element + * + * @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, 'ReferenceParameters', InvalidDOMElementException::class); + Assert::same($xml->namespaceURI, ReferenceParameters::NS, InvalidDOMElementException::class); + + $children = []; + foreach ($xml->childNodes as $child) { + if (!($child instanceof DOMElement)) { + continue; + } + + $children[] = new Chunk($child); + } + + return new static($children); + } + + + /** + * Convert this ReferenceParameters to XML. + * + * @param \DOMElement|null $parent The element we should add this ReferenceParameters to. + * @return \DOMElement This Header-element. + */ + 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); + } + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/ReferenceProperties.php b/src/XML/wsa_200408/ReferenceProperties.php new file mode 100644 index 0000000..8bc5f47 --- /dev/null +++ b/src/XML/wsa_200408/ReferenceProperties.php @@ -0,0 +1,95 @@ +setElements($children); + } + + + /** + * Test if an object, at the state it's in, would produce an empty XML-element + * + * @return bool + */ + public function isEmptyElement(): bool + { + return empty($this->elements); + } + + + /* + * Convert XML into an ReferenceProperties element + * + * @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, 'ReferenceProperties', InvalidDOMElementException::class); + Assert::same($xml->namespaceURI, ReferenceProperties::NS, InvalidDOMElementException::class); + + $children = []; + foreach ($xml->childNodes as $child) { + if (!($child instanceof DOMElement)) { + continue; + } + + $children[] = new Chunk($child); + } + + return new static($children); + } + + + /** + * Convert this ReferenceProperties to XML. + * + * @param \DOMElement|null $parent The element we should add this ReferenceProperties to. + * @return \DOMElement This Header-element. + */ + 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); + } + } + + return $e; + } +} diff --git a/src/XML/wsa_200408/RelatesTo.php b/src/XML/wsa_200408/RelatesTo.php new file mode 100644 index 0000000..82d2ceb --- /dev/null +++ b/src/XML/wsa_200408/RelatesTo.php @@ -0,0 +1,12 @@ + $namespacedAttributes * @@ -52,14 +52,11 @@ abstract class AbstractEndpointReferenceType extends AbstractWsaElement */ final public function __construct( protected Address $address, - protected array $referenceParameters = [], - protected array $metadata = [], + protected ?ReferenceParameters $referenceParameters = null, + protected ?Metadata $metadata = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::allIsInstanceOf($referenceParameters, ReferenceParameters::class); - Assert::allIsInstanceOf($metadata, Metadata::class); - $this->setElements($children); $this->setAttributesNS($namespacedAttributes); } @@ -79,9 +76,9 @@ public function getAddress(): Address /** * Collect the value of the referenceParameters property. * - * @return \SimpleSAML\WSSecurity\XML\wsa_200508\ReferenceParameters[] + * @return \SimpleSAML\WSSecurity\XML\wsa_200508\ReferenceParameters|null */ - public function getReferenceParameters(): array + public function getReferenceParameters(): ?ReferenceParameters { return $this->referenceParameters; } @@ -90,9 +87,9 @@ public function getReferenceParameters(): array /** * Collect the value of the metadata property. * - * @return \SimpleSAML\WSSecurity\XML\wsa_200508\Metadata[] + * @return \SimpleSAML\WSSecurity\XML\wsa_200508\Metadata|null */ - public function getMetadata(): array + public function getMetadata(): ?Metadata { return $this->metadata; } @@ -126,13 +123,16 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($address, 1, TooManyElementsException::class); $referenceParameters = ReferenceParameters::getChildrenOfClass($xml); + Assert::maxCount($referenceParameters, 1, TooManyElementsException::class); + $metadata = Metadata::getChildrenOfClass($xml); + Assert::maxCount($metadata, 1, TooManyElementsException::class); $children = []; foreach ($xml->childNodes as $child) { if (!($child instanceof DOMElement)) { continue; - } elseif ($child->namespaceURI === C::NS_ADDR) { + } elseif ($child->namespaceURI === C::NS_ADDR_200508) { continue; } @@ -141,8 +141,8 @@ public static function fromXML(DOMElement $xml): static return new static( array_pop($address), - $referenceParameters, - $metadata, + array_pop($referenceParameters), + array_pop($metadata), $children, self::getAttributesNSFromXML($xml), ); @@ -164,14 +164,8 @@ public function toXML(DOMElement $parent = null): DOMElement } $this->getAddress()->toXML($e); - - foreach ($this->getReferenceParameters() as $referenceParameters) { - $referenceParameters->toXML($e); - } - - foreach ($this->getMetadata() as $metadata) { - $metadata->toXML($e); - } + $this->getReferenceParameters()?->toXML($e); + $this->getMetadata()?->toXML($e); /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $child */ foreach ($this->getElements() as $child) { diff --git a/src/XML/wsa_200508/AbstractWsaElement.php b/src/XML/wsa_200508/AbstractWsaElement.php index c6754f0..b2c648d 100644 --- a/src/XML/wsa_200508/AbstractWsaElement.php +++ b/src/XML/wsa_200508/AbstractWsaElement.php @@ -15,7 +15,7 @@ abstract class AbstractWsaElement extends AbstractElement { /** @var string */ - public const NS = C::NS_ADDR; + public const NS = C::NS_ADDR_200508; /** @var string */ public const NS_PREFIX = 'wsa'; diff --git a/tests/WSSecurity/XML/wsa_200408/ActionTest.php b/tests/WSSecurity/XML/wsa_200408/ActionTest.php new file mode 100644 index 0000000..9284914 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/ActionTest.php @@ -0,0 +1,66 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($action), + ); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/AddressTest.php b/tests/WSSecurity/XML/wsa_200408/AddressTest.php new file mode 100644 index 0000000..e8fcfd3 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/AddressTest.php @@ -0,0 +1,62 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($Address), + ); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php b/tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php new file mode 100644 index 0000000..6256a61 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/EndpointReferenceTest.php @@ -0,0 +1,164 @@ +Apples', + )->documentElement; + + self::$referenceParametersContent = DOMDocumentFactory::fromString( + 'Pears', + )->documentElement; + + self::$customContent = DOMDocumentFactory::fromString( + 'Some', + )->documentElement; + } + + + // test marshalling + + + /** + * Test creating an EndpointReference object from scratch. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $endpointReference = new EndpointReference( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($endpointReference), + ); + } + + + /** + * Test element order. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $endpointReference = new EndpointReference( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + // Test for an Address + $endpointReferenceElement = $endpointReference->toXML(); + $xpCache = XPath::getXPath($endpointReferenceElement); + $endpointReferenceElements = XPath::xpQuery($endpointReferenceElement, './wsa:Address', $xpCache); + $this->assertCount(1, $endpointReferenceElements); + + // Test ordering of EndpointReference contents + /** @psalm-var \DOMElement[] $endpointReferenceElements */ + $endpointReferenceElements = XPath::xpQuery( + $endpointReferenceElement, + './wsa:Address/following-sibling::*', + $xpCache, + ); + + $this->assertCount(5, $endpointReferenceElements); + $this->assertEquals('wsa:ReferenceProperties', $endpointReferenceElements[0]->tagName); + $this->assertEquals('wsa:ReferenceParameters', $endpointReferenceElements[1]->tagName); + $this->assertEquals('wsa:PortType', $endpointReferenceElements[2]->tagName); + $this->assertEquals('wsa:ServiceName', $endpointReferenceElements[3]->tagName); + $this->assertEquals('ssp:Chunk', $endpointReferenceElements[4]->tagName); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/FaultToTest.php b/tests/WSSecurity/XML/wsa_200408/FaultToTest.php new file mode 100644 index 0000000..c261d58 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/FaultToTest.php @@ -0,0 +1,159 @@ +Apples', + )->documentElement; + + self::$referenceParametersContent = DOMDocumentFactory::fromString( + 'Pears', + )->documentElement; + + self::$customContent = DOMDocumentFactory::fromString( + 'Some', + )->documentElement; + } + + + // test marshalling + + + /** + * Test creating an FaultTo object FaultTo scratch. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $FaultTo = new FaultTo( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($FaultTo), + ); + } + + + /** + * Test element order. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $FaultTo = new FaultTo( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + // Test for an Address + $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); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/FromTest.php b/tests/WSSecurity/XML/wsa_200408/FromTest.php new file mode 100644 index 0000000..5d0255a --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/FromTest.php @@ -0,0 +1,159 @@ +Apples', + )->documentElement; + + self::$referenceParametersContent = DOMDocumentFactory::fromString( + 'Pears', + )->documentElement; + + self::$customContent = DOMDocumentFactory::fromString( + 'Some', + )->documentElement; + } + + + // test marshalling + + + /** + * Test creating an From object from scratch. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $From = new From( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($From), + ); + } + + + /** + * Test element order. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $From = new From( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + // Test for an Address + $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); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/MessageIDTest.php b/tests/WSSecurity/XML/wsa_200408/MessageIDTest.php new file mode 100644 index 0000000..4a7cc4e --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/MessageIDTest.php @@ -0,0 +1,66 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($MessageID), + ); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/PortTypeTest.php b/tests/WSSecurity/XML/wsa_200408/PortTypeTest.php new file mode 100644 index 0000000..615a8f2 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/PortTypeTest.php @@ -0,0 +1,62 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($portType), + ); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php b/tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php new file mode 100644 index 0000000..ac4b36e --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/ReferenceParametersTest.php @@ -0,0 +1,77 @@ +Apples', + )->documentElement; + } + + + /** + */ + public function testMarshalling(): void + { + $referenceParameters = new ReferenceParameters([new Chunk(self::$referenceParametersContent)]); + $this->assertFalse($referenceParameters->isEmptyElement()); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($referenceParameters), + ); + } + + + /** + */ + public function testMarshallingWithNoContent(): void + { + $referenceParameters = new ReferenceParameters([]); + $this->assertEquals( + '', + strval($referenceParameters), + ); + $this->assertTrue($referenceParameters->isEmptyElement()); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php b/tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php new file mode 100644 index 0000000..1bc8782 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/ReferencePropertiesTest.php @@ -0,0 +1,77 @@ +Apples', + )->documentElement; + } + + + /** + */ + public function testMarshalling(): void + { + $ReferenceProperties = new ReferenceProperties([new Chunk(self::$ReferencePropertiesContent)]); + $this->assertFalse($ReferenceProperties->isEmptyElement()); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($ReferenceProperties), + ); + } + + + /** + */ + public function testMarshallingWithNoContent(): void + { + $ReferenceProperties = new ReferenceProperties([]); + $this->assertEquals( + '', + strval($ReferenceProperties), + ); + $this->assertTrue($ReferenceProperties->isEmptyElement()); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/RelatesToTest.php b/tests/WSSecurity/XML/wsa_200408/RelatesToTest.php new file mode 100644 index 0000000..09b15ff --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/RelatesToTest.php @@ -0,0 +1,66 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($RelatesTo), + ); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/ReplyToTest.php b/tests/WSSecurity/XML/wsa_200408/ReplyToTest.php new file mode 100644 index 0000000..7780d21 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/ReplyToTest.php @@ -0,0 +1,159 @@ +Apples', + )->documentElement; + + self::$referenceParametersContent = DOMDocumentFactory::fromString( + 'Pears', + )->documentElement; + + self::$customContent = DOMDocumentFactory::fromString( + 'Some', + )->documentElement; + } + + + // test marshalling + + + /** + * Test creating an ReplyTo object ReplyTo scratch. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $ReplyTo = new ReplyTo( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($ReplyTo), + ); + } + + + /** + * Test element order. + */ + 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'); + + $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]); + $chunk = new Chunk(self::$customContent); + + $ReplyTo = new ReplyTo( + new Address('https://login.microsoftonline.com/login.srf', [$attr2]), + $referenceProperties, + $referenceParameters, + $portType, + $serviceName, + [$chunk], + [$attr1], + ); + + // Test for an Address + $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); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php b/tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php new file mode 100644 index 0000000..9511084 --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/RetryAfterTest.php @@ -0,0 +1,64 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($retryAfter), + ); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php b/tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php new file mode 100644 index 0000000..c9a679c --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/ServiceNameTest.php @@ -0,0 +1,62 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($serviceName), + ); + } +} diff --git a/tests/WSSecurity/XML/wsa_200408/ToTest.php b/tests/WSSecurity/XML/wsa_200408/ToTest.php new file mode 100644 index 0000000..3ca466b --- /dev/null +++ b/tests/WSSecurity/XML/wsa_200408/ToTest.php @@ -0,0 +1,66 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($To), + ); + } +} diff --git a/tests/resources/xml/wsa/200408/Action.xml b/tests/resources/xml/wsa/200408/Action.xml new file mode 100644 index 0000000..5b9281d --- /dev/null +++ b/tests/resources/xml/wsa/200408/Action.xml @@ -0,0 +1 @@ +https://login.microsoftonline.com/login.srf diff --git a/tests/resources/xml/wsa/200408/Address.xml b/tests/resources/xml/wsa/200408/Address.xml new file mode 100644 index 0000000..faec767 --- /dev/null +++ b/tests/resources/xml/wsa/200408/Address.xml @@ -0,0 +1 @@ +https://login.microsoftonline.com/login.srf diff --git a/tests/resources/xml/wsa/200408/EndpointReference.xml b/tests/resources/xml/wsa/200408/EndpointReference.xml new file mode 100644 index 0000000..909ea66 --- /dev/null +++ b/tests/resources/xml/wsa/200408/EndpointReference.xml @@ -0,0 +1,16 @@ + + https://login.microsoftonline.com/login.srf + + + Apples + + + + + Pears + + + ssp:Chunk + ssp:Chunk + Some + diff --git a/tests/resources/xml/wsa/200408/FaultTo.xml b/tests/resources/xml/wsa/200408/FaultTo.xml new file mode 100644 index 0000000..0c8cd7f --- /dev/null +++ b/tests/resources/xml/wsa/200408/FaultTo.xml @@ -0,0 +1,16 @@ + + https://login.microsoftonline.com/login.srf + + + Apples + + + + + Pears + + + ssp:Chunk + ssp:Chunk + Some + diff --git a/tests/resources/xml/wsa/200408/From.xml b/tests/resources/xml/wsa/200408/From.xml new file mode 100644 index 0000000..f4d8267 --- /dev/null +++ b/tests/resources/xml/wsa/200408/From.xml @@ -0,0 +1,16 @@ + + https://login.microsoftonline.com/login.srf + + + Apples + + + + + Pears + + + ssp:Chunk + ssp:Chunk + Some + diff --git a/tests/resources/xml/wsa/200408/MessageID.xml b/tests/resources/xml/wsa/200408/MessageID.xml new file mode 100644 index 0000000..4277333 --- /dev/null +++ b/tests/resources/xml/wsa/200408/MessageID.xml @@ -0,0 +1 @@ +https://login.microsoftonline.com/login.srf diff --git a/tests/resources/xml/wsa/200408/PortType.xml b/tests/resources/xml/wsa/200408/PortType.xml new file mode 100644 index 0000000..fd79d16 --- /dev/null +++ b/tests/resources/xml/wsa/200408/PortType.xml @@ -0,0 +1 @@ +ssp:Chunk diff --git a/tests/resources/xml/wsa/200408/ReferenceParameters.xml b/tests/resources/xml/wsa/200408/ReferenceParameters.xml new file mode 100644 index 0000000..73aa683 --- /dev/null +++ b/tests/resources/xml/wsa/200408/ReferenceParameters.xml @@ -0,0 +1,5 @@ + + + Apples + + diff --git a/tests/resources/xml/wsa/200408/ReferenceProperties.xml b/tests/resources/xml/wsa/200408/ReferenceProperties.xml new file mode 100644 index 0000000..a078308 --- /dev/null +++ b/tests/resources/xml/wsa/200408/ReferenceProperties.xml @@ -0,0 +1,5 @@ + + + Apples + + diff --git a/tests/resources/xml/wsa/200408/RelatesTo.xml b/tests/resources/xml/wsa/200408/RelatesTo.xml new file mode 100644 index 0000000..9a5f1ae --- /dev/null +++ b/tests/resources/xml/wsa/200408/RelatesTo.xml @@ -0,0 +1 @@ +https://login.microsoftonline.com/login.srf diff --git a/tests/resources/xml/wsa/200408/ReplyTo.xml b/tests/resources/xml/wsa/200408/ReplyTo.xml new file mode 100644 index 0000000..30507f0 --- /dev/null +++ b/tests/resources/xml/wsa/200408/ReplyTo.xml @@ -0,0 +1,16 @@ + + https://login.microsoftonline.com/login.srf + + + Apples + + + + + Pears + + + ssp:Chunk + ssp:Chunk + Some + diff --git a/tests/resources/xml/wsa/200408/RetryAfter.xml b/tests/resources/xml/wsa/200408/RetryAfter.xml new file mode 100644 index 0000000..2e57747 --- /dev/null +++ b/tests/resources/xml/wsa/200408/RetryAfter.xml @@ -0,0 +1 @@ +30 diff --git a/tests/resources/xml/wsa/200408/ServiceName.xml b/tests/resources/xml/wsa/200408/ServiceName.xml new file mode 100644 index 0000000..aad2325 --- /dev/null +++ b/tests/resources/xml/wsa/200408/ServiceName.xml @@ -0,0 +1 @@ +ssp:Chunk diff --git a/tests/resources/xml/wsa/200408/To.xml b/tests/resources/xml/wsa/200408/To.xml new file mode 100644 index 0000000..bd8a144 --- /dev/null +++ b/tests/resources/xml/wsa/200408/To.xml @@ -0,0 +1 @@ +https://login.microsoftonline.com/login.srf