當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SimpleSAML_Utilities::ipCIDRcheck方法代碼示例

本文整理匯總了PHP中SimpleSAML_Utilities::ipCIDRcheck方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleSAML_Utilities::ipCIDRcheck方法的具體用法?PHP SimpleSAML_Utilities::ipCIDRcheck怎麽用?PHP SimpleSAML_Utilities::ipCIDRcheck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SimpleSAML_Utilities的用法示例。


在下文中一共展示了SimpleSAML_Utilities::ipCIDRcheck方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPreferredEntityIdFromCIDRhint

 /**
  * This function will go through all the metadata, and check the hint.cidr
  * parameter, which defines a network space (ip range) for each remote entry.
  * This function returns the entityID for any of the entities that have an 
  * IP range which the IP falls within.
  *
  * @param $set  Which set of metadata we are looking it up in.
  * @param $ip	IP address
  * @param $type Do you want to return the metaindex or the entityID. [entityid|metaindex]
  * @return The entity id of a entity which have a CIDR hint where the provided
  * 		IP address match.
  */
 public function getPreferredEntityIdFromCIDRhint($set, $ip, $type = 'entityid')
 {
     $metadataSet = $this->getMetadataSet($set);
     foreach ($metadataSet as $index => $entry) {
         if (!array_key_exists('hint.cidr', $entry)) {
             continue;
         }
         if (!is_array($entry['hint.cidr'])) {
             continue;
         }
         foreach ($entry['hint.cidr'] as $hint_entry) {
             if (SimpleSAML_Utilities::ipCIDRcheck($hint_entry, $ip)) {
                 if ($type === 'entityid') {
                     return $entry['entityid'];
                 } else {
                     return $index;
                 }
             }
         }
     }
     /* No entries matched - we should return NULL. */
     return NULL;
 }
開發者ID:danielkjfrog,項目名稱:docker,代碼行數:35,代碼來源:MetaDataStorageSource.php

示例2: checkMask

 /**
  * checkMask() looks up the subnet config option and verifies
  * that the client is within that range.
  *
  * Will return TRUE if no subnet option is configured.
  *
  * @return boolean
  */
 public function checkMask()
 {
     // No subnet means all clients are accepted.
     if ($this->subnet === NULL) {
         return TRUE;
     }
     $ip = $_SERVER['REMOTE_ADDR'];
     foreach ($this->subnet as $cidr) {
         $ret = SimpleSAML_Utilities::ipCIDRcheck($cidr);
         if ($ret) {
             SimpleSAML_Logger::debug('Negotiate: Client "' . $ip . '" matched subnet.');
             return TRUE;
         }
     }
     SimpleSAML_Logger::debug('Negotiate: Client "' . $ip . '" did not match subnet.');
     return FALSE;
 }
開發者ID:danielkjfrog,項目名稱:docker,代碼行數:25,代碼來源:Negotiate.php


注:本文中的SimpleSAML_Utilities::ipCIDRcheck方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。