function getConfig($testrun) { $config = parent::getConfig($testrun); $config['signAssertion'] = TRUE; $config['signResponse'] = FALSE; return $config; }
function getConfig($testrun) { $config = parent::getConfig($testrun); switch ($testrun) { case 'multipleassertion3': case 'multipleassertion4': case 'multipleassertion3b': case 'multipleassertion4b': $config['signAssertion'] = TRUE; $config['signResponse'] = FALSE; break; } return $config; }
function getConfig($testrun) { $config = parent::getConfig($testrun); return $config; }
<?php $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::debug('IdP Endpoint accessed....'); $config = SimpleSAML_Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $samlredir = new SAML2_HTTPRedirect(); $request = $samlredir->receive(); $entityid = $request->getIssuer(); error_log('Entity ID was [' . $entityid . ']'); $idpm = new sspmod_fedlab_IdPMetadata($config); $spm = new sspmod_fedlab_SPMetadata($entityid, TRUE); #$spm->debug(); $idpentityid = SimpleSAML_Utilities::getBaseURL() . 'module.php/fedlab/metadata.php'; $idpmetadata = array('entityid' => $idpentityid, 'certificate' => 'server.crt', 'privatekey' => 'server.pem'); $test = new sspmod_fedlab_BasicSPTest($idpmetadata, $spm->parsed, $entity, $initurl, $initslo, $attributeurl); $crawler = new sspmod_fedlab_SAMLCrawler(); $requestRaw = sspmod_fedlab_SAMLCrawler::getHTTPRedirectMessage(); echo '<h2>Request</h2>' . "\n"; echo '<textarea style="width: 90%; height: 300px">'; echo htmlspecialchars(SimpleSAML_Utilities::formatXMLString($requestRaw)); echo '</textarea>'; # print_r($request); $relaystate = NULL; if (isset($_REQUEST['RelayState'])) { $relaystate = $_REQUEST['RelayState']; } # createResponse($testrun, $request, $relayState = NULL) { $samlResponse = $test->createResponseP('idp', $request, $relaystate); echo '<h2>Prepared Response</h2>' . "\n"; echo '<textarea style="width: 90%; height: 300px">';
foreach ($testconfig as $ct) { $newtester = new $ct($idpmetadata, $spm->parsed, $inputmeta['metadata'], $initsso, $initslo, $attributeurl); $testers[] = $newtester; $newflows = $newtester->getFlows(); foreach ($newflows as $nf => $name) { $flows[] = array('id' => $ct . '__' . $nf, 'name' => $name); } } } catch (Exception $e) { echo 'Error: ' . $e->getMessage() . "\n"; exit(1); } if ($action === 'check') { try { $testprogramme = new sspmod_fedlab_TestProgramme($testconfig, $idpmetadata, $spm->parsed, $spm->xmlmetadata, $initsso, $initslo, $attributeurl); $test = new sspmod_fedlab_BasicSPTest($idpmetadata, $spm->parsed, $inputmeta['metadata'], $initsso, $initslo, $attributeurl); $res = $test->simpleTest(); $result = array('status' => 0, 'id' => 'verify'); } catch (Exception $e) { $result = array('id' => 'verify', 'status' => 4, 'message' => $e->getMessage()); } echo json_encode($result, TRUE); exit(0); } else { if ($action === 'runTest') { if (empty($argv[2])) { throw new Exception('Missing parameter name of test'); } $test = $argv[2]; $splitted = explode('__', $test); $testername = $splitted[0];
$spm->debug(); $initurl = $spm->initsso; $initslo = $spm->initslo; $attributeurl = $spm->attributeurl; if (empty($initurl)) { throw new Exception('InitSSO parameter not found in metadata (EntityAttribute extension)'); } if (empty($attributeurl)) { $attributeurl = $initurl; } $idpentityid = SimpleSAML_Utilities::getBaseURL() . 'module.php/fedlab/metadata.php'; $idpmetadata = array('entityid' => $idpentityid, 'certificate' => 'server.crt', 'privatekey' => 'server.pem'); $testconfig = array('sspmod_fedlab_BasicSPTest', 'sspmod_fedlab_AuthnRequestVerify', 'sspmod_fedlab_ExtendedSPTest', 'sspmod_fedlab_tests_CheckRequestID', 'sspmod_fedlab_tests_Metadata', 'sspmod_fedlab_tests_Replay', 'sspmod_fedlab_tests_MultipleAttr', 'sspmod_fedlab_tests_TrickySignature', 'sspmod_fedlab_tests_TrickySignature2', 'sspmod_fedlab_tests_MultipleAssertions', 'sspmod_fedlab_tests_SLOTest', 'sspmod_fedlab_tests_IdPInitSLOTest', 'sspmod_fedlab_tests_IdPInitSLONoCookie', 'sspmod_fedlab_tests_SessionFixtation', 'sspmod_fedlab_tests_LogoutBeforeAssertion'); $testprogramme = new sspmod_fedlab_TestProgramme($testconfig, $idpmetadata, $spm->parsed, $spm->xmlmetadata, $initurl, $initslo, $attributeurl); $session->setData('fedlab', 'testprogramme', $testprogramme); $test = new sspmod_fedlab_BasicSPTest($idpmetadata, $spm->parsed, $entity, $initurl, $initslo, $attributeurl); error_log('before test2'); $test->simpleTest(); error_log('after test'); $result = array('status' => 'success'); } catch (Exception $e) { $err = $e->getTraceAsString(); foreach (split("\n", $err) as $el) { error_log('exception: ' . $el); } $result = array('status' => 'error', 'message' => $e->getMessage()); } /* * The first two headers prevent the browser from caching the response (a problem with IE and GET requests) * and the third sets the correct MIME type for JSON. */
protected function getDestinationResponse($testrun, $default) { if ($testrun === 'destination') { return 'http://localhost:8080/saml/bogus'; } if ($testrun === 'destination_response') { return 'http://localhost:8080/saml/bogus'; } return parent::getDestinationResponse($testrun, $default); }