static String authorization()

in wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java [134:177]


    static String authorization(final String url) {
        if (url == null) {
            return "localhost";
        }

        String protocol = PathUtils.protocol(url);

        if (protocol == null || protocol.equalsIgnoreCase("file")) {
            return "localhost";
        }

        String host = url;
        if (protocol.equalsIgnoreCase("scm")) {
            // skip over type
            host = host.substring(host.indexOf(":", 4) + 1).trim();
        }

        protocol = PathUtils.protocol(host);

        if (protocol.equalsIgnoreCase("file")) {
            return "localhost";
        }

        // skip over protocol
        host = host.substring(host.indexOf(":") + 1).trim();
        if (host.startsWith("//")) {
            host = host.substring(2);
        }

        int pos = host.indexOf("/");

        if (pos > 0) {
            host = host.substring(0, pos);
        }

        pos = host.indexOf('@');

        pos = (pos > 0) ? endOfHostPosition(host, pos) : endOfHostPosition(host, 0);

        if (pos > 0) {
            host = host.substring(0, pos);
        }
        return host;
    }