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


PHP SimpleSAML_Utilities::getDOMText方法代码示例

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


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

示例1: parseKeyDescriptor

 /**
  * This function parses a KeyDescriptor element. It currently only supports keys with a single
  * X509 certificate.
  *
  * The associative array for a key can contain:
  * - 'encryption': Indicates wheter this key can be used for encryption.
  * - 'signing': Indicates wheter this key can be used for signing.
  * - 'type: The type of the key. 'X509Certificate' is the only key type we support.
  * - 'X509Certificate': The contents of the first X509Certificate element (if the type is 'X509Certificate ').
  *
  * @param $kd  The KeyDescriptor element.
  * @return Associative array describing the key, or NULL if this is an unsupported key.
  */
 private static function parseKeyDescriptor($kd)
 {
     assert('$kd instanceof DOMElement');
     $r = array();
     if ($kd->hasAttribute('use')) {
         $use = $kd->getAttribute('use');
         if ($use === 'encryption') {
             $r['encryption'] = TRUE;
             $r['signing'] = FALSE;
         } elseif ($use === 'signing') {
             $r['encryption'] = FALSE;
             $r['signing'] = TRUE;
         } else {
             throw new Exception('Invalid use-value for KeyDescriptor: ' . $use);
         }
     } else {
         $r['encryption'] = TRUE;
         $r['signing'] = TRUE;
     }
     $keyInfo = SimpleSAML_Utilities::getDOMChildren($kd, 'KeyInfo', '@ds');
     if (count($keyInfo) === 0) {
         throw new Exception('Missing required KeyInfo field for KeyDescriptor.');
     }
     $keyInfo = $keyInfo[0];
     $X509Data = SimpleSAML_Utilities::getDOMChildren($keyInfo, 'X509Data', '@ds');
     if (count($X509Data) === 0) {
         return NULL;
     }
     $X509Data = $X509Data[0];
     $X509Certificate = SimpleSAML_Utilities::getDOMChildren($X509Data, 'X509Certificate', '@ds');
     if (count($X509Certificate) === 0) {
         return NULL;
     }
     $X509Certificate = $X509Certificate[0];
     $r['type'] = 'X509Certificate';
     $r['X509Certificate'] = SimpleSAML_Utilities::getDOMText($X509Certificate);
     return $r;
 }
开发者ID:hukumonline,项目名称:yii,代码行数:51,代码来源:SAMLParser.php


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