Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"php": "^8.5",
"ext-dom": "*",

"simplesamlphp/assert": "~2.0",
"simplesamlphp/saml2": "~6.1",
"simplesamlphp/xml-common": "~2.8",
"simplesamlphp/xml-security": "~2.3",
"simplesamlphp/xml-ws-addressing": "~1.3",
"simplesamlphp/xml-ws-security-policy": "~1.2",
"simplesamlphp/xml-wss-core": "~1.3"
"simplesamlphp/assert": "~3.0",
"simplesamlphp/saml2": "~7.0@RC",
"simplesamlphp/xml-common": "~3.0",
"simplesamlphp/xml-security": "~3.0",
"simplesamlphp/xml-ws-addressing": "~2.0",
"simplesamlphp/xml-ws-security-policy": " ~2.0",
"simplesamlphp/xml-wss-core": "~2.0"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "~2.0"
Expand Down
9 changes: 4 additions & 5 deletions src/Utils/XPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace SimpleSAML\WebServices\Federation\Utils;

use DOMNode;
use DOMXPath;
use Dom;
use SimpleSAML\WebServices\Federation\Constants as C;

/**
Expand All @@ -18,13 +17,13 @@ class XPath extends \SimpleSAML\WebServices\Security\Utils\XPath
/*
* Get a DOMXPath object that can be used to search for WS Federation elements.
*
* @param \DOMNode $node The document to associate to the DOMXPath object.
* @param \Dom\Node $node The document to associate to the \Dom\XPath 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
* @return \Dom\XPath A \Dom\XPath object ready to use in the given document, with several
* ws-related namespaces already registered.
*/
public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath
public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath
{
$xp = parent::getXPath($node, $autoregister);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractAdditionalContextType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\WebServices\Federation\XML\auth\ContextItem;
use SimpleSAML\XML\ExtendableAttributesTrait;
Expand Down Expand Up @@ -64,7 +64,7 @@ public function getContextItem(): array
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -83,7 +83,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this AdditionalContext to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractClaimType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\WebServices\Federation\XML\auth\ConstrainedValue;
use SimpleSAML\WebServices\Federation\XML\auth\Description;
Expand Down Expand Up @@ -168,7 +168,7 @@ public function getOptional(): ?BooleanValue
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand Down Expand Up @@ -212,7 +212,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this ClaimType to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractConstrainedManyValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;

Expand Down Expand Up @@ -70,7 +70,7 @@ public function isEmptyElement(): bool
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -88,7 +88,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this element to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractConstrainedSingleValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
Expand Down Expand Up @@ -73,7 +73,7 @@ public function isEmptyElement(): bool
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -94,7 +94,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this element to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractConstrainedValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
Expand Down Expand Up @@ -74,7 +74,7 @@ public function getAssertConstraint(): ?BooleanValue
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand Down Expand Up @@ -108,7 +108,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this ConstrainedValueType to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractContextItemType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\ExtendableElementTrait;
Expand Down Expand Up @@ -101,7 +101,7 @@ public function getScope(): ?AnyURIValue
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -125,7 +125,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this ContextItemType to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
12 changes: 8 additions & 4 deletions src/XML/auth/AbstractDescriptionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\TypedTextContentTrait;
Expand Down Expand Up @@ -48,19 +48,23 @@ final public function __construct(StringValue $value, array $namespacedAttribute
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $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));
/** @var string $textContent */
$textContent = $xml->textContent;
Assert::notNull($textContent);

return new static(StringValue::fromString($textContent), self::getAttributesNSFromXML($xml));
}


/**
* Convert this element to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
$e->textContent = $this->getContent()->getValue();
Expand Down
12 changes: 8 additions & 4 deletions src/XML/auth/AbstractDisplayNameType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\TypedTextContentTrait;
Expand Down Expand Up @@ -48,19 +48,23 @@ final public function __construct(StringValue $value, array $namespacedAttribute
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $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));
/** @var string $textContent */
$textContent = $xml->textContent;
Assert::notNull($textContent);

return new static(StringValue::fromString($textContent), self::getAttributesNSFromXML($xml));
}


/**
* Convert this element to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
$e->textContent = $this->getContent()->getValue();
Expand Down
12 changes: 8 additions & 4 deletions src/XML/auth/AbstractDisplayValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\TypedTextContentTrait;
Expand Down Expand Up @@ -48,19 +48,23 @@ final public function __construct(StringValue $value, array $namespacedAttribute
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $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));
/** @var string $textContent */
$textContent = $xml->textContent;
Assert::notNull($textContent);

return new static(StringValue::fromString($textContent), self::getAttributesNSFromXML($xml));
}


/**
* Convert this element to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
$e->textContent = $this->getContent()->getValue();
Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractEncryptedValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
Expand Down Expand Up @@ -60,7 +60,7 @@ public function getEncryptedData(): EncryptedData
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -79,7 +79,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this element to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractStructuredValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\ExtendableElementTrait;
Expand Down Expand Up @@ -53,7 +53,7 @@ final public function __construct(
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand All @@ -68,7 +68,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Add this StructuredValueType to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::instantiateParentElement($parent);

Expand Down
6 changes: 3 additions & 3 deletions src/XML/auth/AbstractValueInRangeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\WebServices\Federation\XML\auth;

use DOMElement;
use Dom;
use SimpleSAML\WebServices\Federation\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
Expand Down Expand Up @@ -36,7 +36,7 @@ final public function __construct(
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* if the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
Expand Down Expand Up @@ -81,7 +81,7 @@ public function getValueLowerBound(): ValueLowerBound
/**
* Add this ValueInRangeType to an XML element.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::instantiateParentElement($parent);

Expand Down
Loading