Skip to content
Open
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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"psr/clock": "~1.0",
"psr/log": "~3.0",
"simplesamlphp/assert": "~2.0",
"simplesamlphp/xml-common": "~2.8",
"simplesamlphp/xml-security": "~2.3"
"simplesamlphp/xml-common": "dev-feature/dom-migration-php84",
"simplesamlphp/xml-security": "dev-feature/dom-migration-php84"
},
"require-dev": {
"beste/clock": "~3.0",
Expand Down
11 changes: 5 additions & 6 deletions src/SAML11/Utils/XPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace SimpleSAML\SAML11\Utils;

use DOMNode;
use DOMXPath;
use Dom;
use SimpleSAML\SAML11\Constants as C;

/**
Expand All @@ -16,15 +15,15 @@
class XPath extends \SimpleSAML\XMLSecurity\Utils\XPath
{
/**
* Get a DOMXPath object that can be used to search for SAML elements.
* Get a Dom\XPath object that can be used to search for SAML 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
* saml-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/SAML11/XML/CanonicalizableElementTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML;

use DOMElement;
use Dom;
use SimpleSAML\SAML11\Assert\Assert;
use SimpleSAML\XMLSecurity\Constants as C;
use SimpleSAML\XMLSecurity\Exception\CanonicalizationFailedException;
Expand All @@ -26,15 +26,15 @@ trait CanonicalizableElementTrait
* Process all transforms specified by a given Reference element.
*
* @param \SimpleSAML\XMLSecurity\XML\ds\Transforms $transforms The transforms to apply.
* @param \DOMElement $data The data referenced.
* @param \Dom\Element $data The data referenced.
*
* @return string The canonicalized data after applying all transforms specified by $ref.
*
* @see http://www.w3.org/TR/xmldsig-core/#sec-ReferenceProcessingModel
*/
public function processTransforms(
Transforms $transforms,
DOMElement $data,
Dom\Element $data,
): string {
Assert::maxCount(
$transforms->getTransform(),
Expand Down
12 changes: 6 additions & 6 deletions src/SAML11/XML/SignableElementTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML;

use DOMElement;
use Dom;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML11\Compat\ContainerSingleton;
use SimpleSAML\XML\DOMDocumentFactory;
Expand Down Expand Up @@ -72,20 +72,20 @@ public function sign(
/**
* Do the actual signing of the document.
*
* Note that this method does not insert the signature in the returned \DOMElement. The signature will be available
* Note that this method does not insert the signature in the returned \Dom\Element. The signature will be available
* in $this->signature as a \SimpleSAML\XMLSecurity\XML\ds\Signature object, which can then be converted to XML
* calling toXML() on it, passing the \DOMElement value returned here as a parameter. The resulting \DOMElement
* calling toXML() on it, passing the \Dom\Element value returned here as a parameter. The resulting \Dom\Element
* can then be inserted in the position desired.
*
* E.g.:
* $xml = // our XML to sign
* $signedXML = $this->doSign($xml);
* $signedXML->appendChild($this->signature->toXML($signedXML));
*
* @param \DOMElement $xml The element to sign.
* @return \DOMElement The signed element, without the signature attached to it just yet.
* @param \Dom\Element $xml The element to sign.
* @return \Dom\Element The signed element, without the signature attached to it just yet.
*/
protected function doSign(DOMElement $xml): DOMElement
protected function doSign(Dom\Element $xml): Dom\Element
{
Assert::notNull(
$this->signer,
Expand Down
6 changes: 3 additions & 3 deletions src/SAML11/XML/saml/AbstractActionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML11\Type\SAMLAnyURIValue;
use SimpleSAML\SAML11\Type\SAMLStringValue;
Expand Down Expand Up @@ -60,7 +60,7 @@ public function getNamespace(): ?SAMLAnyURIValue
* @throws \SimpleSAML\XML\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 @@ -75,7 +75,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this ActionType to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);
$e->textContent = strval($this->getValue());
Expand Down
8 changes: 4 additions & 4 deletions src/SAML11/XML/saml/AbstractAdviceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML11\Constants as C;
use SimpleSAML\XML\Chunk;
Expand Down Expand Up @@ -87,7 +87,7 @@ public function isEmptyElement(): bool
* @throws \SimpleSAML\XML\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 @@ -96,7 +96,7 @@ public static function fromXML(DOMElement $xml): static
foreach ($xml->childNodes as $element) {
if ($element->namespaceURI === C::NS_SAML) {
continue;
} elseif (!($element instanceof DOMElement)) {
} elseif (!($element instanceof Dom\Element)) {
continue;
}

Expand All @@ -114,7 +114,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this EvidenceType to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
14 changes: 7 additions & 7 deletions src/SAML11/XML/saml/AbstractAssertionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\SAML11\Assert\Assert;
use SimpleSAML\SAML11\Compat\ContainerSingleton;
use SimpleSAML\SAML11\Constants as C;
Expand Down Expand Up @@ -50,7 +50,7 @@ abstract class AbstractAssertionType extends AbstractSamlElement implements
/**
* The original signed XML
*/
protected DOMElement $xml;
protected Dom\Element $xml;


/**
Expand Down Expand Up @@ -231,15 +231,15 @@ public function getAttributeStatements(): array
/**
* Set the XML element.
*/
private function setOriginalXML(DOMElement $xml): void
private function setOriginalXML(Dom\Element $xml): void
{
$this->xml = $xml;
}


/**
*/
protected function getOriginalXML(): DOMElement
protected function getOriginalXML(): Dom\Element
{
return $this->xml ?? $this->toUnsignedXML();
}
Expand All @@ -258,7 +258,7 @@ public function getBlacklistedAlgorithms(): ?array
* @throws \SimpleSAML\XML\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 @@ -312,7 +312,7 @@ public static function fromXML(DOMElement $xml): static
* Convert this assertion to an unsigned XML document.
* This method does not sign the resulting XML document.
*/
protected function toUnsignedXML(?DOMElement $parent = null): DOMElement
protected function toUnsignedXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand All @@ -338,7 +338,7 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement
*
* @throws \Exception
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
if ($this->isSigned() === true && $this->signer === null) {
// We already have a signed document and no signer was set to re-sign it
Expand Down
4 changes: 2 additions & 2 deletions src/SAML11/XML/saml/AbstractAttributeDesignatorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\SAML11\Type\SAMLAnyURIValue;
use SimpleSAML\SAML11\Type\SAMLStringValue;

Expand Down Expand Up @@ -55,7 +55,7 @@ public function getAttributeNamespace(): SAMLAnyURIValue
/**
* Convert this AttributeDesignatorType 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/SAML11/XML/saml/AbstractAttributeStatementType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
Expand Down Expand Up @@ -51,7 +51,7 @@ public function getAttributes(): array
* @throws \SimpleSAML\XML\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 @@ -70,7 +70,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this AttributeStatementType to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::toXML($parent);

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

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML11\Type\SAMLAnyURIValue;
use SimpleSAML\SAML11\Type\SAMLStringValue;
Expand Down Expand Up @@ -53,7 +53,7 @@ public function getAttributeValue(): array
* @throws \SimpleSAML\XML\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 @@ -69,7 +69,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this AttributeType to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::toXML($parent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\Assert\Assert;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
Expand Down Expand Up @@ -44,7 +44,7 @@ public function getAudience(): array
* @throws \SimpleSAML\XML\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::getNamespaceURI(), InvalidDOMElementException::class);
Expand All @@ -61,7 +61,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this AudienceRestrictionCondition 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/SAML11/XML/saml/AbstractAuthenticationStatementType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML11\Type\SAMLAnyURIValue;
use SimpleSAML\SAML11\Type\SAMLDateTimeValue;
Expand Down Expand Up @@ -92,7 +92,7 @@ public function getAuthenticationInstant(): SAMLDateTimeValue
* @throws \SimpleSAML\XML\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 @@ -118,7 +118,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this AuthenticationStatementType to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = parent::toXML($parent);

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

namespace SimpleSAML\SAML11\XML\saml;

use DOMElement;
use Dom;
use SimpleSAML\SAML11\Assert\Assert;
use SimpleSAML\SAML11\Type\SAMLAnyURIValue;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
Expand Down Expand Up @@ -73,7 +73,7 @@ public function getBinding(): SAMLAnyURIValue
* @throws \SimpleSAML\XML\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 @@ -89,7 +89,7 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this AuthorityBindingType to XML.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
Loading
Loading