Skip to content

Commit

Permalink
Update to reflect upstream changes to the SOAP-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Sep 16, 2024
1 parent a4f4cfa commit 120d1ce
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 183 deletions.
119 changes: 77 additions & 42 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,209 +3,244 @@ parameters:
-
message: "#^Call to static method addSign\\(\\) on an unknown class SimpleSAML\\\\Module\\\\saml\\\\Message\\.$#"
count: 1
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#"
count: 2
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Store\\\\StoreFactory\\.$#"
count: 1
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Call to static method getMetadataHandler\\(\\) on an unknown class SimpleSAML\\\\Metadata\\\\MetaDataStorageHandler\\.$#"
count: 1
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Instantiated class SimpleSAML\\\\Utils\\\\HTTP not found\\.$#"
count: 1
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:validateSignature\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Parameter \\$sp of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:setSPMetadata\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Property SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:\\$spMetadata has unknown class SimpleSAML\\\\Configuration as its type\\.$#"
count: 1
path: src/SAML2/Binding/HTTPArtifact.php
path: src/Binding/HTTPArtifact.php

-
message: "#^Access to constant AES128_CBC on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/Certificate/PrivateKeyLoader.php
path: src/Certificate/PrivateKeyLoader.php

-
message: "#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/Certificate/PrivateKeyLoader.php
path: src/Certificate/PrivateKeyLoader.php

-
message: "#^Instantiated class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey not found\\.$#"
count: 2
path: src/SAML2/Certificate/PrivateKeyLoader.php
path: src/Certificate/PrivateKeyLoader.php

-
message: "#^Method SimpleSAML\\\\SAML2\\\\Certificate\\\\PrivateKeyLoader\\:\\:convertPrivateKeyToRsaKey\\(\\) has invalid return type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/Certificate/PrivateKeyLoader.php
path: src/Certificate/PrivateKeyLoader.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/Configuration/SimpleSAMLConverter.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/Configuration/SimpleSAMLConverter.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForDecryptionProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/Configuration/SimpleSAMLConverter.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/Configuration/SimpleSAMLConverter.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/Configuration/SimpleSAMLConverter.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:pluckConfiguration\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/Configuration/SimpleSAMLConverter.php

-
message: "#^Call to static method fromXML\\(\\) on an unknown class SimpleSAML\\\\SOAP11\\\\XML\\\\env\\\\Envelope\\.$#"
count: 1
path: src/SOAPClient.php

-
message: "#^Call to static method fromXML\\(\\) on an unknown class SimpleSAML\\\\SOAP11\\\\XML\\\\env\\\\Fault\\.$#"
count: 1
path: src/SOAPClient.php

-
message: "#^Call to static method getXPath\\(\\) on an unknown class SimpleSAML\\\\SOAP11\\\\Utils\\\\XPath\\.$#"
count: 1
path: src/SOAPClient.php

-
message: "#^Call to static method xpQuery\\(\\) on an unknown class SimpleSAML\\\\SOAP11\\\\Utils\\\\XPath\\.$#"
count: 1
path: src/SOAPClient.php

-
message: "#^Instantiated class SimpleSAML\\\\SOAP11\\\\XML\\\\env\\\\Body not found\\.$#"
count: 1
path: src/SOAPClient.php

-
message: "#^Instantiated class SimpleSAML\\\\SOAP11\\\\XML\\\\env\\\\Envelope not found\\.$#"
count: 1
path: src/SOAPClient.php

-
message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Config not found\\.$#"
count: 1
path: src/SAML2/SOAPClient.php
path: src/SOAPClient.php

-
message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Crypto not found\\.$#"
count: 1
path: src/SAML2/SOAPClient.php
path: src/SOAPClient.php

-
message: "#^Method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:getSOAPFault\\(\\) has invalid return type SimpleSAML\\\\SOAP11\\\\XML\\\\env\\\\Fault\\.$#"
count: 1
path: src/SOAPClient.php

-
message: "#^Parameter \\$dstMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/SOAPClient.php
path: src/SOAPClient.php

-
message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:validateSSL\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/SOAPClient.php
path: src/SOAPClient.php

-
message: "#^Parameter \\$srcMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/SOAPClient.php
path: src/SOAPClient.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 2
path: src/SAML2/XML/md/AbstractEndpointType.php
path: src/XML/md/AbstractEndpointType.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 2
path: src/SAML2/XML/md/AbstractIndexedEndpointType.php
path: src/XML/md/AbstractIndexedEndpointType.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractRoleDescriptor\\)\\:\\:XSI_TYPE_NAME\\.$#"
count: 2
path: src/SAML2/XML/md/AbstractRoleDescriptor.php
path: src/XML/md/AbstractRoleDescriptor.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractRoleDescriptor\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#"
count: 2
path: src/SAML2/XML/md/AbstractRoleDescriptor.php
path: src/XML/md/AbstractRoleDescriptor.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractRoleDescriptor\\)\\:\\:XSI_TYPE_PREFIX\\.$#"
count: 2
path: src/SAML2/XML/md/AbstractRoleDescriptor.php
path: src/XML/md/AbstractRoleDescriptor.php

-
message: "#^Call to an undefined static method SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractSignedMdElement\\:\\:getXsiTypeNamespaceURI\\(\\)\\.$#"
count: 1
path: src/SAML2/XML/md/AbstractSignedMdElement.php
path: src/XML/md/AbstractSignedMdElement.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractBaseID\\)\\:\\:XSI_TYPE_NAME\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractBaseID.php
path: src/XML/saml/AbstractBaseID.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractBaseID\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractBaseID.php
path: src/XML/saml/AbstractBaseID.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractBaseID\\)\\:\\:XSI_TYPE_PREFIX\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractBaseID.php
path: src/XML/saml/AbstractBaseID.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractCondition\\)\\:\\:XSI_TYPE_NAME\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractCondition.php
path: src/XML/saml/AbstractCondition.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractCondition\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractCondition.php
path: src/XML/saml/AbstractCondition.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractCondition\\)\\:\\:XSI_TYPE_PREFIX\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractCondition.php
path: src/XML/saml/AbstractCondition.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractStatement\\)\\:\\:XSI_TYPE_NAME\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractStatement.php
path: src/XML/saml/AbstractStatement.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractStatement\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractStatement.php
path: src/XML/saml/AbstractStatement.php

-
message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractStatement\\)\\:\\:XSI_TYPE_PREFIX\\.$#"
count: 2
path: src/SAML2/XML/saml/AbstractStatement.php
path: src/XML/saml/AbstractStatement.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/SAML2/XML/saml/Attribute.php
path: src/XML/saml/Attribute.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/SAML2/XML/saml/EncryptedAttribute.php
path: src/XML/saml/EncryptedAttribute.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/SAML2/XML/saml/EncryptedID.php
path: src/XML/saml/EncryptedID.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/SAML2/XML/saml/NameIDType.php
path: src/XML/saml/NameIDType.php
10 changes: 5 additions & 5 deletions src/Binding/SOAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
use SimpleSAML\SAML2\XML\samlp\AbstractMessage;
use SimpleSAML\SAML2\XML\samlp\MessageFactory;
use SimpleSAML\SAML2\XML\samlp\Response as SAML2_Response;
use SimpleSAML\SOAP11\Utils\XPath;
use SimpleSAML\SOAP11\XML\env\Body;
use SimpleSAML\SOAP11\XML\env\Envelope;
use SimpleSAML\SOAP11\XML\env\Header;
use SimpleSAML\SOAP\Utils\XPath;
use SimpleSAML\SOAP\XML\env_200106\Body;
use SimpleSAML\SOAP\XML\env_200106\Envelope;
use SimpleSAML\SOAP\XML\env_200106\Header;
use SimpleSAML\XML\DOMDocumentFactory;

use function file_get_contents;
Expand Down Expand Up @@ -100,7 +100,7 @@ public function receive(/** @scrutinizer ignore-unused */ServerRequestInterface

$xpCache = XPath::getXPath($document->documentElement);
/** @var \DOMElement[] $results */
$results = XPath::xpQuery($xml, '/env:Envelope/env:Body/*[1]', $xpCache);
$results = XPath::xpQuery($xml, '/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]', $xpCache);

return MessageFactory::fromXML($results[0]);
}
Expand Down
17 changes: 4 additions & 13 deletions src/XML/alg/DigestMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use DOMElement;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML2\Assert\Assert as SAMLAssert;
use SimpleSAML\XML\Chunk;
use SimpleSAML\XML\Exception\InvalidDOMElementException;
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XML\XsNamespace as NS;
Expand Down Expand Up @@ -68,18 +67,10 @@ public static function fromXML(DOMElement $xml): static
Assert::same($xml->localName, 'DigestMethod', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, DigestMethod::NS, InvalidDOMElementException::class);

$Algorithm = self::getAttribute($xml, 'Algorithm');

$elements = [];
foreach ($xml->childNodes as $element) {
if (!($element instanceof DOMElement)) {
continue;
}

$elements[] = new Chunk($element);
}

return new static($Algorithm, $elements);
return new static(
self::getAttribute($xml, 'Algorithm'),
self::getChildElementsFromXML($xml),
);
}


Expand Down
21 changes: 6 additions & 15 deletions src/XML/alg/SigningMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use DOMElement;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML2\Assert\Assert as SAMLAssert;
use SimpleSAML\XML\Chunk;
use SimpleSAML\XML\Exception\InvalidDOMElementException;
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XML\XsNamespace as NS;
Expand Down Expand Up @@ -99,20 +98,12 @@ public static function fromXML(DOMElement $xml): static
Assert::same($xml->localName, 'SigningMethod', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, SigningMethod::NS, InvalidDOMElementException::class);

$Algorithm = self::getAttribute($xml, 'Algorithm');
$MinKeySize = self::getOptionalIntegerAttribute($xml, 'MinKeySize', null);
$MaxKeySize = self::getOptionalIntegerAttribute($xml, 'MaxKeySize', null);

$elements = [];
foreach ($xml->childNodes as $element) {
if (!($element instanceof DOMElement)) {
continue;
}

$elements[] = new Chunk($element);
}

return new static($Algorithm, $MinKeySize, $MaxKeySize, $elements);
return new static(
self::getAttribute($xml, 'Algorithm'),
self::getOptionalIntegerAttribute($xml, 'MinKeySize', null),
self::getOptionalIntegerAttribute($xml, 'MaxKeySize', null),
self::getChildElementsFromXML($xml),
);
}


Expand Down
Loading

0 comments on commit 120d1ce

Please sign in to comment.