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 @@
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();
......
<?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 {
......
......@@ -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');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment