SimpleSAML_Utilities::ipCIDRcheck PHP 메소드

ipCIDRcheck() 공개 정적인 메소드

사용 중단: This method will be removed in version 2.0. Use SimpleSAML\Utils\Net::ipCIDRcheck() instead.
public static ipCIDRcheck ( $cidr, $ip = null )
    public static function ipCIDRcheck($cidr, $ip = null)
    {
        return SimpleSAML\Utils\Net::ipCIDRcheck($cidr, $ip);
    }

Usage Example

예제 #1
0
 /**
  * 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;
 }
All Usage Examples Of SimpleSAML_Utilities::ipCIDRcheck