当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP::getSelfHost方法代码示例

本文整理汇总了PHP中SimpleSAML\Utils\HTTP::getSelfHost方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::getSelfHost方法的具体用法?PHP HTTP::getSelfHost怎么用?PHP HTTP::getSelfHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleSAML\Utils\HTTP的用法示例。


在下文中一共展示了HTTP::getSelfHost方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     // Call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     // Parse configuration.
     $config = SimpleSAML_Configuration::loadFromArray($config, 'Authentication source ' . var_export($this->authId, true));
     $this->servers = $config->getArray('servers', array());
     /* For backwards compatibility. */
     if (empty($this->servers)) {
         $this->hostname = $config->getString('hostname');
         $this->port = $config->getIntegerRange('port', 1, 65535, 1812);
         $this->secret = $config->getString('secret');
         $this->servers[] = array('hostname' => $this->hostname, 'port' => $this->port, 'secret' => $this->secret);
     }
     $this->timeout = $config->getInteger('timeout', 5);
     $this->retries = $config->getInteger('retries', 3);
     $this->realm = $config->getString('realm', null);
     $this->usernameAttribute = $config->getString('username_attribute', null);
     $this->nasIdentifier = $config->getString('nas_identifier', \SimpleSAML\Utils\HTTP::getSelfHost());
     $this->vendor = $config->getInteger('attribute_vendor', null);
     if ($this->vendor !== null) {
         $this->vendorType = $config->getInteger('attribute_vendor_type');
     }
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:32,代码来源:Radius.php

示例2: testGetSelfHost

 /**
  * Test SimpleSAML\Utils\HTTP::getSelfHost() with and without custom port.
  */
 public function testGetSelfHost()
 {
     \SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => ''), '[ARRAY]', 'simplesaml');
     $_SERVER['SERVER_PORT'] = '80';
     $this->assertEquals('localhost', HTTP::getSelfHost());
     $_SERVER['SERVER_PORT'] = '3030';
     $this->assertEquals('localhost', HTTP::getSelfHost());
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:11,代码来源:HTTPTest.php

示例3: getMetaDataCurrentEntityID

 /**
  * This function locates the current entity id based on the hostname/path combination the user accessed.
  * It will throw an exception if it is unable to locate the entity id.
  *
  * @param string $set The set we look for the entity id in.
  * @param string $type Do you want to return the metaindex or the entityID. [entityid|metaindex]
  *
  * @return string The entity id which is associated with the current hostname/path combination.
  * @throws Exception If no default metadata can be found in the set for the current host.
  */
 public function getMetaDataCurrentEntityID($set, $type = 'entityid')
 {
     assert('is_string($set)');
     // first we look for the hostname/path combination
     $currenthostwithpath = \SimpleSAML\Utils\HTTP::getSelfHostWithPath();
     // sp.example.org/university
     foreach ($this->sources as $source) {
         $index = $source->getEntityIdFromHostPath($currenthostwithpath, $set, $type);
         if ($index !== null) {
             return $index;
         }
     }
     // then we look for the hostname
     $currenthost = \SimpleSAML\Utils\HTTP::getSelfHost();
     // sp.example.org
     if (strpos($currenthost, ":") !== false) {
         $currenthostdecomposed = explode(":", $currenthost);
         $currenthost = $currenthostdecomposed[0];
     }
     foreach ($this->sources as $source) {
         $index = $source->getEntityIdFromHostPath($currenthost, $set, $type);
         if ($index !== null) {
             return $index;
         }
     }
     // then we look for the DEFAULT entry
     foreach ($this->sources as $source) {
         $entityId = $source->getEntityIdFromHostPath('__DEFAULT__', $set, $type);
         if ($entityId !== null) {
             return $entityId;
         }
     }
     // we were unable to find the hostname/path in any metadata source
     throw new Exception('Could not find any default metadata entities in set [' . $set . '] for host [' . $currenthost . ' : ' . $currenthostwithpath . ']');
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:45,代码来源:MetaDataStorageHandler.php

示例4: getSelfHost

 /**
  * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfHost() instead.
  */
 public static function getSelfHost()
 {
     return \SimpleSAML\Utils\HTTP::getSelfHost();
 }
开发者ID:jstormes,项目名称:simplesamlphp,代码行数:7,代码来源:Utilities.php

示例5: array

<?php

require_once '../_include.php';
/* Load simpleSAMLphp, configuration */
$config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getSessionFromRequest();
/* Check if valid local session exists.. */
SimpleSAML\Utils\Auth::requireAdmin();
$attributes = array();
$attributes['HTTP_HOST'] = array($_SERVER['HTTP_HOST']);
$attributes['HTTPS'] = isset($_SERVER['HTTPS']) ? array($_SERVER['HTTPS']) : array();
$attributes['SERVER_PROTOCOL'] = array($_SERVER['SERVER_PROTOCOL']);
$attributes['SERVER_PORT'] = array($_SERVER['SERVER_PORT']);
$attributes['Utilities_getBaseURL()'] = array(\SimpleSAML\Utils\HTTP::getBaseURL());
$attributes['Utilities_getSelfHost()'] = array(\SimpleSAML\Utils\HTTP::getSelfHost());
$attributes['Utilities_selfURLhost()'] = array(\SimpleSAML\Utils\HTTP::getSelfURLHost());
$attributes['Utilities_selfURLNoQuery()'] = array(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery());
$attributes['Utilities_getSelfHostWithPath()'] = array(\SimpleSAML\Utils\HTTP::getSelfHostWithPath());
$attributes['Utilities_getFirstPathElement()'] = array(\SimpleSAML\Utils\HTTP::getFirstPathElement());
$attributes['Utilities_selfURL()'] = array(\SimpleSAML\Utils\HTTP::getSelfURL());
$template = new SimpleSAML_XHTML_Template($config, 'hostnames.php');
$template->data['remaining'] = $session->getAuthData('admin', 'Expire') - time();
$template->data['attributes'] = $attributes;
$template->data['valid'] = 'na';
$template->data['logout'] = null;
$template->show();
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:26,代码来源:hostnames.php

示例6: generateDynamicHostedEntityID

 private function generateDynamicHostedEntityID($set)
 {
     assert('is_string($set)');
     // get the configuration
     $baseurl = \SimpleSAML\Utils\HTTP::getBaseURL();
     if ($set === 'saml20-idp-hosted') {
         return $baseurl . 'saml2/idp/metadata.php';
     } elseif ($set === 'saml20-sp-hosted') {
         return $baseurl . 'saml2/sp/metadata.php';
     } elseif ($set === 'shib13-idp-hosted') {
         return $baseurl . 'shib13/idp/metadata.php';
     } elseif ($set === 'shib13-sp-hosted') {
         return $baseurl . 'shib13/sp/metadata.php';
     } elseif ($set === 'wsfed-sp-hosted') {
         return 'urn:federation:' . \SimpleSAML\Utils\HTTP::getSelfHost();
     } elseif ($set === 'adfs-idp-hosted') {
         return 'urn:federation:' . \SimpleSAML\Utils\HTTP::getSelfHost() . ':idp';
     } else {
         throw new Exception('Can not generate dynamic EntityID for metadata of this type: [' . $set . ']');
     }
 }
开发者ID:mrvanes,项目名称:simplesamlphp,代码行数:21,代码来源:MetaDataStorageHandlerPdo.php

示例7: lookupIndexFromEntityId

 private function lookupIndexFromEntityId($entityId, $set)
 {
     assert('is_string($entityId)');
     assert('isset($set)');
     $metadataSet = $this->getMetadataSet($set);
     // check for hostname
     $currenthost = \SimpleSAML\Utils\HTTP::getSelfHost();
     // sp.example.org
     if (strpos($currenthost, ":") !== false) {
         $currenthostdecomposed = explode(":", $currenthost);
         $currenthost = $currenthostdecomposed[0];
     }
     foreach ($metadataSet as $index => $entry) {
         if ($index === $entityId) {
             return $index;
         }
         if ($entry['entityid'] === $entityId) {
             if ($entry['host'] === '__DEFAULT__' || $entry['host'] === $currenthost) {
                 return $index;
             }
         }
     }
     return null;
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:24,代码来源:MetaDataStorageSource.php


注:本文中的SimpleSAML\Utils\HTTP::getSelfHost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。