class AmbariProxiedUserDetailsService implements UserDetailsService {

  boolean isInIpAddressRange(String cidr, String ipAddress) {
    Matcher matcher = IP_ADDRESS_RANGE_PATTERN.matcher(cidr);

    if (matcher.matches() && matcher.groupCount() == 2) {
      try {
        String hostSpecIPAddress = matcher.group(1);
        String hostSpecBits = matcher.group(2);
        int hostSpecIPAddressInt = ipAddressToInt(hostSpecIPAddress);
        int remoteAddressInt = ipAddressToInt(ipAddress);

        int mask = -1 << (32 - Integer.valueOf(hostSpecBits));
        return ((hostSpecIPAddressInt & mask) == (remoteAddressInt & mask));
      } catch (Throwable t) {
        LOG.warn("Invalid CIDR in host specification, skipping: " + cidr, t);
      }
    }

    return false;
  }

    AmbariProxiedUserDetailsService(Configuration configuration, Users users);

}