getDefaultEndpoint() public static method

Deprecation: This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\Config\Metadata::getDefaultEndpoint() instead.
public static getDefaultEndpoint ( array $endpoints, array $bindings = null )
$endpoints array
$bindings array
Exemplo n.º 1
0
#$statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php');
$session = SimpleSAML_Session::getInstance();
#$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
SimpleSAML_Logger::debug('ajax-verify.php called');
$result = array();
try {
    $xmldata = $_REQUEST['xmlmetadata'];
    $initurl = $_REQUEST['initurl'];
    $initslo = $_REQUEST['initslo'];
    SimpleSAML_Utilities::validateXMLDocument($xmldata, 'saml-meta');
    $entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsString($xmldata);
    $entity = array_pop($entities);
    $metadata = $entity->getMetadata20SP();
    /* Trim metadata endpoint arrays. */
    $metadata['AssertionConsumerService'] = array(SimpleSAML_Utilities::getDefaultEndpoint($metadata['AssertionConsumerService'], array(SAML2_Const::BINDING_HTTP_POST)));
    $metadata['SingleLogoutService'] = array(SimpleSAML_Utilities::getDefaultEndpoint($metadata['SingleLogoutService'], array(SAML2_Const::BINDING_HTTP_REDIRECT)));
    $idpentityid = SimpleSAML_Utilities::getBaseURL() . 'module.php/fedlab';
    $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');
    $testprogramme = new sspmod_fedlab_TestProgramme($testconfig, $idpmetadata, $metadata, $xmldata, $initurl, $initslo);
    $session->setData('fedlab', 'testprogramme', $testprogramme);
    $test = new sspmod_fedlab_BasicSPTest($idpmetadata, $metadata, $entity, $initurl, $initslo);
    error_log('before test3');
    $test->simpleTest();
    error_log('after test');
    $result = array('status' => 'success');
} catch (Exception $e) {
    error_log('exception');
    $result = array('status' => 'error', 'message' => $e->getMessage());
}
/* 
 /**
  * Find the default endpoint of the given type.
  *
  * @param string $endpointType  The endpoint type.
  * @param array $bindings  Array with acceptable bindings. Can be NULL if any binding is allowed.
  * @param mixed $default  The default value to return if no matching endpoint is found. If no default is provided, an exception will be thrown.
  * @return  array|NULL  The default endpoint, or NULL if no acceptable endpoints are used.
  */
 public function getDefaultEndpoint($endpointType, array $bindings = NULL, $default = self::REQUIRED_OPTION)
 {
     assert('is_string($endpointType)');
     $endpoints = $this->getEndpoints($endpointType);
     $defaultEndpoint = SimpleSAML_Utilities::getDefaultEndpoint($endpoints, $bindings);
     if ($defaultEndpoint !== NULL) {
         return $defaultEndpoint;
     }
     if ($default === self::REQUIRED_OPTION) {
         $loc = $this->location . '[' . var_export($endpointType, TRUE) . ']:';
         throw new Exception($loc . 'Could not find a supported ' . $endpointType . ' endpoint.');
     }
     return $default;
 }
Exemplo n.º 3
0
 public function getACS()
 {
     return SimpleSAML_Utilities::getDefaultEndpoint($this->parsed['AssertionConsumerService'], array(SAML2_Const::BINDING_HTTP_POST));
 }