Skip to content
Snippets Groups Projects
Commit e8742a2b authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Reformat the files remaining in www/saml2/idp/.

parent 68e27e18
No related branches found
No related tags found
No related merge requests found
...@@ -11,21 +11,21 @@ ...@@ -11,21 +11,21 @@
require_once('../../_include.php'); require_once('../../_include.php');
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
if (!$config->getBoolean('enable.saml20-idp', FALSE)) { if (!$config->getBoolean('enable.saml20-idp', false)) {
throw new SimpleSAML_Error_Error('NOACCESS'); throw new SimpleSAML_Error_Error('NOACCESS');
} }
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
$idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
$idpMetadata = $metadata->getMetaDataConfig($idpEntityId, 'saml20-idp-hosted'); $idpMetadata = $metadata->getMetaDataConfig($idpEntityId, 'saml20-idp-hosted');
if (!$idpMetadata->getBoolean('saml20.sendartifact', FALSE)) { if (!$idpMetadata->getBoolean('saml20.sendartifact', false)) {
throw new SimpleSAML_Error_Error('NOACCESS'); throw new SimpleSAML_Error_Error('NOACCESS');
} }
$store = SimpleSAML_Store::getInstance(); $store = SimpleSAML_Store::getInstance();
if ($store === FALSE) { if ($store === false) {
throw new Exception('Unable to send artifact without a datastore configured.'); throw new Exception('Unable to send artifact without a datastore configured.');
} }
$binding = new SAML2_SOAP(); $binding = new SAML2_SOAP();
...@@ -42,7 +42,7 @@ try { ...@@ -42,7 +42,7 @@ try {
} }
} }
if (!($request instanceof SAML2_ArtifactResolve)) { 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(); $issuer = $request->getIssuer();
...@@ -53,11 +53,11 @@ $artifact = $request->getArtifact(); ...@@ -53,11 +53,11 @@ $artifact = $request->getArtifact();
$responseData = $store->get('artifact', $artifact); $responseData = $store->get('artifact', $artifact);
$store->delete('artifact', $artifact); $store->delete('artifact', $artifact);
if ($responseData !== NULL) { if ($responseData !== null) {
$document = SAML2_DOMDocumentFactory::fromString($responseData); $document = SAML2_DOMDocumentFactory::fromString($responseData);
$responseXML = $document->firstChild; $responseXML = $document->firstChild;
} else { } else {
$responseXML = NULL; $responseXML = null;
} }
$artifactResponse = new SAML2_ArtifactResponse(); $artifactResponse = new SAML2_ArtifactResponse();
......
<?php <?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. * 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> * @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 ...@@ -14,16 +14,18 @@ SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Accessing SAML 2.0 I
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
$idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); $idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
$idp = SimpleSAML_IdP::getById('saml2:' . $idpEntityId); $idp = SimpleSAML_IdP::getById('saml2:'.$idpEntityId);
if (isset($_REQUEST['ReturnTo'])) { if (isset($_REQUEST['ReturnTo'])) {
$idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string)$_REQUEST['ReturnTo'])); $idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string) $_REQUEST['ReturnTo']));
} else { } else {
try { try {
sspmod_saml_IdP_SAML2::receiveLogoutMessage($idp); sspmod_saml_IdP_SAML2::receiveLogoutMessage($idp);
} catch (Exception $e) { // TODO: look for a specific exception } 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.') { if ($e->getMessage() === 'Unable to find the current binding.') {
throw new SimpleSAML_Error_Error('SLOSERVICEPARAMS', $e, 400); throw new SimpleSAML_Error_Error('SLOSERVICEPARAMS', $e, 400);
} else { } else {
......
...@@ -3,13 +3,13 @@ require_once('../../_include.php'); ...@@ -3,13 +3,13 @@ require_once('../../_include.php');
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
$idpEntityId = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); $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'); SimpleSAML_Logger::info('SAML2.0 - IdP.initSLO: Accessing SAML 2.0 IdP endpoint init Single Logout');
if (!isset($_GET['RelayState'])) { 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'])); $idp->doLogoutRedirect(\SimpleSAML\Utils\HTTP::checkURLAllowed((string) $_GET['RelayState']));
assert('FALSE'); assert('FALSE');
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment