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


PHP SAML2_Utils::insertSignature方法代码示例

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


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

示例1: toXML

 /**
  * Convert this assertion to an XML element.
  *
  * @param DOMNode|NULL $parentElement  The DOM node the assertion should be created in.
  * @return DOMElement  This assertion.
  */
 public function toXML(DOMNode $parentElement = NULL)
 {
     if ($parentElement === NULL) {
         $document = new DOMDocument();
         $parentElement = $document;
     } else {
         $document = $parentElement->ownerDocument;
     }
     $root = $document->createElementNS(SAML2_Const::NS_SAML, 'saml:' . 'Assertion');
     $parentElement->appendChild($root);
     /* Ugly hack to add another namespace declaration to the root element. */
     $root->setAttributeNS(SAML2_Const::NS_SAMLP, 'samlp:tmp', 'tmp');
     $root->removeAttributeNS(SAML2_Const::NS_SAMLP, 'tmp');
     $root->setAttributeNS(SAML2_Const::NS_XSI, 'xsi:tmp', 'tmp');
     $root->removeAttributeNS(SAML2_Const::NS_XSI, 'tmp');
     $root->setAttributeNS(SAML2_Const::NS_XS, 'xs:tmp', 'tmp');
     $root->removeAttributeNS(SAML2_Const::NS_XS, 'tmp');
     $root->setAttribute('ID', $this->id);
     $root->setAttribute('Version', '2.0');
     $root->setAttribute('IssueInstant', gmdate($this->dateformat, $this->issueInstant));
     $issuer = SAML2_Utils::addString($root, SAML2_Const::NS_SAML, 'saml:Issuer', $this->issuer);
     $this->addSubject($root);
     $this->addConditions($root);
     $this->addAuthnStatement($root);
     // Add two sets of attributestatements
     $tmpattr = $this->attributes;
     $this->attributes = array('urn:foo' => array('bar'));
     $this->addAttributeStatement($root);
     $this->attributes = $tmpattr;
     $this->addAttributeStatement($root);
     if ($this->signatureKey !== NULL) {
         SAML2_Utils::insertSignature($this->signatureKey, $this->certificates, $root, $issuer->nextSibling);
     }
     return $root;
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:41,代码来源:AssertionMultipleAttrStatements.php

示例2: signElement

 /**
  * Sign the given XML element.
  *
  * @param DOMElement      $root         The element we should sign.
  * @param DOMElement|NULL $insertBefore The element we should insert the signature node before.
  * @return DOMElement|NULL
  */
 protected function signElement(DOMElement $root, DOMElement $insertBefore = NULL)
 {
     if ($this->signatureKey === NULL) {
         /* We cannot sign this element. */
         return NULL;
     }
     SAML2_Utils::insertSignature($this->signatureKey, $this->certificates, $root, $insertBefore);
     return $root;
 }
开发者ID:danielkjfrog,项目名称:docker,代码行数:16,代码来源:SignedElementHelper.php

示例3: toSignedXML

 /**
  * Convert this message to a signed XML document.
  *
  * This method sign the resulting XML document if the private key for
  * the signature is set.
  *
  * @return DOMElement  The root element of the DOM tree.
  */
 public function toSignedXML()
 {
     $root = $this->toUnsignedXML();
     if ($this->signatureKey === NULL) {
         /* We don't have a key to sign it with. */
         return $root;
     }
     /* Find the position we should insert the signature node at. */
     if ($this->issuer !== NULL) {
         /*
          * We have an issuer node. The signature node should come
          * after the issuer node.
          */
         $issuerNode = $root->firstChild;
         $insertBefore = $issuerNode->nextSibling;
     } else {
         /* No issuer node - the signature element should be the first element. */
         $insertBefore = $root->firstChild;
     }
     SAML2_Utils::insertSignature($this->signatureKey, $this->certificates, $root, $insertBefore);
     return $root;
 }
开发者ID:hukumonline,项目名称:yii,代码行数:30,代码来源:Message.php

示例4: toXML

 /**
  * Convert this assertion to an XML element.
  *
  * @param  DOMNode|NULL $parentElement The DOM node the assertion should be created in.
  * @return DOMElement   This assertion.
  */
 public function toXML(DOMNode $parentElement = NULL)
 {
     if ($parentElement === NULL) {
         $document = new DOMDocument();
         $parentElement = $document;
     } else {
         $document = $parentElement->ownerDocument;
     }
     $root = $document->createElementNS(SAML2_Const::NS_SAML, 'saml:' . 'Assertion');
     $parentElement->appendChild($root);
     /* Ugly hack to add another namespace declaration to the root element. */
     $root->setAttributeNS(SAML2_Const::NS_SAMLP, 'samlp:tmp', 'tmp');
     $root->removeAttributeNS(SAML2_Const::NS_SAMLP, 'tmp');
     $root->setAttributeNS(SAML2_Const::NS_XSI, 'xsi:tmp', 'tmp');
     $root->removeAttributeNS(SAML2_Const::NS_XSI, 'tmp');
     $root->setAttributeNS(SAML2_Const::NS_XS, 'xs:tmp', 'tmp');
     $root->removeAttributeNS(SAML2_Const::NS_XS, 'tmp');
     $root->setAttribute('ID', $this->id);
     $root->setAttribute('Version', '2.0');
     $root->setAttribute('IssueInstant', gmdate('Y-m-d\\TH:i:s\\Z', $this->issueInstant));
     $issuer = SAML2_Utils::addString($root, SAML2_Const::NS_SAML, 'saml:Issuer', $this->issuer);
     $this->addSubject($root);
     $this->addConditions($root);
     $this->addAuthnStatement($root);
     if ($this->requiredEncAttributes == FALSE) {
         $this->addAttributeStatement($root);
     } else {
         $this->addEncryptedAttributeStatement($root);
     }
     if ($this->signatureKey !== NULL) {
         SAML2_Utils::insertSignature($this->signatureKey, $this->certificates, $root, $issuer->nextSibling);
     }
     return $root;
 }
开发者ID:reinier-vegter,项目名称:saml2,代码行数:40,代码来源:Assertion.php


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