Package com.cloud.bridge.util

Examples of com.cloud.bridge.util.IpAddressRange


    Iterator<ConditionKeys> itr = keySet.iterator();
    if (!itr.hasNext()) return false;
   
    // -> returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
    //    For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.
    IpAddressRange toCompareWith = IpAddressRange.parseRange( context.getRemoveAddr());
    if (null == toCompareWith) return false;
     
   
    // -> all keys in a condition are ANDed together (one false one terminates the entire condition)
    while( itr.hasNext())
    {
      ConditionKeys keyName = itr.next();
      IpAddressRange[] valueList = getKeyValues( keyName );
      boolean keyResult = false;

      // -> stop when we hit the first true key value (i.e., key values are 'OR'ed together)
            for( int i=0; i < valueList.length && !keyResult; i++ )
            {           
              switch( condition ) {
            case IpAddress:
               if (valueList[i].contains( toCompareWith )) keyResult = true;
                  break;
            case NotIpAddres:
                  if (!valueList[i].contains( toCompareWith )) keyResult = true;
                  break;
            default:
               return false;
              }
          logger.info( "S3PolicyIPAddressCondition eval - SID: " + SID + ", " + condition + ", key: " + keyName + ", valuePassedIn: " + toCompareWith.toString() + ", valueInRule: " + valueList[i].toString() + ", result: " + keyResult );
            }
           
            // -> if all key values are false, false then that key is false and then the entire condition is then false
            if (!keyResult) return false;
    }
View Full Code Here


        if (!itr.hasNext())
            return false;

        // -> returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
        //    For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.
        IpAddressRange toCompareWith = IpAddressRange.parseRange(context.getRemoveAddr());
        if (null == toCompareWith)
            return false;

        // -> all keys in a condition are ANDed together (one false one terminates the entire condition)
        while (itr.hasNext()) {
            ConditionKeys keyName = itr.next();
            IpAddressRange[] valueList = getKeyValues(keyName);
            boolean keyResult = false;

            // -> stop when we hit the first true key value (i.e., key values are 'OR'ed together)
            for (int i = 0; i < valueList.length && !keyResult; i++) {
                switch (condition) {
                    case IpAddress:
                        if (valueList[i].contains(toCompareWith))
                            keyResult = true;
                        break;
                    case NotIpAddres:
                        if (!valueList[i].contains(toCompareWith))
                            keyResult = true;
                        break;
                    default:
                        return false;
                }
                logger.info("S3PolicyIPAddressCondition eval - SID: " + SID + ", " + condition + ", key: " + keyName + ", valuePassedIn: " + toCompareWith.toString() +
                    ", valueInRule: " + valueList[i].toString() + ", result: " + keyResult);
            }

            // -> if all key values are false, false then that key is false and then the entire condition is then false
            if (!keyResult)
View Full Code Here

    Iterator<ConditionKeys> itr = keySet.iterator();
    if (!itr.hasNext()) return false;
   
    // -> returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
    //    For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.
    IpAddressRange toCompareWith = IpAddressRange.parseRange( context.getRemoveAddr());
    if (null == toCompareWith) return false;
     
   
    // -> all keys in a condition are ANDed together (one false one terminates the entire condition)
    while( itr.hasNext())
    {
      ConditionKeys keyName = itr.next();
      IpAddressRange[] valueList = getKeyValues( keyName );
      boolean keyResult = false;

      // -> stop when we hit the first true key value (i.e., key values are 'OR'ed together)
            for( int i=0; i < valueList.length && !keyResult; i++ )
            {           
              switch( condition ) {
            case IpAddress:
               if (valueList[i].contains( toCompareWith )) keyResult = true;
                  break;
            case NotIpAddres:
                  if (!valueList[i].contains( toCompareWith )) keyResult = true;
                  break;
            default:
               return false;
              }
          logger.info( "S3PolicyIPAddressCondition eval - SID: " + SID + ", " + condition + ", key: " + keyName + ", valuePassedIn: " + toCompareWith.toString() + ", valueInRule: " + valueList[i].toString() + ", result: " + keyResult );
            }
           
            // -> if all key values are false, false then that key is false and then the entire condition is then false
            if (!keyResult) return false;
    }
View Full Code Here

TOP

Related Classes of com.cloud.bridge.util.IpAddressRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.