Skip to content

Commit

Permalink
Move bindings to sub-directory
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jul 26, 2024
1 parent ec27ff0 commit f3e8035
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 63 deletions.
78 changes: 39 additions & 39 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
parameters:
ignoreErrors:
-
message: "#^Access to constant AES128_CBC on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/Certificate/PrivateKeyLoader.php

-
message: "#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
message: "#^Call to static method addSign\\(\\) on an unknown class SimpleSAML\\\\Module\\\\saml\\\\Message\\.$#"
count: 1
path: src/SAML2/Certificate/PrivateKeyLoader.php
path: src/SAML2/Binding/HTTPArtifact.php

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

-
message: "#^Method SimpleSAML\\\\SAML2\\\\Certificate\\\\PrivateKeyLoader\\:\\:convertPrivateKeyToRsaKey\\(\\) has invalid return type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Store\\\\StoreFactory\\.$#"
count: 1
path: src/SAML2/Certificate/PrivateKeyLoader.php
path: src/SAML2/Binding/HTTPArtifact.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
message: "#^Call to static method getMetadataHandler\\(\\) on an unknown class SimpleSAML\\\\Metadata\\\\MetaDataStorageHandler\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/SAML2/Binding/HTTPArtifact.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
message: "#^Instantiated class SimpleSAML\\\\Utils\\\\HTTP not found\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/SAML2/Binding/HTTPArtifact.php

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

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

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
message: "#^Property SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:\\$spMetadata has unknown class SimpleSAML\\\\Configuration as its type\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/SAML2/Binding/HTTPArtifact.php

-
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:pluckConfiguration\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
message: "#^Access to constant AES128_CBC on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php
path: src/SAML2/Certificate/PrivateKeyLoader.php

-
message: "#^Call to static method addSign\\(\\) on an unknown class SimpleSAML\\\\Module\\\\saml\\\\Message\\.$#"
message: "#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/HTTPArtifact.php
path: src/SAML2/Certificate/PrivateKeyLoader.php

-
message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#"
message: "#^Instantiated class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey not found\\.$#"
count: 2
path: src/SAML2/HTTPArtifact.php
path: src/SAML2/Certificate/PrivateKeyLoader.php

-
message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Store\\\\StoreFactory\\.$#"
message: "#^Method SimpleSAML\\\\SAML2\\\\Certificate\\\\PrivateKeyLoader\\:\\:convertPrivateKeyToRsaKey\\(\\) has invalid return type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#"
count: 1
path: src/SAML2/HTTPArtifact.php
path: src/SAML2/Certificate/PrivateKeyLoader.php

-
message: "#^Call to static method getMetadataHandler\\(\\) on an unknown class SimpleSAML\\\\Metadata\\\\MetaDataStorageHandler\\.$#"
message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#"
count: 1
path: src/SAML2/Configuration/SimpleSAMLConverter.php

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

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

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

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

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

-
message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Config not found\\.$#"
Expand Down
11 changes: 6 additions & 5 deletions src/SAML2/Binding.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use SimpleSAML\SAML2\Binding\{HTTPArtifact, HTTPPost, HTTPRedirect, SOAP};
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException;
use SimpleSAML\SAML2\XML\samlp\AbstractMessage;
Expand Down Expand Up @@ -90,9 +91,9 @@ public static function getCurrentBinding(ServerRequestInterface $request): Bindi
case 'GET':
$query = $request->getQueryParams();
if (array_key_exists('SAMLRequest', $query) || array_key_exists('SAMLResponse', $query)) {
return new HTTPRedirect();
return new Binding\HTTPRedirect();
} elseif (array_key_exists('SAMLart', $query)) {
return new HTTPArtifact();
return new Binding\HTTPArtifact();
}
break;

Expand All @@ -106,9 +107,9 @@ public static function getCurrentBinding(ServerRequestInterface $request): Bindi

$query = $request->getParsedBody();
if (array_key_exists('SAMLRequest', $query) || array_key_exists('SAMLResponse', $query)) {
return new HTTPPost();
return new Binding\HTTPPost();
} elseif (array_key_exists('SAMLart', $query)) {
return new HTTPArtifact();
return new Binding\HTTPArtifact();
} else {
/**
* The registration information for text/xml is in all respects the same
Expand All @@ -120,7 +121,7 @@ public static function getCurrentBinding(ServerRequestInterface $request): Bindi
|| ($request->hasHeader('SOAPAction')
&& $request->getHeader('SOAPAction')[0] === 'http://www.oasis-open.org/committees/security')
) {
return new SOAP();
return new Binding\SOAP();
}
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace SimpleSAML\SAML2;
namespace SimpleSAML\SAML2\Binding;

use DateInterval;
use Exception;
Expand All @@ -13,6 +13,8 @@
use SimpleSAML\Configuration;
use SimpleSAML\Metadata\MetaDataStorageHandler;
use SimpleSAML\Module\saml\Message as MSG;
use SimpleSAML\SAML2\Binding;
use SimpleSAML\SAML2\SOAPClient;
use SimpleSAML\SAML2\Utils;
use SimpleSAML\SAML2\XML\saml\Issuer;
use SimpleSAML\SAML2\XML\samlp\AbstractMessage;
Expand Down
4 changes: 3 additions & 1 deletion src/SAML2/HTTPPost.php → src/SAML2/Binding/HTTPPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

declare(strict_types=1);

namespace SimpleSAML\SAML2;
namespace SimpleSAML\SAML2\Binding;

use Exception;
use Nyholm\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML2\Binding;
use SimpleSAML\SAML2\Utils;
use SimpleSAML\SAML2\XML\samlp\AbstractMessage;
use SimpleSAML\SAML2\XML\samlp\AbstractRequest;
use SimpleSAML\SAML2\XML\samlp\MessageFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

declare(strict_types=1);

namespace SimpleSAML\SAML2;
namespace SimpleSAML\SAML2\Binding;

use Exception;
use Nyholm\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML2\Binding;
use SimpleSAML\SAML2\Compat\ContainerSingleton;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Utils;
use SimpleSAML\SAML2\XML\samlp\AbstractMessage;
use SimpleSAML\SAML2\XML\samlp\AbstractRequest;
use SimpleSAML\SAML2\XML\samlp\MessageFactory;
Expand Down
3 changes: 2 additions & 1 deletion src/SAML2/SOAP.php → src/SAML2/Binding/SOAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

declare(strict_types=1);

namespace SimpleSAML\SAML2;
namespace SimpleSAML\SAML2\Binding;

use Exception;
use Nyholm\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use SimpleSAML\SAML2\Binding;
use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException;
use SimpleSAML\SAML2\Utils;
use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace SimpleSAML\Test\SAML2;
namespace SimpleSAML\Test\SAML2\Binding;

use Exception;
use Nyholm\Psr7\ServerRequest;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use SimpleSAML\SAML2\HTTPArtifact;
use SimpleSAML\SAML2\Binding\HTTPArtifact;

/**
* @package simplesamlphp\saml2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

declare(strict_types=1);

namespace SimpleSAML\Test\SAML2;
namespace SimpleSAML\Test\SAML2\Binding;

use Exception;
use Nyholm\Psr7\ServerRequest;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\TestCase;
use Psr\Clock\ClockInterface;
use SimpleSAML\SAML2\HTTPPost;
use SimpleSAML\SAML2\Binding\HTTPPost;
use SimpleSAML\SAML2\Utils;
use SimpleSAML\SAML2\XML\saml\Issuer;
use SimpleSAML\SAML2\XML\samlp\AuthnRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

declare(strict_types=1);

namespace SimpleSAML\Test\SAML2;
namespace SimpleSAML\Test\SAML2\Binding;

use Exception;
use Nyholm\Psr7\ServerRequest;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\TestCase;
use Psr\Clock\ClockInterface;
use SimpleSAML\SAML2\Binding\HTTPRedirect;
use SimpleSAML\SAML2\Compat\AbstractContainer;
use SimpleSAML\SAML2\Compat\ContainerSingleton;
use SimpleSAML\SAML2\HTTPRedirect;
use SimpleSAML\SAML2\XML\saml\Issuer;
use SimpleSAML\SAML2\XML\samlp\AbstractRequest;
use SimpleSAML\SAML2\XML\samlp\AuthnRequest;
Expand Down
10 changes: 5 additions & 5 deletions tests/SAML2/SOAPTest.php → tests/SAML2/Binding/SOAPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace SimpleSAML\Test\SAML2;
namespace SimpleSAML\Test\SAML2\Binding;

use Mockery\Adapter\Phpunit\MockeryTestCase;
use Nyholm\Psr7\ServerRequest;
use PHPUnit\Framework\Attributes\CoversClass;
use SimpleSAML\SAML2\Binding\SOAP;
use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException;
use SimpleSAML\SAML2\SOAP;
use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated;
use SimpleSAML\SAML2\XML\ecp\Response;
use SimpleSAML\SAML2\XML\samlp\ArtifactResolve;
Expand Down Expand Up @@ -77,7 +77,7 @@ public function testRequestParsing(): void
public function testSendArtifactResponse(): void
{
$artifact = DOMDocumentFactory::fromFile(
dirname(__FILE__, 2) . '/resources/xml/samlp_ArtifactResponse.xml',
dirname(__FILE__, 3) . '/resources/xml/samlp_ArtifactResponse.xml',
);
$message = MessageFactory::fromXML($artifact->documentElement);

Expand All @@ -102,7 +102,7 @@ public function testSendArtifactResponse(): void
public function testSendResponse(): void
{
$response = DOMDocumentFactory::fromFile(
dirname(__FILE__, 2) . '/resources/xml/samlp_Response.xml',
dirname(__FILE__, 3) . '/resources/xml/samlp_Response.xml',
);
$message = MessageFactory::fromXML($response->documentElement);

Expand Down Expand Up @@ -131,7 +131,7 @@ public function testSendResponse(): void


/**
* @return \SimpleSAML\SAML2\SOAP
* @return \SimpleSAML\SAML2\Binding\SOAP
*/
private function getStubWithInput($input): SOAP
{
Expand Down
5 changes: 1 addition & 4 deletions tests/SAML2/BindingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
use SimpleSAML\SAML2\Binding;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException;
use SimpleSAML\SAML2\HTTPArtifact;
use SimpleSAML\SAML2\HTTPPost;
use SimpleSAML\SAML2\HTTPRedirect;
use SimpleSAML\SAML2\SOAP;
use SimpleSAML\SAML2\Binding\{HTTPArtifact, HTTPPost, HTTPRedirect, SOAP};

/**
* @package simplesamlphp\saml2
Expand Down

0 comments on commit f3e8035

Please sign in to comment.