diff --git a/composer.json b/composer.json index ca31041..fde9c6a 100644 --- a/composer.json +++ b/composer.json @@ -32,16 +32,17 @@ "ext-dom": "*", "ext-filter": "*", "ext-libxml": "*", + "ext-SimpleXML": "*", - "simplesamlphp/assert": "^1.0", - "simplesamlphp/composer-module-installer": "^1.3.4", + "simplesamlphp/assert": "^1.1", + "simplesamlphp/composer-module-installer": "^1.3", "simplesamlphp/simplesamlphp": "^2.1", - "simplesamlphp/xml-cas": "^1.0.3", - "simplesamlphp/xml-common": "^1.12.2", - "simplesamlphp/xml-soap": "^1.3.0" + "simplesamlphp/xml-cas": "^1.2", + "simplesamlphp/xml-common": "^1.16", + "simplesamlphp/xml-soap": "^1.4" }, "require-dev": { - "simplesamlphp/simplesamlphp-test-framework": "^1.5.5" + "simplesamlphp/simplesamlphp-test-framework": "^1.5" }, "support": { "issues": "https://github.com/simplesamlphp/simplesamlphp-module-casserver/issues", diff --git a/phpcs.xml b/phpcs.xml index 511ab86..4b5e79a 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -15,6 +15,7 @@ tests/bootstrap.php + tests/public/UtilsTest.php tests/www/UtilsTest.php diff --git a/psalm-dev.xml b/psalm-dev.xml index 6116331..fc2fbd3 100644 --- a/psalm-dev.xml +++ b/psalm-dev.xml @@ -21,6 +21,7 @@ + diff --git a/psalm.xml b/psalm.xml index 5887f14..a7a64d4 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,9 +6,9 @@ reportMixedIssues="false" > - + + - diff --git a/public/utility/validateTicket.php b/public/utility/validateTicket.php index e9ca543..f01adfe 100644 --- a/public/utility/validateTicket.php +++ b/public/utility/validateTicket.php @@ -30,11 +30,11 @@ declare(strict_types=1); use Exception; +use SimpleSAML\CAS\Constants as C; use SimpleSAML\Configuration; use SimpleSAML\Logger; use SimpleSAML\Module; use SimpleSAML\Utils; -use SimpleSAML\XML\CAS\Constants as C; require_once('urlUtils.php'); diff --git a/src/Cas/Protocol/Cas20.php b/src/Cas/Protocol/Cas20.php index 250d044..75a753d 100644 --- a/src/Cas/Protocol/Cas20.php +++ b/src/Cas/Protocol/Cas20.php @@ -29,7 +29,6 @@ use SimpleSAML\CAS\XML\cas\AuthenticationDate; use SimpleSAML\CAS\XML\cas\AuthenticationFailure; use SimpleSAML\CAS\XML\cas\AuthenticationSuccess; -use SimpleSAML\CAS\XML\cas\Code; use SimpleSAML\CAS\XML\cas\IsFromNewLogin; use SimpleSAML\CAS\XML\cas\LongTermAuthenticationRequestTokenUsed; use SimpleSAML\CAS\XML\cas\ProxyFailure; @@ -170,8 +169,7 @@ public function getValidateSuccessResponse(string $username): AuthenticationSucc */ public function getValidateFailureResponse(string $errorCode, string $explanation): ServiceResponse { - $code = new Code($errorCode); - $authenticationFailure = new AuthenticationFailure($explanation, $code); + $authenticationFailure = new AuthenticationFailure($explanation, $errorCode); $serviceResponse = new ServiceResponse($authenticationFailure); return $serviceResponse; @@ -199,8 +197,7 @@ public function getProxySuccessResponse(string $proxyTicketId): ServiceResponse */ public function getProxyFailureResponse(string $errorCode, string $explanation): ServiceResponse { - $code = new Code($errorCode); - $proxyFailure = new ProxyFailure($explanation, $code); + $proxyFailure = new ProxyFailure($explanation, $errorCode); $serviceResponse = new ServiceResponse($proxyFailure); return $serviceResponse; diff --git a/src/Cas/Protocol/SamlValidateResponder.php b/src/Cas/Protocol/SamlValidateResponder.php index cd90ef9..cad347a 100644 --- a/src/Cas/Protocol/SamlValidateResponder.php +++ b/src/Cas/Protocol/SamlValidateResponder.php @@ -6,11 +6,11 @@ use SimpleSAML\Configuration; use SimpleSAML\Module\casserver\Shib13\AuthnResponse; +use SimpleSAML\SOAP11\XML\env\Body; +use SimpleSAML\SOAP11\XML\env\Envelope; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\SOAP11\XML\env\Body; -use SimpleSAML\XML\SOAP11\XML\env\Envelope; class SamlValidateResponder { @@ -64,7 +64,7 @@ public function convertToSaml(array $ticket): Chunk /** * @param \SimpleSAML\XML\SerializableElementInterface $samlResponse - * @return \SimpleSAML\XML\SOAP11\XML\env\Envelope + * @return \SimpleSAML\SOAP11\XML\env\Envelope */ public function wrapInSoap(SerializableElementInterface $samlResponse): Envelope { diff --git a/src/Cas/Ticket/TicketFactory.php b/src/Cas/Ticket/TicketFactory.php index b28f06c..994663d 100644 --- a/src/Cas/Ticket/TicketFactory.php +++ b/src/Cas/Ticket/TicketFactory.php @@ -103,7 +103,7 @@ public function createProxyGrantingTicket(array $content): array */ public function createProxyTicket(array $content): array { - $randomUtils = Random(); + $randomUtils = new Random(); $id = str_replace('_', 'PT-', $randomUtils->generateID()); $expiresAt = time() + $this->proxyTicketExpireTime; diff --git a/src/Cas/TicketValidator.php b/src/Cas/TicketValidator.php index 372371e..bd0f891 100644 --- a/src/Cas/TicketValidator.php +++ b/src/Cas/TicketValidator.php @@ -5,13 +5,13 @@ namespace SimpleSAML\Module\casserver\Cas; use InvalidArgumentException; +use SimpleSAML\CAS\Constants as C; use SimpleSAML\Configuration; use SimpleSAML\Logger; use SimpleSAML\Module; use SimpleSAML\Module\casserver\Cas\CasException; use SimpleSAML\Module\casserver\Cas\Ticket\TicketFactory; use SimpleSAML\Module\casserver\Cas\Ticket\TicketStore; -use SimpleSAML\XML\CAS\Constants as C; class TicketValidator { diff --git a/src/Shib13/AuthnResponse.php b/src/Shib13/AuthnResponse.php index b21cb9b..a56a3e5 100644 --- a/src/Shib13/AuthnResponse.php +++ b/src/Shib13/AuthnResponse.php @@ -7,7 +7,7 @@ use DOMDocument; use DOMNode; use DOMNodeList; -use DOMXpath; +use DOMXPath; use Exception; use SimpleSAML\Assert\Assert; use SimpleSAML\Configuration; diff --git a/tests/public/LoginIntegrationTest.php b/tests/public/LoginIntegrationTest.php index 5231753..31bd6a4 100644 --- a/tests/public/LoginIntegrationTest.php +++ b/tests/public/LoginIntegrationTest.php @@ -4,6 +4,7 @@ namespace SimpleSAML\Casserver; +use CurlHandle; use DOMDocument; use PHPUnit\Framework\TestCase; use SimpleSAML\Configuration; @@ -452,10 +453,10 @@ private function authenticate(): void /** * TODO: migrate into BuiltInServer - * @param resource $ch + * @param \CurlHandle $ch * @return array */ - private function execAndHandleCurlResponse($ch): array + private function execAndHandleCurlResponse(CurlHandle $ch): array { $resp = curl_exec($ch); if ($resp === false) { diff --git a/tests/src/Cas/Protocol/SamlValidateTest.php b/tests/src/Cas/Protocol/SamlValidateTest.php index cbe9276..d9ce298 100644 --- a/tests/src/Cas/Protocol/SamlValidateTest.php +++ b/tests/src/Cas/Protocol/SamlValidateTest.php @@ -47,7 +47,7 @@ public function testSamlValidatXmlGeneration(): void $asSoap = $samlValidate->wrapInSoap($xmlString); - $this->assertInstanceOf($asSoap, Envelope::class); + $this->assertInstanceOf(Envelope::class, $asSoap); $this->assertNull($asSoap->getHeader()); $this->assertNotEmpty($asSoap->getBody()); } diff --git a/tools/composer-require-checker.json b/tools/composer-require-checker.json index acb6358..fd1fdc6 100644 --- a/tools/composer-require-checker.json +++ b/tools/composer-require-checker.json @@ -1,5 +1,7 @@ { "symbol-whitelist": [ - "ext-PDO" + "PDO", + "PDOException", + "PDOStatement" ] }