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


PHP SAML2_Utils::extractStrings方法代码示例

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


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

示例1: __construct

 /**
  * Initialize a AffiliationDescriptor.
  *
  * @param DOMElement|NULL $xml  The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     parent::__construct($xml);
     if ($xml === NULL) {
         return;
     }
     if (!$xml->hasAttribute('affiliationOwnerID')) {
         throw new Exception('Missing affiliationOwnerID on AffiliationDescriptor.');
     }
     $this->affiliationOwnerID = $xml->getAttribute('affiliationOwnerID');
     if ($xml->hasAttribute('ID')) {
         $this->ID = $xml->getAttribute('ID');
     }
     if ($xml->hasAttribute('validUntil')) {
         $this->validUntil = SimpleSAML_Utilities::parseSAML2Time($xml->getAttribute('validUntil'));
     }
     if ($xml->hasAttribute('cacheDuration')) {
         $this->cacheDuration = $xml->getAttribute('cacheDuration');
     }
     $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
     $this->AffiliateMember = SAML2_Utils::extractStrings($xml, './saml_metadata:AffiliateMember');
     if (empty($this->AffiliateMember)) {
         throw new Exception('Missing AffiliateMember in AffiliationDescriptor.');
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:KeyDescriptor') as $kd) {
         $this->KeyDescriptor[] = new SAML2_XML_md_KeyDescriptor($kd);
     }
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:33,代码来源:AffiliationDescriptor.php

示例2: testExtractString

 /**
  * Test retrieval of a string value for a given node.
  */
 public function testExtractString()
 {
     $document = SAML2_DOMDocumentFactory::fromString('<root xmlns="' . SAML2_Const::NS_MD . '">' . '<somenode>value1</somenode>' . '<somenode>value2</somenode>' . '</root>');
     $stringValues = SAML2_Utils::extractStrings($document->firstChild, SAML2_Const::NS_MD, 'somenode');
     $this->assertTrue(count($stringValues) === 2);
     $this->assertEquals('value1', $stringValues[0]);
     $this->assertEquals('value2', $stringValues[1]);
 }
开发者ID:Shalmezad,项目名称:saml2,代码行数:11,代码来源:UtilsTest.php

示例3: __construct

 /**
  * Create a DiscoHints element.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     if ($xml === NULL) {
         return;
     }
     $this->IPHint = SAML2_Utils::extractStrings($xml, self::NS, 'IPHint');
     $this->DomainHint = SAML2_Utils::extractStrings($xml, self::NS, 'DomainHint');
     $this->GeolocationHint = SAML2_Utils::extractStrings($xml, self::NS, 'GeolocationHint');
     foreach (SAML2_Utils::xpQuery($xml, "./*[namespace-uri()!='" . self::NS . "']") as $node) {
         $this->children[] = new SAML2_XML_Chunk($node);
     }
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:17,代码来源:DiscoHints.php

示例4: __construct

 /**
  * Initialize an IDPSSODescriptor.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  * @throws Exception
  */
 public function __construct(DOMElement $xml = NULL)
 {
     parent::__construct('md:PDPDescriptor', $xml);
     if ($xml === NULL) {
         return;
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AuthzService') as $ep) {
         $this->AuthzService[] = new SAML2_XML_md_EndpointType($ep);
     }
     if (empty($this->AuthzService)) {
         throw new Exception('Must have at least one AuthzService in PDPDescriptor.');
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
         $this->AssertionIDRequestService[] = new SAML2_XML_md_EndpointType($ep);
     }
     $this->NameIDFormat = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'NameIDFormat');
 }
开发者ID:Shalmezad,项目名称:saml2,代码行数:23,代码来源:PDPDescriptor.php

示例5: __construct

 /**
  * Initialize a SSODescriptor.
  *
  * @param string          $elementName The name of this element.
  * @param DOMElement|NULL $xml         The XML element we should load.
  */
 protected function __construct($elementName, DOMElement $xml = NULL)
 {
     assert('is_string($elementName)');
     parent::__construct($elementName, $xml);
     if ($xml === NULL) {
         return;
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ArtifactResolutionService') as $ep) {
         $this->ArtifactResolutionService[] = new SAML2_XML_md_IndexedEndpointType($ep);
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:SingleLogoutService') as $ep) {
         $this->SingleLogoutService[] = new SAML2_XML_md_EndpointType($ep);
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ManageNameIDService') as $ep) {
         $this->ManageNameIDService[] = new SAML2_XML_md_EndpointType($ep);
     }
     $this->NameIDFormat = SAML2_Utils::extractStrings($xml, SAML2_Const::NS_MD, 'NameIDFormat');
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:24,代码来源:SSODescriptorType.php

示例6: __construct

 /**
  * Initialize an IDPSSODescriptor.
  *
  * @param DOMElement|NULL $xml  The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     parent::__construct('md:AttributeAuthorityDescriptor', $xml);
     if ($xml === NULL) {
         return;
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AttributeService') as $ep) {
         $this->AttributeService[] = new SAML2_XML_md_EndpointType($ep);
     }
     if (empty($this->AttributeService)) {
         throw new Exception('Must have at least one AttributeService in AttributeAuthorityDescriptor.');
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
         $this->AssertionIDRequestService[] = new SAML2_XML_md_EndpointType($airs);
     }
     $this->NameIDFormat = SAML2_Utils::extractStrings($xml, './saml_metadata:NameIDFormat');
     $this->AttributeProfile = SAML2_Utils::extractStrings($xml, './saml_metadata:AttributeProfile');
     foreach (SAML2_Utils::xpQuery($xml, './saml_assertion:Attribute') as $a) {
         $this->Attribute[] = new SAML2_XML_saml_Attribute($a);
     }
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:26,代码来源:AttributeAuthorityDescriptor.php

示例7: __construct

 /**
  * Initialize an IDPSSODescriptor.
  *
  * @param DOMElement|NULL $xml  The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     parent::__construct('md:IDPSSODescriptor', $xml);
     if ($xml === NULL) {
         return;
     }
     $this->WantAuthnRequestsSigned = SAML2_Utils::parseBoolean($xml, 'WantAuthnRequestsSigned', NULL);
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:SingleSignOnService') as $ep) {
         $this->SingleSignOnService[] = new SAML2_XML_md_EndpointType($ep);
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:NameIDMappingService') as $ep) {
         $this->NameIDMappingService[] = new SAML2_XML_md_EndpointType($ep);
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AssertionIDRequestService') as $ep) {
         $this->AssertionIDRequestService[] = new SAML2_XML_md_EndpointType($airs);
     }
     $this->AttributeProfile = SAML2_Utils::extractStrings($xml, './saml_metadata:AttributeProfile');
     foreach (SAML2_Utils::xpQuery($xml, './saml_assertion:Attribute') as $a) {
         $this->Attribute[] = new SAML2_XML_saml_Attribute($a);
     }
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:26,代码来源:IDPSSODescriptor.php

示例8: parseAuthnStatement

 /**
  * Parse AuthnStatement in assertion.
  *
  * @param DOMElement $xml  The assertion XML element.
  */
 private function parseAuthnStatement(DOMElement $xml)
 {
     $as = SAML2_Utils::xpQuery($xml, './saml_assertion:AuthnStatement');
     if (empty($as)) {
         $this->authnInstant = NULL;
         return;
     } elseif (count($as) > 1) {
         throw new Exception('More that one <saml:AuthnStatement> in <saml:Assertion> not supported.');
     }
     $as = $as[0];
     $this->authnStatement = array();
     if (!$as->hasAttribute('AuthnInstant')) {
         throw new Exception('Missing required AuthnInstant attribute on <saml:AuthnStatement>.');
     }
     $this->authnInstant = SimpleSAML_Utilities::parseSAML2Time($as->getAttribute('AuthnInstant'));
     if ($as->hasAttribute('SessionNotOnOrAfter')) {
         $this->sessionNotOnOrAfter = SimpleSAML_Utilities::parseSAML2Time($as->getAttribute('SessionNotOnOrAfter'));
     }
     if ($as->hasAttribute('SessionIndex')) {
         $this->sessionIndex = $as->getAttribute('SessionIndex');
     }
     $ac = SAML2_Utils::xpQuery($as, './saml_assertion:AuthnContext');
     if (empty($ac)) {
         throw new Exception('Missing required <saml:AuthnContext> in <saml:AuthnStatement>.');
     } elseif (count($ac) > 1) {
         throw new Exception('More than one <saml:AuthnContext> in <saml:AuthnStatement>.');
     }
     $ac = $ac[0];
     $accr = SAML2_Utils::xpQuery($ac, './saml_assertion:AuthnContextClassRef');
     if (empty($accr)) {
         $acdr = SAML2_Utils::xpQuery($ac, './saml_assertion:AuthnContextDeclRef');
         if (empty($acdr)) {
             throw new Exception('Neither <saml:AuthnContextClassRef> nor <saml:AuthnContextDeclRef> found in <saml:AuthnContext>.');
         } elseif (count($accr) > 1) {
             throw new Exception('More than one <saml:AuthnContextDeclRef> in <saml:AuthnContext>.');
         }
         $this->authnContext = trim($acdr[0]->textContent);
     } elseif (count($accr) > 1) {
         throw new Exception('More than one <saml:AuthnContextClassRef> in <saml:AuthnContext>.');
     } else {
         $this->authnContext = trim($accr[0]->textContent);
     }
     $this->AuthenticatingAuthority = SAML2_Utils::extractStrings($ac, SAML2_Const::NS_SAML, 'AuthenticatingAuthority');
 }
开发者ID:emma5021,项目名称:toba,代码行数:49,代码来源:Assertion.php

示例9: parseAuthnContext

 /**
  * Parse AuthnContext in AuthnStatement.
  *
  * @param DOMElement $authnStatementEl
  * @throws Exception
  */
 private function parseAuthnContext(DOMElement $authnStatementEl)
 {
     // Get the AuthnContext element
     $authnContexts = SAML2_Utils::xpQuery($authnStatementEl, './saml_assertion:AuthnContext');
     if (count($authnContexts) > 1) {
         throw new Exception('More than one <saml:AuthnContext> in <saml:AuthnStatement>.');
     } elseif (empty($authnContexts)) {
         throw new Exception('Missing required <saml:AuthnContext> in <saml:AuthnStatement>.');
     }
     $authnContextEl = $authnContexts[0];
     // Get the AuthnContextDeclRef (if available)
     $authnContextDeclRefs = SAML2_Utils::xpQuery($authnContextEl, './saml_assertion:AuthnContextDeclRef');
     if (count($authnContextDeclRefs) > 1) {
         throw new Exception('More than one <saml:AuthnContextDeclRef> found?');
     } elseif (count($authnContextDeclRefs) === 1) {
         $this->setAuthnContextDeclRef(trim($authnContextDeclRefs[0]->textContent));
     }
     // Get the AuthnContextDecl (if available)
     $authnContextDecls = SAML2_Utils::xpQuery($authnContextEl, './saml_assertion:AuthnContextDecl');
     if (count($authnContextDecls) > 1) {
         throw new Exception('More than one <saml:AuthnContextDecl> found?');
     } elseif (count($authnContextDecls) === 1) {
         $this->setAuthnContextDecl(new SAML2_XML_Chunk($authnContextDecls[0]));
     }
     // Get the AuthnContextClassRef (if available)
     $authnContextClassRefs = SAML2_Utils::xpQuery($authnContextEl, './saml_assertion:AuthnContextClassRef');
     if (count($authnContextClassRefs) > 1) {
         throw new Exception('More than one <saml:AuthnContextClassRef> in <saml:AuthnContext>.');
     } elseif (count($authnContextClassRefs) === 1) {
         $this->setAuthnContextClassRef(trim($authnContextClassRefs[0]->textContent));
     }
     // Constraint from XSD: MUST have one of the three
     if (empty($this->authnContextClassRef) && empty($this->authnContextDecl) && empty($this->authnContextDeclRef)) {
         throw new Exception('Missing either <saml:AuthnContextClassRef> or <saml:AuthnContextDeclRef> or <saml:AuthnContextDecl>');
     }
     $this->AuthenticatingAuthority = SAML2_Utils::extractStrings($authnContextEl, SAML2_Const::NS_SAML, 'AuthenticatingAuthority');
 }
开发者ID:reinier-vegter,项目名称:saml2,代码行数:43,代码来源:Assertion.php


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