From f3571900228a297ffb8aaf1f79cacd7438260a62 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 21 Nov 2023 20:43:38 +0100 Subject: [PATCH] Get the right wst xsd we need for the ADFS-module.. --- resources/schemas/ws-trust.xsd | 583 +++++++++++++----- src/XML/wst/AbstractTitleType.php | 82 --- src/XML/wst/AbstractWstElement.php | 22 - src/XML/wst/Choice.php | 117 ---- src/XML/wst/ChoiceChallenge.php | 134 ---- src/XML/wst/ChoiceChallengeResponse.php | 83 --- src/XML/wst/ChoiceSelected.php | 65 -- src/XML/wst/ContextData.php | 88 --- src/XML/wst/Image.php | 80 --- src/XML/wst/InteractiveChallengeResponse.php | 148 ----- src/XML/wst/TextChallenge.php | 149 ----- src/XML/wst/TextChallengeResponse.php | 82 --- src/XML/wst/Title.php | 14 - .../XML/wst/ChoiceChallengeResponseTest.php | 81 --- .../XML/wst/ChoiceChallengeTest.php | 97 --- .../WSSecurity/XML/wst/ChoiceSelectedTest.php | 73 --- tests/WSSecurity/XML/wst/ChoiceTest.php | 85 --- tests/WSSecurity/XML/wst/ContextDataTest.php | 82 --- tests/WSSecurity/XML/wst/ImageTest.php | 73 --- .../wst/InteractiveChallengeResponseTest.php | 119 ---- .../XML/wst/TextChallengeResponseTest.php | 80 --- .../WSSecurity/XML/wst/TextChallengeTest.php | 85 --- tests/WSSecurity/XML/wst/TitleTest.php | 81 --- tests/resources/xml/wst_Choice.xml | 3 - tests/resources/xml/wst_ChoiceChallenge.xml | 5 - .../xml/wst_ChoiceChallengeResponse.xml | 3 - tests/resources/xml/wst_ChoiceSelected.xml | 1 - tests/resources/xml/wst_ContextData.xml | 3 - tests/resources/xml/wst_Image.xml | 1 - .../xml/wst_InteractiveChallengeResponse.xml | 10 - tests/resources/xml/wst_TextChallenge.xml | 3 - .../xml/wst_TextChallengeResponse.xml | 1 - tests/resources/xml/wst_Title.xml | 1 - 33 files changed, 440 insertions(+), 2094 deletions(-) delete mode 100644 src/XML/wst/AbstractTitleType.php delete mode 100644 src/XML/wst/AbstractWstElement.php delete mode 100644 src/XML/wst/Choice.php delete mode 100644 src/XML/wst/ChoiceChallenge.php delete mode 100644 src/XML/wst/ChoiceChallengeResponse.php delete mode 100644 src/XML/wst/ChoiceSelected.php delete mode 100644 src/XML/wst/ContextData.php delete mode 100644 src/XML/wst/Image.php delete mode 100644 src/XML/wst/InteractiveChallengeResponse.php delete mode 100644 src/XML/wst/TextChallenge.php delete mode 100644 src/XML/wst/TextChallengeResponse.php delete mode 100644 src/XML/wst/Title.php delete mode 100644 tests/WSSecurity/XML/wst/ChoiceChallengeResponseTest.php delete mode 100644 tests/WSSecurity/XML/wst/ChoiceChallengeTest.php delete mode 100644 tests/WSSecurity/XML/wst/ChoiceSelectedTest.php delete mode 100644 tests/WSSecurity/XML/wst/ChoiceTest.php delete mode 100644 tests/WSSecurity/XML/wst/ContextDataTest.php delete mode 100644 tests/WSSecurity/XML/wst/ImageTest.php delete mode 100644 tests/WSSecurity/XML/wst/InteractiveChallengeResponseTest.php delete mode 100644 tests/WSSecurity/XML/wst/TextChallengeResponseTest.php delete mode 100644 tests/WSSecurity/XML/wst/TextChallengeTest.php delete mode 100644 tests/WSSecurity/XML/wst/TitleTest.php delete mode 100644 tests/resources/xml/wst_Choice.xml delete mode 100644 tests/resources/xml/wst_ChoiceChallenge.xml delete mode 100644 tests/resources/xml/wst_ChoiceChallengeResponse.xml delete mode 100644 tests/resources/xml/wst_ChoiceSelected.xml delete mode 100644 tests/resources/xml/wst_ContextData.xml delete mode 100644 tests/resources/xml/wst_Image.xml delete mode 100644 tests/resources/xml/wst_InteractiveChallengeResponse.xml delete mode 100644 tests/resources/xml/wst_TextChallenge.xml delete mode 100644 tests/resources/xml/wst_TextChallengeResponse.xml delete mode 100644 tests/resources/xml/wst_Title.xml diff --git a/resources/schemas/ws-trust.xsd b/resources/schemas/ws-trust.xsd index 05c5f8a9..adfd3c49 100644 --- a/resources/schemas/ws-trust.xsd +++ b/resources/schemas/ws-trust.xsd @@ -1,154 +1,451 @@ - - + - - - - - - - - - - Actual content model is non-deterministic, hence wildcard. The following shows intended content model: - <xs:element ref='wst14:Title' minOccurs='0' /> - <xs:element ref='wst14:TextChallenge' minOccurs='0' /> - <xs:element ref='wst14:ChoiceChallenge' minOccurs='0' /> - <xs:element ref='wst14:ContextData' minOccurs='0' /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Actual content model is non-deterministic, hence wildcard. The following shows intended content model: - <xs:element ref='wst14:TextChallengeResponse' minOccurs='0' /> - <xs:element ref='wst14:ChoiceChallengeResponse' minOccurs='0' /> - <xs:element ref='wst14:ContextData' minOccurs='0' /> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + Actual content model is non-deterministic, hence wildcard. The following shows intended content model: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Actual content model is non-deterministic, hence wildcard. The following shows intended content model: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/XML/wst/AbstractTitleType.php b/src/XML/wst/AbstractTitleType.php deleted file mode 100644 index 67c31ea2..00000000 --- a/src/XML/wst/AbstractTitleType.php +++ /dev/null @@ -1,82 +0,0 @@ - $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/wst/AbstractWstElement.php b/src/XML/wst/AbstractWstElement.php deleted file mode 100644 index 4a913d68..00000000 --- a/src/XML/wst/AbstractWstElement.php +++ /dev/null @@ -1,22 +0,0 @@ - $namespacedAttributes - */ - public function __construct( - string $refId, - protected ?string $label = null, - protected ?Image $image = null, - array $namespacedAttributes = [] - ) { - $this->setRefId($refId); - $this->setAttributesNS($namespacedAttributes); - } - - - /** - * Collect the value of the label property. - * - * @return string|null - */ - public function getLabel(): ?string - { - return $this->label; - } - - - /** - * Collect the value of the image property. - * - * @return \SimpleSAML\WSSecurity\XML\wst\Image|null - */ - public function getImage(): ?Image - { - return $this->image; - } - - - /** - * Convert XML into a wst:Choice - * - * @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, 'Choice', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, Choice::NS, InvalidDOMElementException::class); - - $refId = self::getAttribute($xml, 'RefID'); - $label = self::getOptionalAttribute($xml, 'Label', null); - - $image = Image::getChildrenOfClass($xml); - Assert::maxCount($image, 1, TooManyElementsException::class); - - return new static($refId, $label, array_pop($image), 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->setAttribute('RefID', $this->refId); - - if ($this->getLabel() !== null) { - $e->setAttribute('Label', $this->getLabel()); - } - - $this->getImage()?->toXML($e); - - foreach ($this->getAttributesNS() as $attr) { - $attr->toXML($e); - } - - return $e; - } -} diff --git a/src/XML/wst/ChoiceChallenge.php b/src/XML/wst/ChoiceChallenge.php deleted file mode 100644 index 1205a718..00000000 --- a/src/XML/wst/ChoiceChallenge.php +++ /dev/null @@ -1,134 +0,0 @@ - $namespacedAttributes - */ - public function __construct( - string $refId, - protected bool $exactlyOne, - protected ?string $label = null, - protected ?Choice $choice = null, - array $namespacedAttributes = [] - ) { - $this->setRefId($refId); - $this->setAttributesNS($namespacedAttributes); - } - - - /** - * Collect the value of the exactlyOne property. - * - * @return bool - */ - public function getExactlyOne(): bool - { - return $this->exactlyOne; - } - - - /** - * Collect the value of the label property. - * - * @return string|null - */ - public function getLabel(): ?string - { - return $this->label; - } - - - /** - * Collect the value of the choice property. - * - * @return \SimpleSAML\WSSecurity\XML\wst\Choice|null - */ - public function getChoice(): ?Choice - { - return $this->choice; - } - - - /** - * Convert XML into a wst:ChoiceChallenge - * - * @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, 'ChoiceChallenge', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, ChoiceChallenge::NS, InvalidDOMElementException::class); - - $refId = self::getAttribute($xml, 'RefID'); - $exactlyOne = self::getBooleanAttribute($xml, 'ExactlyOne'); - $label = self::getOptionalAttribute($xml, 'Label', null); - - $choice = Choice::getChildrenOfClass($xml); - Assert::maxCount($choice, 1, TooManyElementsException::class); - - return new static($refId, $exactlyOne, $label, array_pop($choice), 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->setAttribute('RefID', $this->getRefId()); - $e->setAttribute('ExactlyOne', strval($this->getExactlyOne())); - - $label = $this->getLabel(); - if ($label !== null) { - $e->setAttribute('Label', $label); - } - - $this->getChoice()?->toXML($e); - - foreach ($this->getAttributesNS() as $attr) { - $attr->toXML($e); - } - - return $e; - } -} diff --git a/src/XML/wst/ChoiceChallengeResponse.php b/src/XML/wst/ChoiceChallengeResponse.php deleted file mode 100644 index d708b97d..00000000 --- a/src/XML/wst/ChoiceChallengeResponse.php +++ /dev/null @@ -1,83 +0,0 @@ -setRefId($refId); - } - - - /** - * @return \SimpleSAML\WSSecurity\XML\wst\ChoiceSelected[] - */ - public function getChoiceSelected(): array - { - return $this->choiceSelected; - } - - - /** - * Convert XML into a wst:ChoiceChallengeResponse - * - * @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, 'ChoiceChallengeResponse', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, ChoiceChallengeResponse::NS, InvalidDOMElementException::class); - - $refId = self::getAttribute($xml, 'RefId'); - - return new static($refId, ChoiceSelected::getChildrenOfClass($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->setAttribute('RefId', $this->refId); - - foreach ($this->getChoiceSelected() as $choiceSelected) { - $choiceSelected->toXML($e); - } - - return $e; - } -} diff --git a/src/XML/wst/ChoiceSelected.php b/src/XML/wst/ChoiceSelected.php deleted file mode 100644 index 9227eeda..00000000 --- a/src/XML/wst/ChoiceSelected.php +++ /dev/null @@ -1,65 +0,0 @@ -setRefId($refId); - } - - - /** - * Convert XML into a wst:ChoiceSelected - * - * @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, 'ChoiceSelected', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, ChoiceSelected::NS, InvalidDOMElementException::class); - - $refId = self::getAttribute($xml, 'RefId'); - - return new static($refId); - } - - - /** - * 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->setAttribute('RefId', $this->getRefId()); - - return $e; - } -} diff --git a/src/XML/wst/ContextData.php b/src/XML/wst/ContextData.php deleted file mode 100644 index b4a3c16c..00000000 --- a/src/XML/wst/ContextData.php +++ /dev/null @@ -1,88 +0,0 @@ -setRefId($refId); - $this->setElements($elements); - } - - - /** - * Convert XML into a wst:ContextData - * - * @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, 'ContextData', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, ContextData::NS, InvalidDOMElementException::class); - - $refId = self::getAttribute($xml, 'RefID'); - - $children = []; - foreach ($xml->childNodes as $node) { - if ($node instanceof DOMElement) { - $children[] = Chunk::fromXML($node); - } - } - - return new static($refId, $children); - } - - - /** - * 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->setAttribute('RefID', $this->getRefId()); - - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ - foreach ($this->getElements() as $elt) { - if (!$elt->isEmptyElement()) { - $elt->toXML($e); - } - } - - return $e; - } -} diff --git a/src/XML/wst/Image.php b/src/XML/wst/Image.php deleted file mode 100644 index c97eaffc..00000000 --- a/src/XML/wst/Image.php +++ /dev/null @@ -1,80 +0,0 @@ -setContent($content); - } - - - /** - * Collect the value of the mimeType property. - * - * @return string - */ - public function getMimeType(): string - { - return $this->mimeType; - } - - - /** - * Convert XML into a wst:Image - * - * @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, 'Image', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, Image::NS, InvalidDOMElementException::class); - - $mimeType = self::getAttribute($xml, 'MimeType'); - - return new static($xml->textContent, $mimeType); - } - - - /** - * 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(); - $e->setAttribute('MimeType', $this->getMimeType()); - - return $e; - } -} diff --git a/src/XML/wst/InteractiveChallengeResponse.php b/src/XML/wst/InteractiveChallengeResponse.php deleted file mode 100644 index 4d927fe4..00000000 --- a/src/XML/wst/InteractiveChallengeResponse.php +++ /dev/null @@ -1,148 +0,0 @@ - $namespacedAttributes - */ - public function __construct(array $elements = [], array $namespacedAttributes = []) - { - $this->setElements($elements); - $this->setAttributesNS($namespacedAttributes); - } - - - /** - * @return \SimpleSAML\WSSecurity\XML\wst\TextChallengeResponse[] - */ - public function getTextChallengeResponse(): array - { - return array_values(array_filter($this->elements, function ($element) { - return $element instanceof TextChallengeResponse; - })); - } - - - /** - * @return \SimpleSAML\WSSecurity\XML\wst\ChoiceChallengeResponse[] - */ - public function getChoiceChallengeResponse(): array - { - return array_values(array_filter($this->elements, function ($element) { - return $element instanceof ChoiceChallengeResponse; - })); - } - - - /** - * @return \SimpleSAML\WSSecurity\XML\wst\ContextData[] - */ - public function getContextData(): array - { - return array_values(array_filter($this->elements, function ($element) { - return $element instanceof ContextData; - })); - } - - - /** - * 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->getElements()) && empty($this->getAttributesNS()); - } - - - /** - * Convert XML into a wst:InteractiveChallengeResponse - * - * @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, 'InteractiveChallengeResponse', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, InteractiveChallengeResponse::NS, InvalidDOMElementException::class); - - $children = []; - foreach ($xml->childNodes as $node) { - if (!($node instanceof DOMElement)) { - continue; - } elseif ($node->namespaceURI === C::NS_TRUST) { - $children[] = match ($node->localName) { - 'TextChallengeResponse' => TextChallengeResponse::fromXML($node), - 'ChoiceChallengeResponse' => ChoiceChallengeResponse::fromXML($node), - 'ContextData' => ContextData::fromXML($node), - default => new Chunk($node), - }; - } else { - $children[] = new Chunk($node); - } - } - - return new static($children, 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); - - foreach ($this->getAttributesNS() as $attr) { - $attr->toXML($e); - } - - /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ - foreach ($this->getElements() as $elt) { - if (!$elt->isEmptyElement()) { - $elt->toXML($e); - } - } - - return $e; - } -} diff --git a/src/XML/wst/TextChallenge.php b/src/XML/wst/TextChallenge.php deleted file mode 100644 index b1d7bdc8..00000000 --- a/src/XML/wst/TextChallenge.php +++ /dev/null @@ -1,149 +0,0 @@ - $namespacedAttributes - */ - public function __construct( - string $refId, - protected ?string $label = null, - protected ?int $maxLen = null, - protected ?bool $hideText = null, - protected ?Image $image = null, - array $namespacedAttributes = [] - ) { - $this->setRefId($refId); - $this->setAttributesNS($namespacedAttributes); - } - - - /** - * Collect the value of the maxLen property. - * - * @return int|null - */ - public function getMaxLen(): ?int - { - return $this->maxLen; - } - - - /** - * Collect the value of the hideText property. - * - * @return bool|null - */ - public function getHideText(): ?bool - { - return $this->hideText; - } - - - /** - * Collect the value of the label property. - * - * @return string|null - */ - public function getLabel(): ?string - { - return $this->label; - } - - - /** - * Collect the value of the image property. - * - * @return \SimpleSAML\WSSecurity\XML\wst\Image|null - */ - public function getImage(): ?Image - { - return $this->image; - } - - - /** - * Convert XML into a wst:TextChallenge - * - * @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, 'TextChallenge', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, TextChallenge::NS, InvalidDOMElementException::class); - - $refId = self::getAttribute($xml, 'RefID'); - $label = self::getOptionalAttribute($xml, 'Label', null); - $maxLen = self::getOptionalIntegerAttribute($xml, 'MaxLen', null); - $hideText = self::getOptionalBooleanAttribute($xml, 'HideText', null); - - $image = Image::getChildrenOfClass($xml); - Assert::maxCount($image, 1, TooManyElementsException::class); - - return new static($refId, $label, $maxLen, $hideText, array_pop($image), 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->setAttribute('RefID', $this->getRefId()); - - if ($this->getLabel() !== null) { - $e->setAttribute('Label', $this->getLabel()); - } - - $e->setAttribute('MaxLen', strval($this->getMaxLen())); - $e->setAttribute('HideText', $this->getHideText() ? 'true' : 'false'); - - $this->getImage()?->toXML($e); - - foreach ($this->getAttributesNS() as $attr) { - $attr->toXML($e); - } - - return $e; - } -} diff --git a/src/XML/wst/TextChallengeResponse.php b/src/XML/wst/TextChallengeResponse.php deleted file mode 100644 index 052a6eab..00000000 --- a/src/XML/wst/TextChallengeResponse.php +++ /dev/null @@ -1,82 +0,0 @@ - $namespacedAttributes - */ - public function __construct(string $value, string $refId, array $namespacedAttributes = []) - { - $this->setContent($value); - $this->setRefId($refId); - $this->setAttributesNS($namespacedAttributes); - } - - - /** - * Convert XML into a wst:TextChallengeResponse - * - * @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, 'TextChallengeResponse', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, TextChallengeResponse::NS, InvalidDOMElementException::class); - - $refId = self::getAttribute($xml, 'RefId'); - - return new static($xml->textContent, $refId, 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->setAttribute('RefId', $this->getRefId()); - $e->textContent = $this->getContent(); - - foreach ($this->getAttributesNS() as $attr) { - $attr->toXML($e); - } - - return $e; - } -} diff --git a/src/XML/wst/Title.php b/src/XML/wst/Title.php deleted file mode 100644 index 2a89ea4f..00000000 --- a/src/XML/wst/Title.php +++ /dev/null @@ -1,14 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choiceChallengeResponse) - ); - } - - - // test unmarshalling - - - /** - * Test creating a ChoiceChallengeResponse from XML. - */ - public function testUnmarshalling(): void - { - $choiceChallengeResponse = ChoiceChallengeResponse::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choiceChallengeResponse) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/ChoiceChallengeTest.php b/tests/WSSecurity/XML/wst/ChoiceChallengeTest.php deleted file mode 100644 index 8878e6bf..00000000 --- a/tests/WSSecurity/XML/wst/ChoiceChallengeTest.php +++ /dev/null @@ -1,97 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choiceChallenge), - ); - } - - - // test unmarshalling - - - /** - * Test creating a ChoiceChallenge from XML. - */ - public function testUnmarshalling(): void - { - $choiceChallenge = ChoiceChallenge::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choiceChallenge), - ); - } -} diff --git a/tests/WSSecurity/XML/wst/ChoiceSelectedTest.php b/tests/WSSecurity/XML/wst/ChoiceSelectedTest.php deleted file mode 100644 index d07a8484..00000000 --- a/tests/WSSecurity/XML/wst/ChoiceSelectedTest.php +++ /dev/null @@ -1,73 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choiceSelected) - ); - } - - - // test unmarshalling - - - /** - * Test creating a ChoiceSelected from XML. - */ - public function testUnmarshalling(): void - { - $choiceSelected = ChoiceSelected::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choiceSelected) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/ChoiceTest.php b/tests/WSSecurity/XML/wst/ChoiceTest.php deleted file mode 100644 index 6a6c8f32..00000000 --- a/tests/WSSecurity/XML/wst/ChoiceTest.php +++ /dev/null @@ -1,85 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choice) - ); - } - - - // test unmarshalling - - - /** - * Test creating a Choice from XML. - */ - public function testUnmarshalling(): void - { - $choice = Choice::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($choice) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/ContextDataTest.php b/tests/WSSecurity/XML/wst/ContextDataTest.php deleted file mode 100644 index b0d63598..00000000 --- a/tests/WSSecurity/XML/wst/ContextDataTest.php +++ /dev/null @@ -1,82 +0,0 @@ -Some' - )->documentElement); - $contextData = new ContextData('urn:x-simplesamlphp:namespace', [$chunk]); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($contextData) - ); - } - - - // test unmarshalling - - - /** - * Test creating a ContextData from XML. - */ - public function testUnmarshalling(): void - { - $contextData = ContextData::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($contextData) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/ImageTest.php b/tests/WSSecurity/XML/wst/ImageTest.php deleted file mode 100644 index 4614b80e..00000000 --- a/tests/WSSecurity/XML/wst/ImageTest.php +++ /dev/null @@ -1,73 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($image) - ); - } - - - // test unmarshalling - - - /** - * Test creating a Image from XML. - */ - public function testUnmarshalling(): void - { - $image = Image::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($image) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/InteractiveChallengeResponseTest.php b/tests/WSSecurity/XML/wst/InteractiveChallengeResponseTest.php deleted file mode 100644 index 02f84727..00000000 --- a/tests/WSSecurity/XML/wst/InteractiveChallengeResponseTest.php +++ /dev/null @@ -1,119 +0,0 @@ -Some' - )->documentElement); - $contextData = new ContextData('urn:x-simplesamlphp:namespace', [$chunk]); - $interactiveChallengeResponse = new InteractiveChallengeResponse( - [$textChallengeResponse, $choiceChallengeResponse, $contextData, $chunk], - [$domAttr], - ); - - $this->assertCount(1, $interactiveChallengeResponse->getTextChallengeResponse()); - $this->assertCount(1, $interactiveChallengeResponse->getChoiceChallengeResponse()); - $this->assertCount(1, $interactiveChallengeResponse->getContextData()); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($interactiveChallengeResponse) - ); - } - - - /** - * Adding an empty InteractiveChallengeResponse element should yield an empty element. - */ - public function testMarshallingEmptyElement(): void - { - $wstns = C::NS_TRUST; - $interactiveChallengeResponse = new InteractiveChallengeResponse(); - $this->assertEquals( - "", - strval($interactiveChallengeResponse), - ); - $this->assertTrue($interactiveChallengeResponse->isEmptyElement()); - } - - - // test unmarshalling - - - /** - * Test creating a TextChallengeResponse from XML. - */ - public function testUnmarshalling(): void - { - $interactiveChallengeResponse = InteractiveChallengeResponse::fromXML( - self::$xmlRepresentation->documentElement - ); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($interactiveChallengeResponse) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/TextChallengeResponseTest.php b/tests/WSSecurity/XML/wst/TextChallengeResponseTest.php deleted file mode 100644 index cb5a81b8..00000000 --- a/tests/WSSecurity/XML/wst/TextChallengeResponseTest.php +++ /dev/null @@ -1,80 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($textChallengeResponse) - ); - } - - - // test unmarshalling - - - /** - * Test creating a TextChallengeResponse from XML. - */ - public function testUnmarshalling(): void - { - $textChallengeResponse = TextChallengeResponse::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($textChallengeResponse) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/TextChallengeTest.php b/tests/WSSecurity/XML/wst/TextChallengeTest.php deleted file mode 100644 index 59af57c6..00000000 --- a/tests/WSSecurity/XML/wst/TextChallengeTest.php +++ /dev/null @@ -1,85 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($textChallenge) - ); - } - - - // test unmarshalling - - - /** - * Test creating a TextChallenge from XML. - */ - public function testUnmarshalling(): void - { - $textChallenge = TextChallenge::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($textChallenge) - ); - } -} diff --git a/tests/WSSecurity/XML/wst/TitleTest.php b/tests/WSSecurity/XML/wst/TitleTest.php deleted file mode 100644 index ea387dab..00000000 --- a/tests/WSSecurity/XML/wst/TitleTest.php +++ /dev/null @@ -1,81 +0,0 @@ -assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($title) - ); - } - - - // test unmarshalling - - - /** - * Test creating a Title from XML. - */ - public function testUnmarshalling(): void - { - $title = Title::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($title) - ); - } -} diff --git a/tests/resources/xml/wst_Choice.xml b/tests/resources/xml/wst_Choice.xml deleted file mode 100644 index 02f96749..00000000 --- a/tests/resources/xml/wst_Choice.xml +++ /dev/null @@ -1,3 +0,0 @@ - - iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII= - diff --git a/tests/resources/xml/wst_ChoiceChallenge.xml b/tests/resources/xml/wst_ChoiceChallenge.xml deleted file mode 100644 index f4258bbb..00000000 --- a/tests/resources/xml/wst_ChoiceChallenge.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII= - - diff --git a/tests/resources/xml/wst_ChoiceChallengeResponse.xml b/tests/resources/xml/wst_ChoiceChallengeResponse.xml deleted file mode 100644 index 14e2120e..00000000 --- a/tests/resources/xml/wst_ChoiceChallengeResponse.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/tests/resources/xml/wst_ChoiceSelected.xml b/tests/resources/xml/wst_ChoiceSelected.xml deleted file mode 100644 index ed4e7ae3..00000000 --- a/tests/resources/xml/wst_ChoiceSelected.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/resources/xml/wst_ContextData.xml b/tests/resources/xml/wst_ContextData.xml deleted file mode 100644 index 380c0399..00000000 --- a/tests/resources/xml/wst_ContextData.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Some - diff --git a/tests/resources/xml/wst_Image.xml b/tests/resources/xml/wst_Image.xml deleted file mode 100644 index 86f86d23..00000000 --- a/tests/resources/xml/wst_Image.xml +++ /dev/null @@ -1 +0,0 @@ -iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII= diff --git a/tests/resources/xml/wst_InteractiveChallengeResponse.xml b/tests/resources/xml/wst_InteractiveChallengeResponse.xml deleted file mode 100644 index dad713b4..00000000 --- a/tests/resources/xml/wst_InteractiveChallengeResponse.xml +++ /dev/null @@ -1,10 +0,0 @@ - - 654321 - - - - - Some - - Some - diff --git a/tests/resources/xml/wst_TextChallenge.xml b/tests/resources/xml/wst_TextChallenge.xml deleted file mode 100644 index 18c77e13..00000000 --- a/tests/resources/xml/wst_TextChallenge.xml +++ /dev/null @@ -1,3 +0,0 @@ - - iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII= - diff --git a/tests/resources/xml/wst_TextChallengeResponse.xml b/tests/resources/xml/wst_TextChallengeResponse.xml deleted file mode 100644 index d4ebde11..00000000 --- a/tests/resources/xml/wst_TextChallengeResponse.xml +++ /dev/null @@ -1 +0,0 @@ -654321 diff --git a/tests/resources/xml/wst_Title.xml b/tests/resources/xml/wst_Title.xml deleted file mode 100644 index 5facf7d2..00000000 --- a/tests/resources/xml/wst_Title.xml +++ /dev/null @@ -1 +0,0 @@ -phpunit