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


PHP SAML2_Utils::xsDateTimeToTimestamp方法代码示例

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


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

示例1: __construct

 /**
  * Initialize an EntitiesDescriptor.
  *
  * @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('ID')) {
         $this->ID = $xml->getAttribute('ID');
     }
     if ($xml->hasAttribute('validUntil')) {
         $this->validUntil = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('validUntil'));
     }
     if ($xml->hasAttribute('cacheDuration')) {
         $this->cacheDuration = $xml->getAttribute('cacheDuration');
     }
     if ($xml->hasAttribute('Name')) {
         $this->Name = $xml->getAttribute('Name');
     }
     $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:EntityDescriptor|./saml_metadata:EntitiesDescriptor') as $node) {
         if ($node->localName === 'EntityDescriptor') {
             $this->children[] = new SAML2_XML_md_EntityDescriptor($node);
         } else {
             $this->children[] = new SAML2_XML_md_EntitiesDescriptor($node);
         }
     }
 }
开发者ID:shirlei,项目名称:simplesaml,代码行数:32,代码来源:EntitiesDescriptor.php

示例2: __construct

 /**
  * Initialize a AffiliationDescriptor.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  * @throws Exception
  */
 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 = SAML2_Utils::xsDateTimeToTimestamp($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, SAML2_Const::NS_MD, '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:Shalmezad,项目名称:saml2,代码行数:34,代码来源:AffiliationDescriptor.php

示例3: testMarshallingOfSimpleRequest

    public function testMarshallingOfSimpleRequest()
    {
        $document = new DOMDocument();
        $document->loadXML(<<<AUTHNREQUEST
<samlp:AuthnRequest
  xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
  ID="_306f8ec5b618f361c70b6ffb1480eade"
  Version="2.0"
  IssueInstant="2004-12-05T09:21:59Z"
  Destination="https://idp.example.org/SAML2/SSO/Artifact"
  ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
  AssertionConsumerServiceURL="https://sp.example.com/SAML2/SSO/Artifact">
    <saml:Issuer>https://sp.example.com/SAML2</saml:Issuer>
</samlp:AuthnRequest>
AUTHNREQUEST
);
        $authnRequest = new SAML2_AuthnRequest($document->documentElement);
        $expectedIssueInstant = SAML2_Utils::xsDateTimeToTimestamp('2004-12-05T09:21:59Z');
        $this->assertEquals($expectedIssueInstant, $authnRequest->getIssueInstant());
        $this->assertEquals('https://idp.example.org/SAML2/SSO/Artifact', $authnRequest->getDestination());
        $this->assertEquals('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', $authnRequest->getProtocolBinding());
        $this->assertEquals('https://sp.example.com/SAML2/SSO/Artifact', $authnRequest->getAssertionConsumerServiceURL());
        $this->assertEquals('https://sp.example.com/SAML2', $authnRequest->getIssuer());
    }
开发者ID:pankajguru,项目名称:saml2,代码行数:25,代码来源:AuthnRequestTest.php

示例4: __construct

 /**
  * Constructor for SAML 2 logout request messages.
  *
  * @param DOMElement|NULL $xml The input message.
  * @throws Exception
  */
 public function __construct(DOMElement $xml = NULL)
 {
     parent::__construct('LogoutRequest', $xml);
     $this->sessionIndexes = array();
     if ($xml === NULL) {
         return;
     }
     if ($xml->hasAttribute('NotOnOrAfter')) {
         $this->notOnOrAfter = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('NotOnOrAfter'));
     }
     $nameId = SAML2_Utils::xpQuery($xml, './saml_assertion:NameID | ./saml_assertion:EncryptedID/xenc:EncryptedData');
     if (empty($nameId)) {
         throw new Exception('Missing <saml:NameID> or <saml:EncryptedID> in <samlp:LogoutRequest>.');
     } elseif (count($nameId) > 1) {
         throw new Exception('More than one <saml:NameID> or <saml:EncryptedD> in <samlp:LogoutRequest>.');
     }
     $nameId = $nameId[0];
     if ($nameId->localName === 'EncryptedData') {
         /* The NameID element is encrypted. */
         $this->encryptedNameId = $nameId;
     } else {
         $this->nameId = SAML2_Utils::parseNameId($nameId);
     }
     $sessionIndexes = SAML2_Utils::xpQuery($xml, './saml_protocol:SessionIndex');
     foreach ($sessionIndexes as $sessionIndex) {
         $this->sessionIndexes[] = trim($sessionIndex->textContent);
     }
 }
开发者ID:danielkjfrog,项目名称:docker,代码行数:34,代码来源:LogoutRequest.php

示例5: testXsDateTimeToTimestamp

 /**
  * Test xsDateTime format validity
  *
  * @dataProvider xsDateTimes
  */
 public function testXsDateTimeToTimestamp($shouldPass, $time, $expectedTs = null)
 {
     try {
         $ts = SAML2_Utils::xsDateTimeToTimestamp($time);
         $this->assertTrue($shouldPass);
         $this->assertEquals($expectedTs, $ts);
     } catch (Exception $e) {
         $this->assertFalse($shouldPass);
     }
 }
开发者ID:Shalmezad,项目名称:saml2,代码行数:15,代码来源:UtilsTest.php

示例6: __construct

 /**
  * Create/parse a mdrpi:RegistrationInfo element.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  * @throws Exception
  */
 public function __construct(DOMElement $xml = NULL)
 {
     if ($xml === NULL) {
         return;
     }
     if (!$xml->hasAttribute('registrationAuthority')) {
         throw new Exception('Missing required attribute "registrationAuthority" in mdrpi:RegistrationInfo element.');
     }
     $this->registrationAuthority = $xml->getAttribute('registrationAuthority');
     if ($xml->hasAttribute('registrationInstant')) {
         $this->registrationInstant = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('registrationInstant'));
     }
     $this->RegistrationPolicy = SAML2_Utils::extractLocalizedStrings($xml, SAML2_XML_mdrpi_Common::NS_MDRPI, 'RegistrationPolicy');
 }
开发者ID:dutchbridge,项目名称:saml2,代码行数:20,代码来源:RegistrationInfo.php

示例7: __construct

 /**
  * Create/parse a mdrpi:PublicationInfo element.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  * @throws Exception
  */
 public function __construct(DOMElement $xml = NULL)
 {
     if ($xml === NULL) {
         return;
     }
     if (!$xml->hasAttribute('publisher')) {
         throw new Exception('Missing required attribute "publisher" in mdrpi:PublicationInfo element.');
     }
     $this->publisher = $xml->getAttribute('publisher');
     if ($xml->hasAttribute('creationInstant')) {
         $this->creationInstant = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('creationInstant'));
     }
     if ($xml->hasAttribute('publicationId')) {
         $this->publicationId = $xml->getAttribute('publicationId');
     }
     $this->UsagePolicy = SAML2_Utils::extractLocalizedStrings($xml, SAML2_XML_mdrpi_Common::NS_MDRPI, 'UsagePolicy');
 }
开发者ID:Shalmezad,项目名称:saml2,代码行数:23,代码来源:PublicationInfo.php

示例8: __construct

 /**
  * Initialize (and parse) a SubjectConfirmationData element.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     if ($xml === NULL) {
         return;
     }
     if ($xml->hasAttribute('NotBefore')) {
         $this->NotBefore = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('NotBefore'));
     }
     if ($xml->hasAttribute('NotOnOrAfter')) {
         $this->NotOnOrAfter = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('NotOnOrAfter'));
     }
     if ($xml->hasAttribute('Recipient')) {
         $this->Recipient = $xml->getAttribute('Recipient');
     }
     if ($xml->hasAttribute('InResponseTo')) {
         $this->InResponseTo = $xml->getAttribute('InResponseTo');
     }
     if ($xml->hasAttribute('Address')) {
         $this->Address = $xml->getAttribute('Address');
     }
     for ($n = $xml->firstChild; $n !== NULL; $n = $n->nextSibling) {
         if (!$n instanceof DOMElement) {
             continue;
         }
         if ($n->namespaceURI !== XMLSecurityDSig::XMLDSIGNS) {
             $this->info[] = new SAML2_XML_Chunk($n);
             continue;
         }
         switch ($n->localName) {
             case 'KeyInfo':
                 $this->info[] = new SAML2_XML_ds_KeyInfo($n);
                 break;
             default:
                 $this->info[] = new SAML2_XML_Chunk($n);
                 break;
         }
     }
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:43,代码来源:SubjectConfirmationData.php

示例9: getEntitiesDescriptor

 /**
  * Retrieve all entities as an EntitiesDescriptor.
  *
  * @return SAML2_XML_md_EntitiesDescriptor  The entities.
  */
 protected function getEntitiesDescriptor()
 {
     $ret = new SAML2_XML_md_EntitiesDescriptor();
     $now = time();
     // add RegistrationInfo extension if enabled
     if ($this->regInfo !== NULL) {
         $ri = new SAML2_XML_mdrpi_RegistrationInfo();
         $ri->registrationInstant = $now;
         foreach ($this->regInfo as $riName => $riValues) {
             switch ($riName) {
                 case 'authority':
                     $ri->registrationAuthority = $riValues;
                     break;
                 case 'instant':
                     $ri->registrationInstant = SAML2_Utils::xsDateTimeToTimestamp($riValues);
                     break;
                 case 'policies':
                     $ri->RegistrationPolicy = $riValues;
                     break;
             }
         }
         $ret->Extensions[] = $ri;
     }
     foreach ($this->sources as $source) {
         $m = $source->getMetadata();
         if ($m === NULL) {
             continue;
         }
         $ret->children[] = $m;
     }
     $ret->validUntil = $now + $this->validLength;
     return $ret;
 }
开发者ID:DRvanR,项目名称:simplesamlphp,代码行数:38,代码来源:Aggregator.php

示例10: __construct

 /**
  * Initialize a message.
  *
  * This constructor takes an optional parameter with a DOMElement. If this
  * parameter is given, the message will be initialized with data from that
  * XML element.
  *
  * If no XML element is given, the message is initialized with suitable
  * default values.
  *
  * @param string          $tagName The tag name of the root element.
  * @param DOMElement|NULL $xml     The input message.
  * @throws Exception
  */
 protected function __construct($tagName, DOMElement $xml = NULL)
 {
     assert('is_string($tagName)');
     $this->tagName = $tagName;
     $this->id = SAML2_Utils::getContainer()->generateId();
     $this->issueInstant = time();
     $this->certificates = array();
     $this->validators = array();
     if ($xml === NULL) {
         return;
     }
     if (!$xml->hasAttribute('ID')) {
         throw new Exception('Missing ID attribute on SAML message.');
     }
     $this->id = $xml->getAttribute('ID');
     if ($xml->getAttribute('Version') !== '2.0') {
         /* Currently a very strict check. */
         throw new Exception('Unsupported version: ' . $xml->getAttribute('Version'));
     }
     $this->issueInstant = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('IssueInstant'));
     if ($xml->hasAttribute('Destination')) {
         $this->destination = $xml->getAttribute('Destination');
     }
     if ($xml->hasAttribute('Consent')) {
         $this->consent = $xml->getAttribute('Consent');
     }
     $issuer = SAML2_Utils::xpQuery($xml, './saml_assertion:Issuer');
     if (!empty($issuer)) {
         $this->issuer = trim($issuer[0]->textContent);
     }
     /* Validate the signature element of the message. */
     try {
         $sig = SAML2_Utils::validateElement($xml);
         if ($sig !== FALSE) {
             $this->certificates = $sig['Certificates'];
             $this->validators[] = array('Function' => array('SAML2_Utils', 'validateSignature'), 'Data' => $sig);
         }
     } catch (Exception $e) {
         /* Ignore signature validation errors. */
     }
     $this->extensions = SAML2_XML_samlp_Extensions::getList($xml);
 }
开发者ID:shirlei,项目名称:simplesaml,代码行数:56,代码来源:Message.php

示例11: parseAuthnStatement

 /**
  * Parse AuthnStatement in assertion.
  *
  * @param DOMElement $xml The assertion XML element.
  * @throws Exception
  */
 private function parseAuthnStatement(DOMElement $xml)
 {
     $authnStatements = SAML2_Utils::xpQuery($xml, './saml_assertion:AuthnStatement');
     if (empty($authnStatements)) {
         $this->authnInstant = NULL;
         return;
     } elseif (count($authnStatements) > 1) {
         throw new Exception('More that one <saml:AuthnStatement> in <saml:Assertion> not supported.');
     }
     $authnStatement = $authnStatements[0];
     if (!$authnStatement->hasAttribute('AuthnInstant')) {
         throw new Exception('Missing required AuthnInstant attribute on <saml:AuthnStatement>.');
     }
     $this->authnInstant = SAML2_Utils::xsDateTimeToTimestamp($authnStatement->getAttribute('AuthnInstant'));
     if ($authnStatement->hasAttribute('SessionNotOnOrAfter')) {
         $this->sessionNotOnOrAfter = SAML2_Utils::xsDateTimeToTimestamp($authnStatement->getAttribute('SessionNotOnOrAfter'));
     }
     if ($authnStatement->hasAttribute('SessionIndex')) {
         $this->sessionIndex = $authnStatement->getAttribute('SessionIndex');
     }
     $this->parseAuthnContext($authnStatement);
 }
开发者ID:reinier-vegter,项目名称:saml2,代码行数:28,代码来源:Assertion.php

示例12: __construct

 /**
  * Initialize an EntitiyDescriptor.
  *
  * @param DOMElement|NULL $xml The XML element we should load.
  * @throws Exception
  */
 public function __construct(DOMElement $xml = NULL)
 {
     parent::__construct($xml);
     if ($xml === NULL) {
         return;
     }
     if (!$xml->hasAttribute('entityID')) {
         throw new Exception('Missing required attribute entityID on EntityDescriptor.');
     }
     $this->entityID = $xml->getAttribute('entityID');
     if ($xml->hasAttribute('ID')) {
         $this->ID = $xml->getAttribute('ID');
     }
     if ($xml->hasAttribute('validUntil')) {
         $this->validUntil = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('validUntil'));
     }
     if ($xml->hasAttribute('cacheDuration')) {
         $this->cacheDuration = $xml->getAttribute('cacheDuration');
     }
     $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
     for ($node = $xml->firstChild; $node !== NULL; $node = $node->nextSibling) {
         if (!$node instanceof DOMElement) {
             continue;
         }
         if ($node->namespaceURI !== SAML2_Const::NS_MD) {
             continue;
         }
         switch ($node->localName) {
             case 'RoleDescriptor':
                 $this->RoleDescriptor[] = new SAML2_XML_md_UnknownRoleDescriptor($node);
                 break;
             case 'IDPSSODescriptor':
                 $this->RoleDescriptor[] = new SAML2_XML_md_IDPSSODescriptor($node);
                 break;
             case 'SPSSODescriptor':
                 $this->RoleDescriptor[] = new SAML2_XML_md_SPSSODescriptor($node);
                 break;
             case 'AuthnAuthorityDescriptor':
                 $this->RoleDescriptor[] = new SAML2_XML_md_AuthnAuthorityDescriptor($node);
                 break;
             case 'AttributeAuthorityDescriptor':
                 $this->RoleDescriptor[] = new SAML2_XML_md_AttributeAuthorityDescriptor($node);
                 break;
             case 'PDPDescriptor':
                 $this->RoleDescriptor[] = new SAML2_XML_md_PDPDescriptor($node);
                 break;
         }
     }
     $affiliationDescriptor = SAML2_Utils::xpQuery($xml, './saml_metadata:AffiliationDescriptor');
     if (count($affiliationDescriptor) > 1) {
         throw new Exception('More than one AffiliationDescriptor in the entity.');
     } elseif (!empty($affiliationDescriptor)) {
         $this->AffiliationDescriptor = new SAML2_XML_md_AffiliationDescriptor($affiliationDescriptor[0]);
     }
     if (empty($this->RoleDescriptor) && is_null($this->AffiliationDescriptor)) {
         throw new Exception('Must have either one of the RoleDescriptors or an AffiliationDescriptor in EntityDescriptor.');
     } elseif (!empty($this->RoleDescriptor) && !is_null($this->AffiliationDescriptor)) {
         throw new Exception('AffiliationDescriptor cannot be combined with other RoleDescriptor elements in EntityDescriptor.');
     }
     $organization = SAML2_Utils::xpQuery($xml, './saml_metadata:Organization');
     if (count($organization) > 1) {
         throw new Exception('More than one Organization in the entity.');
     } elseif (!empty($organization)) {
         $this->Organization = new SAML2_XML_md_Organization($organization[0]);
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ContactPerson') as $cp) {
         $this->ContactPerson[] = new SAML2_XML_md_ContactPerson($cp);
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:AdditionalMetadataLocation') as $aml) {
         $this->AdditionalMetadataLocation[] = new SAML2_XML_md_AdditionalMetadataLocation($aml);
     }
 }
开发者ID:danielkjfrog,项目名称:docker,代码行数:78,代码来源:EntityDescriptor.php

示例13: addExtensions

 /**
  * Add extensions to the metadata.
  *
  * @param SimpleSAML_Configuration    $metadata The metadata to get extensions from.
  * @param SAML2_XML_md_RoleDescriptor $e Reference to the element where the Extensions element should be included.
  */
 private function addExtensions(SimpleSAML_Configuration $metadata, SAML2_XML_md_RoleDescriptor $e)
 {
     if ($metadata->hasValue('tags')) {
         $a = new SAML2_XML_saml_Attribute();
         $a->Name = 'tags';
         foreach ($metadata->getArray('tags') as $tag) {
             $a->AttributeValue[] = new SAML2_XML_saml_AttributeValue($tag);
         }
         $e->Extensions[] = $a;
     }
     if ($metadata->hasValue('hint.cidr')) {
         $a = new SAML2_XML_saml_Attribute();
         $a->Name = 'hint.cidr';
         foreach ($metadata->getArray('hint.cidr') as $hint) {
             $a->AttributeValue[] = new SAML2_XML_saml_AttributeValue($hint);
         }
         $e->Extensions[] = $a;
     }
     if ($metadata->hasValue('scope')) {
         foreach ($metadata->getArray('scope') as $scopetext) {
             $s = new SAML2_XML_shibmd_Scope();
             $s->scope = $scopetext;
             // Check whether $ ^ ( ) * | \ are in a scope -> assume regex.
             if (1 === preg_match('/[\\$\\^\\)\\(\\*\\|\\\\]/', $scopetext)) {
                 $s->regexp = true;
             } else {
                 $s->regexp = false;
             }
             $e->Extensions[] = $s;
         }
     }
     if ($metadata->hasValue('EntityAttributes')) {
         $ea = new SAML2_XML_mdattr_EntityAttributes();
         foreach ($metadata->getArray('EntityAttributes') as $attributeName => $attributeValues) {
             $a = new SAML2_XML_saml_Attribute();
             $a->Name = $attributeName;
             $a->NameFormat = 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri';
             // Attribute names that is not URI is prefixed as this: '{nameformat}name'
             if (preg_match('/^\\{(.*?)\\}(.*)$/', $attributeName, $matches)) {
                 $a->Name = $matches[2];
                 $nameFormat = $matches[1];
                 if ($nameFormat !== SAML2_Const::NAMEFORMAT_UNSPECIFIED) {
                     $a->NameFormat = $nameFormat;
                 }
             }
             foreach ($attributeValues as $attributeValue) {
                 $a->AttributeValue[] = new SAML2_XML_saml_AttributeValue($attributeValue);
             }
             $ea->children[] = $a;
         }
         $this->entityDescriptor->Extensions[] = $ea;
     }
     if ($metadata->hasValue('RegistrationInfo')) {
         $ri = new SAML2_XML_mdrpi_RegistrationInfo();
         foreach ($metadata->getArray('RegistrationInfo') as $riName => $riValues) {
             switch ($riName) {
                 case 'authority':
                     $ri->registrationAuthority = $riValues;
                     break;
                 case 'instant':
                     $ri->registrationInstant = SAML2_Utils::xsDateTimeToTimestamp($riValues);
                     break;
                 case 'policies':
                     $ri->RegistrationPolicy = $riValues;
                     break;
             }
         }
         $this->entityDescriptor->Extensions[] = $ri;
     }
     if ($metadata->hasValue('UIInfo')) {
         $ui = new SAML2_XML_mdui_UIInfo();
         foreach ($metadata->getArray('UIInfo') as $uiName => $uiValues) {
             switch ($uiName) {
                 case 'DisplayName':
                     $ui->DisplayName = $uiValues;
                     break;
                 case 'Description':
                     $ui->Description = $uiValues;
                     break;
                 case 'InformationURL':
                     $ui->InformationURL = $uiValues;
                     break;
                 case 'PrivacyStatementURL':
                     $ui->PrivacyStatementURL = $uiValues;
                     break;
                 case 'Keywords':
                     foreach ($uiValues as $lang => $keywords) {
                         $uiItem = new SAML2_XML_mdui_Keywords();
                         $uiItem->lang = $lang;
                         $uiItem->Keywords = $keywords;
                         $ui->Keywords[] = $uiItem;
                     }
                     break;
                 case 'Logo':
//.........这里部分代码省略.........
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:101,代码来源:SAMLBuilder.php

示例14: __construct

 /**
  * Initialize a RoleDescriptor.
  *
  * @param string          $elementName The name of this element.
  * @param DOMElement|NULL $xml         The XML element we should load.
  * @throws Exception
  */
 protected function __construct($elementName, DOMElement $xml = NULL)
 {
     assert('is_string($elementName)');
     parent::__construct($xml);
     $this->elementName = $elementName;
     if ($xml === NULL) {
         return;
     }
     if ($xml->hasAttribute('ID')) {
         $this->ID = $xml->getAttribute('ID');
     }
     if ($xml->hasAttribute('validUntil')) {
         $this->validUntil = SAML2_Utils::xsDateTimeToTimestamp($xml->getAttribute('validUntil'));
     }
     if ($xml->hasAttribute('cacheDuration')) {
         $this->cacheDuration = $xml->getAttribute('cacheDuration');
     }
     if (!$xml->hasAttribute('protocolSupportEnumeration')) {
         throw new Exception('Missing protocolSupportEnumeration attribute on ' . $xml->localName);
     }
     $this->protocolSupportEnumeration = preg_split('/[\\s]+/', $xml->getAttribute('protocolSupportEnumeration'));
     if ($xml->hasAttribute('errorURL')) {
         $this->errorURL = $xml->getAttribute('errorURL');
     }
     $this->Extensions = SAML2_XML_md_Extensions::getList($xml);
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:KeyDescriptor') as $kd) {
         $this->KeyDescriptor[] = new SAML2_XML_md_KeyDescriptor($kd);
     }
     $organization = SAML2_Utils::xpQuery($xml, './saml_metadata:Organization');
     if (count($organization) > 1) {
         throw new Exception('More than one Organization in the entity.');
     } elseif (!empty($organization)) {
         $this->Organization = new SAML2_XML_md_Organization($organization[0]);
     }
     foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:ContactPerson') as $cp) {
         $this->contactPersons[] = new SAML2_XML_md_ContactPerson($cp);
     }
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:45,代码来源:RoleDescriptor.php

示例15: parseAuthnStatement

 /**
  * Parse AuthnStatement in assertion.
  *
  * @param DOMElement $xml The assertion XML element.
  * @throws Exception
  */
 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];
     if (!$as->hasAttribute('AuthnInstant')) {
         throw new Exception('Missing required AuthnInstant attribute on <saml:AuthnStatement>.');
     }
     $this->authnInstant = SAML2_Utils::xsDateTimeToTimestamp($as->getAttribute('AuthnInstant'));
     if ($as->hasAttribute('SessionNotOnOrAfter')) {
         $this->sessionNotOnOrAfter = SAML2_Utils::xsDateTimeToTimestamp($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:dutchbridge,项目名称:saml2,代码行数:49,代码来源:Assertion.php


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