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


PHP SimpleSAML_Configuration::loadFromArray方法代码示例

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


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

示例1: handleAuthError

 /**
  * Handle authentication error.
  *
  * SimpleSAML_Error_Exception $exception  The exception.
  * @param array $state  The error state.
  */
 public static function handleAuthError(SimpleSAML_Error_Exception $exception, array $state)
 {
     assert('isset($state["SPMetadata"])');
     assert('isset($state["saml:ConsumerURL"])');
     assert('array_key_exists("saml:RequestId", $state)');
     // Can be NULL.
     assert('array_key_exists("saml:RelayState", $state)');
     // Can be NULL.
     $spMetadata = $state["SPMetadata"];
     $spEntityId = $spMetadata['entityid'];
     $spMetadata = SimpleSAML_Configuration::loadFromArray($spMetadata, '$metadata[' . var_export($spEntityId, TRUE) . ']');
     $requestId = $state['saml:RequestId'];
     $relayState = $state['saml:RelayState'];
     $consumerURL = $state['saml:ConsumerURL'];
     $protocolBinding = $state['saml:Binding'];
     $idp = SimpleSAML_IdP::getByState($state);
     $idpMetadata = $idp->getConfig();
     $error = sspmod_saml_Error::fromException($exception);
     SimpleSAML_Logger::warning('Returning error to sp: ' . var_export($spEntityId, TRUE));
     $error->logWarning();
     $ar = self::buildResponse($idpMetadata, $spMetadata, $consumerURL);
     $ar->setInResponseTo($requestId);
     $ar->setRelayState($relayState);
     $ar->setStatus(array('Code' => $error->getStatus(), 'SubCode' => $error->getSubStatus(), 'Message' => $error->getStatusMessage()));
     $binding = SAML2_Binding::getBinding($protocolBinding);
     $binding->send($ar);
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:33,代码来源:SAML2.php

示例2: __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);
     $cfgHelper = SimpleSAML_Configuration::loadFromArray($config, 'Authentication source ' . var_export($this->authId, TRUE));
     $this->orgs = array();
     $this->ldapOrgs = array();
     foreach ($config as $name => $value) {
         if ($name === 'username_organization_method') {
             $usernameOrgMethod = $cfgHelper->getValueValidate('username_organization_method', array('none', 'allow', 'force'));
             $this->setUsernameOrgMethod($usernameOrgMethod);
             continue;
         }
         if ($name === 'include_organization_in_username') {
             $this->includeOrgInUsername = $cfgHelper->getBoolean('include_organization_in_username', FALSE);
             continue;
         }
         $orgCfg = $cfgHelper->getArray($name);
         $orgId = $name;
         if (array_key_exists('description', $orgCfg)) {
             $this->orgs[$orgId] = $orgCfg['description'];
         } else {
             $this->orgs[$orgId] = $orgId;
         }
         $orgCfg = new sspmod_ldap_ConfigHelper($orgCfg, 'Authentication source ' . var_export($this->authId, TRUE) . ', organization ' . var_export($orgId, TRUE));
         $this->ldapOrgs[$orgId] = $orgCfg;
     }
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:36,代码来源:LDAPMulti.php

示例3: testInitTimezone

 /**
  * Test the SimpleSAML\Utils\Time::initTimezone() method.
  *
  * @covers SimpleSAML\Utils\Time::initTimezone
  */
 public function testInitTimezone()
 {
     $tz = 'UTC';
     $os = @date_default_timezone_get();
     if ($os === 'UTC') {
         // avoid collisions
         $tz = 'Europe/Oslo';
     }
     // test guessing timezone from the OS
     \SimpleSAML_Configuration::loadFromArray(array('timezone' => null), '[ARRAY]', 'simplesaml');
     @Time::initTimezone();
     $this->assertEquals($os, @date_default_timezone_get());
     // clear initialization
     $c = new \ReflectionProperty('\\SimpleSAML\\Utils\\Time', 'tz_initialized');
     $c->setAccessible(true);
     $c->setValue(false);
     // test unknown timezone
     \SimpleSAML_Configuration::loadFromArray(array('timezone' => 'INVALID'), '[ARRAY]', 'simplesaml');
     try {
         @Time::initTimezone();
         $this->fail('Failed to recognize an invalid timezone.');
     } catch (\SimpleSAML_Error_Exception $e) {
         $this->assertEquals('Invalid timezone set in the "timezone" option in config.php.', $e->getMessage());
     }
     // test a valid timezone
     \SimpleSAML_Configuration::loadFromArray(array('timezone' => $tz), '[ARRAY]', 'simplesaml');
     @Time::initTimezone();
     $this->assertEquals($tz, @date_default_timezone_get());
     // make sure initialization happens only once
     \SimpleSAML_Configuration::loadFromArray(array('timezone' => 'Europe/Madrid'), '[ARRAY]', 'simplesaml');
     @Time::initTimezone();
     $this->assertEquals($tz, @date_default_timezone_get());
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:38,代码来源:TimeTest.php

示例4: __construct

 /**
  * Construct
  *
  * @param array $authSourceconfig Configuration array for the selected authsource
  * @param array $writeConfig Configuration array for the selected catalogue backend
  * @param array $attributes The user attributes to be saved
  */
 public function __construct($authSourceConfig, $writeConfig, $attributes, $hashAlgo)
 {
     $asc = SimpleSAML_Configuration::loadFromArray($authSourceConfig);
     try {
         $this->dbh = new PDO($asc->getString('dsn'), $asc->getString('username'), $asc->getString('password'));
     } catch (PDOException $e) {
         throw new Exception($e->getMessage());
     }
     $driver = explode(':', $asc->getString('dsn'), 2);
     $driver = strtolower($driver[0]);
     /* Driver specific initialization. */
     switch ($driver) {
         case 'mysql':
             /* Use UTF-8. */
             $this->dbh->exec("SET NAMES utf8");
             $this->dbh->exec("SET CHARACTER SET utf8;");
             break;
         case 'pgsql':
             /* Use UTF-8. */
             $this->dbh->exec("SET NAMES 'UTF8'");
             break;
     }
     $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
     $this->attributes = $attributes;
     $this->hashAlgo = $hashAlgo;
     $this->salt = bin2hex(SimpleSAML_Utilities::generateRandomBytes(64, FALSE));
     $wc = SimpleSAML_Configuration::loadFromArray($writeConfig);
     $this->userIdAttr = $wc->getString('user.id.param');
 }
开发者ID:rberrelleza,项目名称:simplesamlphp-module-selfregister,代码行数:36,代码来源:SqlMod.php

示例5: sendResponse

 /**
  * Send a response to the SP.
  *
  * @param array $state  The authentication state.
  */
 public static function sendResponse(array $state)
 {
     assert('isset($state["Attributes"])');
     assert('isset($state["SPMetadata"])');
     assert('isset($state["saml:shire"])');
     assert('array_key_exists("saml:target", $state)');
     // Can be NULL
     $spMetadata = $state["SPMetadata"];
     $spEntityId = $spMetadata['entityid'];
     $spMetadata = SimpleSAML_Configuration::loadFromArray($spMetadata, '$metadata[' . var_export($spEntityId, TRUE) . ']');
     SimpleSAML\Logger::info('Sending SAML 1.1 Response to ' . var_export($spEntityId, TRUE));
     $attributes = $state['Attributes'];
     $shire = $state['saml:shire'];
     $target = $state['saml:target'];
     $idp = SimpleSAML_IdP::getByState($state);
     $idpMetadata = $idp->getConfig();
     $config = SimpleSAML_Configuration::getInstance();
     $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
     $statsData = array('spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'protocol' => 'saml1');
     if (isset($state['saml:AuthnRequestReceivedAt'])) {
         $statsData['logintime'] = microtime(TRUE) - $state['saml:AuthnRequestReceivedAt'];
     }
     SimpleSAML_Stats::log('saml:idp:Response', $statsData);
     // Generate and send response.
     $ar = new SimpleSAML_XML_Shib13_AuthnResponse();
     $authnResponseXML = $ar->generate($idpMetadata, $spMetadata, $shire, $attributes);
     $httppost = new SimpleSAML_Bindings_Shib13_HTTPPost($config, $metadata);
     $httppost->sendResponse($authnResponseXML, $idpMetadata, $spMetadata, $target, $shire);
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:34,代码来源:SAML1.php

示例6: __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

示例7: createLogoutResponse

 protected function createLogoutResponse($testrun, $logoutRequest, $logoutRelayState)
 {
     $this->log($testrun, 'Creating response with relaystate [' . $logoutRelayState . ']');
     $idpMetadata = SimpleSAML_Configuration::loadFromArray($this->idpmetadata);
     $spMetadata = SimpleSAML_Configuration::loadFromArray($this->metadata);
     // Get SingleLogoutService URL
     $consumerURLf = $spMetadata->getDefaultEndpoint('SingleLogoutService', array('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'));
     $consumerURL = $consumerURLf['Location'];
     /* Create an send response. */
     $response = sspmod_saml2_Message::buildLogoutResponse($idpMetadata, $spMetadata);
     $response->setRelayState($logoutRequest->getRelayState());
     $response->setInResponseTo($logoutRequest->getId());
     $keyArray = SimpleSAML_Utilities::loadPrivateKey($idpMetadata, TRUE);
     $certArray = SimpleSAML_Utilities::loadPublicKey($idpMetadata, FALSE);
     $privateKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     $privateKey->loadKey($keyArray['PEM'], FALSE);
     $response->setSignatureKey($privateKey);
     if ($certArray === NULL) {
         throw new Exception('No certificates found. [1]');
     }
     if (!array_key_exists('PEM', $certArray)) {
         throw new Exception('No certificates found. [2]');
     }
     $response->setCertificates(array($certArray['PEM']));
     #$this->tweakResponse($testrun, $response);
     $msgStr = $response->toUnsignedXML();
     #$this->tweakResponseDOM($testrun, $msgStr);
     $msgStr = $msgStr->ownerDocument->saveXML($msgStr);
     #	echo '<pre>'; echo(htmlspecialchars($msgStr)); exit;
     #		$msgStr = base64_encode($msgStr);
     #		$msgStr = htmlspecialchars($msgStr);
     return array('url' => $consumerURL, 'Response' => $msgStr, 'ResponseObj' => $response, 'RelayState' => $logoutRelayState);
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:33,代码来源:SLOTest.php

示例8: __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->usernameAttribute = $config->getString('username_attribute', NULL);
     $this->nasIdentifier = $config->getString('nas_identifier', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost');
     $this->vendor = $config->getInteger('attribute_vendor', NULL);
     if ($this->vendor !== NULL) {
         $this->vendorType = $config->getInteger('attribute_vendor_type');
     }
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:31,代码来源:Radius.php

示例9: __construct

 /**
  * Constructor for this authentication source.
  *
  * @param array $info Information about this authentication source.
  * @param array $config The configuration of the module
  *
  * @throws Exception If the KRB5 extension is not installed or active.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     if (!extension_loaded('krb5')) {
         throw new Exception('KRB5 Extension not installed');
     }
     // call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     $config = SimpleSAML_Configuration::loadFromArray($config);
     $this->backend = $config->getString('fallback');
     $this->hostname = $config->getString('hostname');
     $this->port = $config->getInteger('port', 389);
     $this->referrals = $config->getBoolean('referrals', true);
     $this->enableTLS = $config->getBoolean('enable_tls', false);
     $this->debugLDAP = $config->getBoolean('debugLDAP', false);
     $this->timeout = $config->getInteger('timeout', 30);
     $this->keytab = $config->getString('keytab');
     $this->base = $config->getArrayizeString('base');
     $this->attr = $config->getString('attr', 'uid');
     $this->subnet = $config->getArray('subnet', null);
     $this->admin_user = $config->getString('adminUser', null);
     $this->admin_pw = $config->getString('adminPassword', null);
     $this->attributes = $config->getArray('attributes', null);
 }
开发者ID:Chialab,项目名称:simplesamlphp,代码行数:33,代码来源:Negotiate.php

示例10: __construct

 /**
  * Initialize this filter, parse configuration
  *
  * @param array $config  Configuration information about this filter.
  * @param mixed $reserved  For future use.
  */
 public function __construct($config, $reserved)
 {
     parent::__construct($config, $reserved);
     assert('is_array($config)');
     $config = SimpleSAML_Configuration::loadFromArray($config, 'ScopeFromAttribute');
     $this->targetAttribute = $config->getString('targetAttribute');
     $this->sourceAttribute = $config->getString('sourceAttribute');
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:14,代码来源:ScopeFromAttribute.php

示例11: __construct

 /**
  * CriticalConfigurationError constructor.
  *
  * @param string|null $reason The reason for this critical error.
  * @param string|null $file The configuration file that originated this error.
  * @param array|null The configuration array that led to this problem.
  */
 public function __construct($reason = null, $file = null, $config = null)
 {
     if ($config === null) {
         $config = self::$minimum_config;
         $config['baseurlpath'] = \SimpleSAML\Utils\HTTP::guessBasePath();
     }
     \SimpleSAML_Configuration::loadFromArray($config, '', 'simplesaml');
     parent::__construct($reason, $file);
 }
开发者ID:simplesamlphp,项目名称:simplesamlphp,代码行数:16,代码来源:CriticalConfigurationError.php

示例12: __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);
     $cfgParse = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']');
     $this->api_key = $cfgParse->getString('api_key');
     $this->secret = $cfgParse->getString('secret');
     $this->req_perms = $cfgParse->getString('req_perms', NULL);
 }
开发者ID:emma5021,项目名称:toba,代码行数:17,代码来源:Facebook.php

示例13: __construct

 /**
  * Constructor for this metadata handler.
  *
  * Parses configuration.
  *
  * @param array $config  The configuration for this metadata handler.
  */
 public function __construct($config)
 {
     assert('is_array($config)');
     $globalConfig = SimpleSAML_Configuration::getInstance();
     $cfgHelp = SimpleSAML_Configuration::loadFromArray($config, 'serialize metadata source');
     $this->directory = $cfgHelp->getString('directory');
     /* Resolve this directory relative to the simpleSAMLphp directory (unless it is
      * an absolute path).
      */
     $this->directory = $globalConfig->resolvePath($this->directory);
 }
开发者ID:jstormes,项目名称:simplesamlphp,代码行数:18,代码来源:MetaDataStorageHandlerSerialize.php

示例14: __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);
     $configObject = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']');
     $this->key = $configObject->getString('key');
     $this->secret = $configObject->getString('secret');
     $this->force_login = $configObject->getBoolean('force_login', FALSE);
 }
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:17,代码来源:Twitter.php

示例15: addSigns

 /**
  * @param SAML2_Response $response
  * @param SimpleSAML_Configuration $idpConfig
  */
 private function addSigns(SAML2_Response $response, SimpleSAML_Configuration $idpConfig)
 {
     $assertions = $response->getAssertions();
     $className = EngineBlock_ApplicationSingleton::getInstance()->getDiContainer()->getMessageUtilClassName();
     // Special case the 'normal' message verification class name so we have IDE support.
     if ($className === 'sspmod_saml_Message') {
         sspmod_saml_Message::addSign($idpConfig, SimpleSAML_Configuration::loadFromArray(array()), $assertions[0]);
         return;
     }
     $className::addSign($idpConfig, SimpleSAML_Configuration::loadFromArray(array()), $assertions[0]);
 }
开发者ID:WebSpider,项目名称:OpenConext-engineblock,代码行数:15,代码来源:ResponseFactory.php


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