class InstanceZTSProvider implements InstanceProvider {

    boolean validateHostname(final String hostname, final String[] sanIps) {

        LOGGER.debug("Validating hostname: {}, sanIps: {}", hostname, sanIps);

        if (hostname == null || hostname.isEmpty()) {
            LOGGER.info("Request contains no hostname entry for validation");
            // if more than one sanIp is passed, all sanIPs must map to hostname, and hostname is a must
            if (sanIps != null && sanIps.length > 1) {
                LOGGER.error("SanIps:{} > 1, and hostname is empty", sanIps);
                return false;
            }
            return true;
        }

        // IP in clientIp can be NATed. Rely on sanIp, which comes from the client, and is already matched with clientIp
        // sanIp should be non-empty
        if (sanIps == null || sanIps.length == 0) {
            LOGGER.error("Request contains no sanIp entry for hostname:{} validation", hostname);
            return false;
        }

        // All entries in sanIP must be one of the IPs that hostname resolves
        Set<String>  hostIps = hostnameResolver.getAllByName(hostname);
        for (String sanIp: sanIps) {
            if (!hostIps.contains(sanIp)) {
                LOGGER.error("One of sanIp: {} is not present in HostIps: {}", hostIps, sanIps);
                return false;
            }
        }

        return true;
    }

}