diff --git a/www/saml2/idp/ArtifactResolutionService.php b/www/saml2/idp/ArtifactResolutionService.php index ac9c70b3bc07e2d038fdb640c31dea781cb4b3c4..3571b3bfb9290eaac029b6391f078b14e95cc8bc 100644 --- a/www/saml2/idp/ArtifactResolutionService.php +++ b/www/saml2/idp/ArtifactResolutionService.php @@ -11,21 +11,21 @@ require_once('../../_include.php'); $config = SimpleSAML_Configuration::getInstance(); -if (!$config->getBoolean('enable.saml20-idp', FALSE)) { - throw new SimpleSAML_Error_Error('NOACCESS'); +if (!$config->getBoolean('enable.saml20-idp', false)) { + throw new SimpleSAML_Error_Error('NOACCESS'); } $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); $idpMetadata = $metadata->getMetaDataConfig($idpEntityId, 'saml20-idp-hosted'); -if (!$idpMetadata->getBoolean('saml20.sendartifact', FALSE)) { - throw new SimpleSAML_Error_Error('NOACCESS'); +if (!$idpMetadata->getBoolean('saml20.sendartifact', false)) { + throw new SimpleSAML_Error_Error('NOACCESS'); } $store = SimpleSAML_Store::getInstance(); -if ($store === FALSE) { - throw new Exception('Unable to send artifact without a datastore configured.'); +if ($store === false) { + throw new Exception('Unable to send artifact without a datastore configured.'); } $binding = new SAML2_SOAP(); @@ -42,7 +42,7 @@ try { } } if (!($request instanceof SAML2_ArtifactResolve)) { - throw new Exception('Message received on ArtifactResolutionService wasn\'t a ArtifactResolve request.'); + throw new Exception('Message received on ArtifactResolutionService wasn\'t a ArtifactResolve request.'); } $issuer = $request->getIssuer(); @@ -53,11 +53,11 @@ $artifact = $request->getArtifact(); $responseData = $store->get('artifact', $artifact); $store->delete('artifact', $artifact); -if ($responseData !== NULL) { - $document = SAML2_DOMDocumentFactory::fromString($responseData); - $responseXML = $document->firstChild; +if ($responseData !== null) { + $document = SAML2_DOMDocumentFactory::fromString($responseData); + $responseXML = $document->firstChild; } else { - $responseXML = NULL; + $responseXML = null; } $artifactResponse = new SAML2_ArtifactResponse(); diff --git a/www/saml2/idp/SingleLogoutService.php b/www/saml2/idp/SingleLogoutService.php index 3b730b3be44168d22e7288d1e38c79af2454e239..6305c8e28d285dcda971ed4518acc47ebca4b92b 100644 --- a/www/saml2/idp/SingleLogoutService.php +++ b/www/saml2/idp/SingleLogoutService.php @@ -1,7 +1,7 @@ <?php /** - * This SAML 2.0 endpoint can receive incoming LogoutRequests. It will also send LogoutResponses, + * This SAML 2.0 endpoint can receive incoming LogoutRequests. It will also send LogoutResponses, * and LogoutRequests and also receive LogoutResponses. It is implemeting SLO at the SAML 2.0 IdP. * * @author Andreas Ă…kre Solberg, UNINETT AS. <andreas.solberg@uninett.no> @@ -14,16 +14,18 @@ SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Accessing SAML 2.0 I $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); -$idp = SimpleSAML_IdP::getById('saml2:' . $idpEntityId); +$idp = SimpleSAML_IdP::getById('saml2:'.$idpEntityId); if (isset($_REQUEST['ReturnTo'])) { - $idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string)$_REQUEST['ReturnTo'])); + $idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string) $_REQUEST['ReturnTo'])); } else { try { sspmod_saml_IdP_SAML2::receiveLogoutMessage($idp); } catch (Exception $e) { // TODO: look for a specific exception - // This is dirty. Instead of checking the message of the exception, SAML2_Binding::getCurrentBinding() should throw - // an specific exception when the binding is unknown, and we should capture that here + /* + * This is dirty. Instead of checking the message of the exception, SAML2_Binding::getCurrentBinding() should + * throw an specific exception when the binding is unknown, and we should capture that here + */ if ($e->getMessage() === 'Unable to find the current binding.') { throw new SimpleSAML_Error_Error('SLOSERVICEPARAMS', $e, 400); } else { diff --git a/www/saml2/idp/initSLO.php b/www/saml2/idp/initSLO.php index 52c73b75101f42bae6efd60f1ab83a3ffe312c39..a33182fe68f8edeef2ef1422de2a8e4e341d78e0 100644 --- a/www/saml2/idp/initSLO.php +++ b/www/saml2/idp/initSLO.php @@ -3,13 +3,13 @@ require_once('../../_include.php'); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); -$idp = SimpleSAML_IdP::getById('saml2:' . $idpEntityId); +$idp = SimpleSAML_IdP::getById('saml2:'.$idpEntityId); SimpleSAML_Logger::info('SAML2.0 - IdP.initSLO: Accessing SAML 2.0 IdP endpoint init Single Logout'); if (!isset($_GET['RelayState'])) { - throw new SimpleSAML_Error_Error('NORELAYSTATE'); + throw new SimpleSAML_Error_Error('NORELAYSTATE'); } -$idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string)$_GET['RelayState'])); -assert('FALSE'); \ No newline at end of file +$idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string) $_GET['RelayState'])); +assert('FALSE');