diff --git a/src/Constants.php b/src/Constants.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/Controller/Adfs.php b/src/Controller/Adfs.php index ea475c0..8755fc6 100644 --- a/src/Controller/Adfs.php +++ b/src/Controller/Adfs.php @@ -127,14 +127,14 @@ public function metadata(Request $request): Response 'SingleSignOnService' => [ 0 => [ 'Binding' => Constants::BINDING_HTTP_REDIRECT, - 'Location' => $adfs_service_location - ] + 'Location' => $adfs_service_location, + ], ], 'SingleLogoutService' => [ 0 => [ 'Binding' => Constants::BINDING_HTTP_REDIRECT, - 'Location' => $adfs_service_location - ] + 'Location' => $adfs_service_location, + ], ], ]; @@ -146,14 +146,14 @@ public function metadata(Request $request): Response $metaArray['NameIDFormat'] = $idpmeta->getOptionalString( 'NameIDFormat', - Constants::NAMEID_TRANSIENT + Constants::NAMEID_TRANSIENT, ); if ($idpmeta->hasValue('OrganizationName')) { $metaArray['OrganizationName'] = $idpmeta->getLocalizedString('OrganizationName'); $metaArray['OrganizationDisplayName'] = $idpmeta->getOptionalLocalizedString( 'OrganizationDisplayName', - $metaArray['OrganizationName'] + $metaArray['OrganizationName'], ); if (!$idpmeta->hasValue('OrganizationURL')) { @@ -237,7 +237,7 @@ public function prp(Request $request): Response return new StreamedResponse( function () use ($idp) { ADFS_IDP::receiveLogoutMessage($idp); - } + }, ); } elseif ($wa === 'wsignin1.0') { return ADFS_IDP::receiveAuthnRequest($request, $idp); @@ -255,7 +255,7 @@ function () use ($idp) { return new StreamedResponse( function () use ($idp, /** @scrutinizer ignore-type */ $assocId, $relayState, $logoutError) { $idp->handleLogoutResponse($assocId, $relayState, $logoutError); - } + }, ); } throw new SspError\BadRequest("Missing parameter 'wa' or 'assocId' in request."); diff --git a/src/IdP/ADFS.php b/src/IdP/ADFS.php index e8c7124..aaa6b39 100644 --- a/src/IdP/ADFS.php +++ b/src/IdP/ADFS.php @@ -44,7 +44,7 @@ public static function receiveAuthnRequest(Request $request, IdP $idp): Streamed 'ForceAuthn' => false, 'isPassive' => false, 'adfs:wctx' => $requestid, - 'adfs:wreply' => false + 'adfs:wreply' => false, ]; if (isset($query['wreply']) && !empty($query['wreply'])) { @@ -55,7 +55,7 @@ public static function receiveAuthnRequest(Request $request, IdP $idp): Streamed return new StreamedResponse( function () use ($idp, &$state) { $idp->handleAuthenticationRequest($state); - } + }, ); } @@ -73,7 +73,7 @@ private static function generateResponse( string $target, string $nameid, array $attributes, - int $assertionLifetime + int $assertionLifetime, ): string { $httpUtils = new Utils\HTTP(); $randomUtils = new Utils\Random(); @@ -120,7 +120,7 @@ private static function generateResponse( list($namespace, $name) = $attrUtils->getAttributeNamespace( $name, - 'http://schemas.xmlsoap.org/claims' + 'http://schemas.xmlsoap.org/claims', ); $namespace = htmlspecialchars($namespace); $name = htmlspecialchars($name); @@ -184,7 +184,7 @@ private static function signResponse( [$firstassertionroot], XMLSecurityDSig::SHA256, ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N], - ['id_name' => 'AssertionID'] + ['id_name' => 'AssertionID'], ); $objKey = new XMLSecurityKey($algo, ['type' => 'private']); @@ -246,7 +246,7 @@ public static function getHostedMetadata(string $entityid): array [ 'Binding' => Constants::BINDING_HTTP_REDIRECT, 'Location' => $endpoint, - ] + ], ], 'SingleLogoutService' => [ 'Binding' => Constants::BINDING_HTTP_REDIRECT, @@ -289,7 +289,7 @@ public static function getHostedMetadata(string $entityid): array 'signing' => true, 'encryption' => false, 'X509Certificate' => $httpsCert['certData'], - 'prefix' => 'https.' + 'prefix' => 'https.', ]; } $metadata['keys'] = $keys; @@ -299,7 +299,7 @@ public static function getHostedMetadata(string $entityid): array $metadata['OrganizationName'] = $config->getLocalizedString('OrganizationName'); $metadata['OrganizationDisplayName'] = $config->getOptionalLocalizedString( 'OrganizationDisplayName', - $metadata['OrganizationName'] + $metadata['OrganizationName'], ); if (!$config->hasValue('OrganizationURL')) { @@ -361,7 +361,7 @@ public static function sendResponse(array $state): void $spEntityId = $spMetadata['entityid']; $spMetadata = Configuration::loadFromArray( $spMetadata, - '$metadata[' . var_export($spEntityId, true) . ']' + '$metadata[' . var_export($spEntityId, true) . ']', ); $attributes = $state['Attributes']; @@ -421,7 +421,7 @@ public static function sendLogoutResponse(IdP $idp, array $state): void $idpMetadata = $idp->getConfig(); $httpUtils = new Utils\HTTP(); $httpUtils->redirectTrustedURL( - $idpMetadata->getOptionalString('redirect-after-logout', $httpUtils->getBaseURL()) + $idpMetadata->getOptionalString('redirect-after-logout', $httpUtils->getBaseURL()), ); } @@ -464,7 +464,7 @@ public static function getLogoutURL(IdP $idp, array $association, string $relayS $metadata = MetaDataStorageHandler::getMetadataHandler(); $spMetadata = $metadata->getMetaDataConfig($association['adfs:entityID'], 'adfs-sp-remote'); $returnTo = Module::getModuleURL( - 'adfs/idp/prp.php?assocId=' . urlencode($association["id"]) . '&relayState=' . urlencode($relayState) + 'adfs/idp/prp.php?assocId=' . urlencode($association["id"]) . '&relayState=' . urlencode($relayState), ); return $spMetadata->getValue('prp') . '?wa=wsignoutcleanup1.0&wreply=' . urlencode($returnTo); } diff --git a/tests/src/Controller/AdfsControllerTest.php b/tests/src/Controller/AdfsControllerTest.php index 3fe7b05..f4e788e 100644 --- a/tests/src/Controller/AdfsControllerTest.php +++ b/tests/src/Controller/AdfsControllerTest.php @@ -44,7 +44,7 @@ protected function setup(): void ], ], '[ARRAY]', - 'simplesaml' + 'simplesaml', ); $this->session = Session::getSessionFromRequest(); @@ -66,7 +66,7 @@ public function testNoQueryParameters(): void $this->expectException(Error\BadRequest::class); $this->expectExceptionMessage( - "BADREQUEST('%REASON%' => 'Missing parameter \'wa\' or \'assocId\' in request.')" + "BADREQUEST('%REASON%' => 'Missing parameter \'wa\' or \'assocId\' in request.')", ); $c->prp($request);