private static void validateHostnameIsTrusted()

in data/src/main/java/com/microsoft/azure/kusto/data/auth/endpoints/KustoTrustedEndpoints.java [117:150]


    private static void validateHostnameIsTrusted(String hostname, String loginEndpoint) {
        // The loopback is unconditionally allowed (since we trust ourselves)
        if (UriUtils.isLocalAddress(hostname)) {
            return;
        }

        // Either check the override matcher OR the matcher:
        Predicate<String> override = overrideMatcher;
        if (override != null) {
            if (override.test(hostname)) {
                return;
            }
        } else {
            FastSuffixMatcher matcher = matchers.get(loginEndpoint);
            if (matcher != null && matcher.isMatch(hostname)) {
                return;
            }
        }

        FastSuffixMatcher matcher = additionalMatcher;
        if (matcher != null && matcher.isMatch(hostname)) {
            return;
        }

        if (!enableWellKnownKustoEndpointsValidation) {
            log.warn("Can't communicate with '{}' as this hostname is currently not trusted; please see https://aka.ms/kustotrustedendpoints.", hostname);
            return;
        }

        throw new KustoClientInvalidConnectionStringException(
                String.format(
                        "$$ALERT[ValidateHostnameIsTrusted]: Can't communicate with '%s' as this hostname is currently not trusted; please see https://aka.ms/kustotrustedendpoints",
                        hostname));
    }