java.net.Authenticator Java Examples

The following examples show how to use java.net.Authenticator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NegotiateCallbackHandler.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void getAnswer() {
    if (!answered) {
        answered = true;
        PasswordAuthentication passAuth =
                Authenticator.requestPasswordAuthentication(
                hci.host, hci.addr, hci.port, hci.protocol,
                hci.prompt, hci.scheme, hci.url, hci.authType);
        /**
         * To be compatible with existing callback handler implementations,
         * when the underlying Authenticator is canceled, username and
         * password are assigned null. No exception is thrown.
         */
        if (passAuth != null) {
            username = passAuth.getUserName();
            password = passAuth.getPassword();
        }
    }
}
 
Example #2
Source File: HttpURLConnection.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
                        final String host,
                        final InetAddress addr,
                        final int port,
                        final String protocol,
                        final String prompt,
                        final String scheme,
                        final URL url,
                        final RequestorType authType) {
    return java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<PasswordAuthentication>() {
            public PasswordAuthentication run() {
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Requesting Authentication: host =" + host + " url = " + url);
                }
                PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                    host, addr, port, protocol,
                    prompt, scheme, url, authType);
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
 
Example #3
Source File: HttpAuthenticator.java    From CordovaYoutubeVideoPlayer with MIT License 6 votes vote down vote up
@Override public Credential authenticateProxy(
    Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
  for (Challenge challenge : challenges) {
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
      continue;
    }

    InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
    PasswordAuthentication auth = Authenticator.requestPasswordAuthentication(
        proxyAddress.getHostName(), getConnectToInetAddress(proxy, url), proxyAddress.getPort(),
        url.getProtocol(), challenge.getRealm(), challenge.getScheme(), url,
        Authenticator.RequestorType.PROXY);
    if (auth != null) {
      return Credential.basic(auth.getUserName(), new String(auth.getPassword()));
    }
  }
  return null;
}
 
Example #4
Source File: ReferencingAuthenticator.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void remove() {
    try {
        for (final Field f : Authenticator.class.getDeclaredFields()) {
            if (f.getType().equals(Authenticator.class)) {
                try {
                    f.setAccessible(true);
                    Authenticator o = (Authenticator)f.get(null);
                    if (o == this) {
                        //this is at the root of any chain of authenticators
                        Authenticator.setDefault(wrapped);
                    } else {
                        removeFromChain(o);
                    }
                } catch (Exception e) {
                    //ignore
                }
            }
        }
    } catch (Throwable t) {
        //ignore
    }
}
 
Example #5
Source File: HttpCallerInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url, Authenticator a) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
    authenticator = a;
}
 
Example #6
Source File: SalesforceProxyTestIT.java    From components with Apache License 2.0 6 votes vote down vote up
private static void setProxySettingForClient() {
    System.setProperty("http.proxySet", "true");
    System.setProperty("http.proxyHost", "127.0.0.1");
    System.setProperty("http.proxyPort", "" + proxyPort);
    System.setProperty("http.proxyUser", proxyUsername);
    System.setProperty("http.proxyPassword", proxyPassword);

    Authenticator.setDefault(new Authenticator() {

        @Override
        public PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray());
        }

    });
}
 
Example #7
Source File: ReferencingAuthenticator.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
protected PasswordAuthentication getPasswordAuthentication() {
    Authenticator cxfauth = auth.get();
    if (cxfauth == null) {
        remove();
    }
    PasswordAuthentication pauth = null;
    if (wrapped != null) {
        try {
            pauth = tryWith(wrapped);
            if (pauth != null) {
                return pauth;
            }
        } catch (Exception e) {
            pauth = null;
        }
    }
    if (cxfauth != null) {
        try {
            pauth = tryWith(cxfauth);
        } catch (Exception e1) {
            pauth = null;
        }
    }
    return pauth;
}
 
Example #8
Source File: HttpAuthenticator.java    From phonegapbootcampsite with MIT License 6 votes vote down vote up
@Override public Credential authenticateProxy(
    Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
  for (Challenge challenge : challenges) {
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
      continue;
    }

    InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
    PasswordAuthentication auth = Authenticator.requestPasswordAuthentication(
        proxyAddress.getHostName(), getConnectToInetAddress(proxy, url), proxyAddress.getPort(),
        url.getProtocol(), challenge.getRealm(), challenge.getScheme(), url,
        Authenticator.RequestorType.PROXY);
    if (auth != null) {
      return Credential.basic(auth.getUserName(), new String(auth.getPassword()));
    }
  }
  return null;
}
 
Example #9
Source File: HttpAuthenticator.java    From crosswalk-cordova-android with Apache License 2.0 6 votes vote down vote up
@Override public Credential authenticate(
    Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
  for (Challenge challenge : challenges) {
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
      continue;
    }

    PasswordAuthentication auth = Authenticator.requestPasswordAuthentication(url.getHost(),
        getConnectToInetAddress(proxy, url), url.getPort(), url.getProtocol(),
        challenge.getRealm(), challenge.getScheme(), url, Authenticator.RequestorType.SERVER);
    if (auth != null) {
      return Credential.basic(auth.getUserName(), new String(auth.getPassword()));
    }
  }
  return null;
}
 
Example #10
Source File: WebiConfig.java    From webi with Apache License 2.0 6 votes vote down vote up
public WebiConfig setDefaultProxy(String host, int port, final String username, final String password) {
    WebiConfig.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
    System.setProperty("http.proxyHost", host);
    System.setProperty("http.proxyPort", String.valueOf(port));
    System.setProperty("http.proxyUser", username);
    System.setProperty("http.proxyPassword", password);

    Authenticator.setDefault(
            new Authenticator() {
                public PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(username, password.toCharArray());
                }
            }
    );

    return this;
}
 
Example #11
Source File: Webi.java    From webi with Apache License 2.0 6 votes vote down vote up
public Webi setProxy(String host, int port, final String username, final String password) {
    webService.is_proxy_seted = true;
    webService.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
    System.setProperty("http.proxyHost", host);
    System.setProperty("http.proxyPort", String.valueOf(port));
    System.setProperty("http.proxyUser", username);
    System.setProperty("http.proxyPassword", password);

    Authenticator.setDefault(
            new Authenticator() {
                public PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(username, password.toCharArray());
                }
            }
    );
    return this;
}
 
Example #12
Source File: TelegramBotOptionsAutoConfiguration.java    From telegram-spring-boot-starter with MIT License 6 votes vote down vote up
@Bean
public DefaultBotOptions defaultBotOptions() {
    if (properties.hasAuthData()) {
        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(properties.getUser(), properties.getPassword().toCharArray());
            }
        });
    }
    DefaultBotOptions botOptions = new DefaultBotOptions();
    botOptions.setProxyHost(properties.getHost());
    botOptions.setProxyPort(properties.getPort());
    botOptions.setProxyType(properties.getType());
    return botOptions;
}
 
Example #13
Source File: HttpURLConnection.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
                        final String host,
                        final InetAddress addr,
                        final int port,
                        final String protocol,
                        final String prompt,
                        final String scheme,
                        final URL url,
                        final RequestorType authType) {
    return java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<PasswordAuthentication>() {
            public PasswordAuthentication run() {
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Requesting Authentication: host =" + host + " url = " + url);
                }
                PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                    host, addr, port, protocol,
                    prompt, scheme, url, authType);
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
 
Example #14
Source File: HttpURLConnection.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
                        final String host,
                        final InetAddress addr,
                        final int port,
                        final String protocol,
                        final String prompt,
                        final String scheme,
                        final URL url,
                        final RequestorType authType) {
    return java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<PasswordAuthentication>() {
            public PasswordAuthentication run() {
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Requesting Authentication: host =" + host + " url = " + url);
                }
                PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                    host, addr, port, protocol,
                    prompt, scheme, url, authType);
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}
 
Example #15
Source File: NegotiateCallbackHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void getAnswer() {
    if (!answered) {
        answered = true;
        PasswordAuthentication passAuth =
                Authenticator.requestPasswordAuthentication(
                hci.host, hci.addr, hci.port, hci.protocol,
                hci.prompt, hci.scheme, hci.url, hci.authType);
        /**
         * To be compatible with existing callback handler implementations,
         * when the underlying Authenticator is canceled, username and
         * password are assigned null. No exception is thrown.
         */
        if (passAuth != null) {
            username = passAuth.getUserName();
            password = passAuth.getPassword();
        }
    }
}
 
Example #16
Source File: HttpAuthenticator.java    From phonegapbootcampsite with MIT License 6 votes vote down vote up
@Override public Credential authenticate(
    Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
  for (Challenge challenge : challenges) {
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
      continue;
    }

    PasswordAuthentication auth = Authenticator.requestPasswordAuthentication(url.getHost(),
        getConnectToInetAddress(proxy, url), url.getPort(), url.getProtocol(),
        challenge.getRealm(), challenge.getScheme(), url, Authenticator.RequestorType.SERVER);
    if (auth != null) {
      return Credential.basic(auth.getUserName(), new String(auth.getPassword()));
    }
  }
  return null;
}
 
Example #17
Source File: HttpAuthenticator.java    From reader with MIT License 6 votes vote down vote up
@Override public Credential authenticateProxy(
    Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
  for (Challenge challenge : challenges) {
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
      continue;
    }

    InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
    PasswordAuthentication auth = Authenticator.requestPasswordAuthentication(
        proxyAddress.getHostName(), getConnectToInetAddress(proxy, url), proxyAddress.getPort(),
        url.getProtocol(), challenge.getRealm(), challenge.getScheme(), url,
        Authenticator.RequestorType.PROXY);
    if (auth != null) {
      return Credential.basic(auth.getUserName(), new String(auth.getPassword()));
    }
  }
  return null;
}
 
Example #18
Source File: ProxyAuthenticatorTest.java    From che with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void shouldInitHttpsProxyAuthenticator() throws Exception {
  // when
  ProxyAuthenticator.initAuthenticator(HTTPS_URL);
  PasswordAuthentication testAuthentication =
      Authenticator.requestPasswordAuthentication(null, 0, null, null, null);

  // then
  assertEquals(testAuthentication.getUserName(), "user2");
  assertEquals(String.valueOf(testAuthentication.getPassword()), "paswd2");

  // when
  ProxyAuthenticator.resetAuthenticator();

  // then
  testAuthentication = Authenticator.requestPasswordAuthentication(null, 0, null, null, null);
  assertEquals(testAuthentication, null);
}
 
Example #19
Source File: Proxy.java    From ripme with MIT License 6 votes vote down vote up
/**
 * Set a Socks Proxy Server (globally).
 *
 * @param fullsocks the socks server, using format [user:password]@host[:port]
 */
public static void setSocks(String fullsocks) {

    Map<String, String> socksServer = parseServer(fullsocks);
    if (socksServer.get("user") != null && socksServer.get("password") != null) {
        Authenticator.setDefault(new Authenticator(){
            protected PasswordAuthentication  getPasswordAuthentication(){
                PasswordAuthentication p = new PasswordAuthentication(socksServer.get("user"), socksServer.get("password").toCharArray());
                return p;
            }
        });
        System.setProperty("java.net.socks.username", socksServer.get("user"));
        System.setProperty("java.net.socks.password", socksServer.get("password"));
    }
    if (socksServer.get("port") != null) {
        System.setProperty("socksProxyPort", socksServer.get("port"));
    }

    System.setProperty("socksProxyHost", socksServer.get("server"));
}
 
Example #20
Source File: TestResponse.java    From mangooio with Apache License 2.0 6 votes vote down vote up
/**
 * Sets Basic HTTP Authentication the request
 *
 * @param username The username
 * @param password The password
 * 
 * @return TestResponse instance
 */
public TestResponse withBasicAuthentication(String username, String password) {
    Objects.requireNonNull(username, Required.USERNAME.toString());
    Objects.requireNonNull(password, Required.PASSWORD.toString());

    this.authenticator = new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
          return new PasswordAuthentication(
            username, 
            password.toCharArray());
        }
    };
    
    return this;
}
 
Example #21
Source File: HttpAuthenticator.java    From IoTgo_Android_App with MIT License 6 votes vote down vote up
@Override public Credential authenticateProxy(
    Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
  for (Challenge challenge : challenges) {
    if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
      continue;
    }

    InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
    PasswordAuthentication auth = Authenticator.requestPasswordAuthentication(
        proxyAddress.getHostName(), getConnectToInetAddress(proxy, url), proxyAddress.getPort(),
        url.getProtocol(), challenge.getRealm(), challenge.getScheme(), url,
        Authenticator.RequestorType.PROXY);
    if (auth != null) {
      return Credential.basic(auth.getUserName(), new String(auth.getPassword()));
    }
  }
  return null;
}
 
Example #22
Source File: NegotiateCallbackHandler.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void getAnswer() {
    if (!answered) {
        answered = true;
        PasswordAuthentication passAuth =
                Authenticator.requestPasswordAuthentication(
                hci.host, hci.addr, hci.port, hci.protocol,
                hci.prompt, hci.scheme, hci.url, hci.authType);
        /**
         * To be compatible with existing callback handler implementations,
         * when the underlying Authenticator is canceled, username and
         * password are assigned null. No exception is thrown.
         */
        if (passAuth != null) {
            username = passAuth.getUserName();
            password = passAuth.getPassword();
        }
    }
}
 
Example #23
Source File: Proxy.java    From ripme with MIT License 6 votes vote down vote up
/**
 * Set a HTTP Proxy.
 * WARNING: Authenticated HTTP Proxy won't work from jdk1.8.111 unless
 * passing the flag -Djdk.http.auth.tunneling.disabledSchemes="" to java
 * see https://stackoverflow.com/q/41505219
 *
 * @param fullproxy the proxy, using format [user:password]@host[:port]
 */
public static void setHTTPProxy(String fullproxy) {
    Map<String, String> proxyServer = parseServer(fullproxy);

    if (proxyServer.get("user") != null && proxyServer.get("password") != null) {
        Authenticator.setDefault(new Authenticator(){
            protected PasswordAuthentication  getPasswordAuthentication(){
                PasswordAuthentication p = new PasswordAuthentication(proxyServer.get("user"), proxyServer.get("password").toCharArray());
                return p;
            }
        });
        System.setProperty("http.proxyUser", proxyServer.get("user"));
        System.setProperty("http.proxyPassword", proxyServer.get("password"));
        System.setProperty("https.proxyUser", proxyServer.get("user"));
        System.setProperty("https.proxyPassword", proxyServer.get("password"));
    }

    if (proxyServer.get("port") != null) {
        System.setProperty("http.proxyPort", proxyServer.get("port"));
        System.setProperty("https.proxyPort", proxyServer.get("port"));
    }

    System.setProperty("http.proxyHost", proxyServer.get("server"));
    System.setProperty("https.proxyHost", proxyServer.get("server"));
}
 
Example #24
Source File: HttpClientUnitTest.java    From tutorials with MIT License 6 votes vote down vote up
@Test
public void shouldReturnOKStatusForAuthenticatedAccess() throws URISyntaxException, IOException, InterruptedException {
    HttpRequest request = HttpRequest.newBuilder()
        .uri(new URI("https://postman-echo.com/basic-auth"))
        .GET()
        .build();
    HttpResponse<String> response = HttpClient.newBuilder()
        .authenticator(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication("postman", "password".toCharArray());
            }
        })
        .build()
        .send(request, HttpResponse.BodyHandlers.ofString());

    assertThat(response.statusCode(), equalTo(HttpURLConnection.HTTP_OK));
}
 
Example #25
Source File: HttpCallerInfo.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor an un-schemed object for site access.
 */
public HttpCallerInfo(URL url, Authenticator a) {
    this.url= url;
    prompt = "";
    host = url.getHost();

    int p = url.getPort();
    if (p == -1) {
        port = url.getDefaultPort();
    } else {
        port = p;
    }

    InetAddress ia;
    try {
        ia = InetAddress.getByName(url.getHost());
    } catch (Exception e) {
        ia = null;
    }
    addr = ia;

    protocol = url.getProtocol();
    authType = RequestorType.SERVER;
    scheme = "";
    authenticator = a;
}
 
Example #26
Source File: Http2Client.java    From jiguang-java-client-common with MIT License 6 votes vote down vote up
public Http2Client(String authCode, HttpProxy proxy, ClientConfig config) {
    _maxRetryTimes = config.getMaxRetryTimes();
    _connectionTimeout = config.getConnectionTimeout();
    _readTimeout = config.getReadTimeout();
    _sslVer = config.getSSLVersion();

    _authCode = authCode;
    _proxy = proxy;
    _encryptType = config.getEncryptType();
    String message = MessageFormat.format("Created instance with "
                    + "connectionTimeout {0}, readTimeout {1}, maxRetryTimes {2}, SSL Version {3}",
            _connectionTimeout, _readTimeout, _maxRetryTimes, _sslVer);
    LOG.info(message);

    if (null != _proxy && _proxy.isAuthenticationNeeded()) {
        Authenticator.setDefault(new NativeHttpClient.SimpleProxyAuthenticator(
                _proxy.getUsername(), _proxy.getPassword()));
    }
}
 
Example #27
Source File: HttpProxy.java    From onetwo with Apache License 2.0 6 votes vote down vote up
public Authenticator getAuthenticator() {
	if (this.authenticator == null && StringUtils.isNotBlank(user) && StringUtils.isNotBlank(password)) {
		this.authenticator = new Authenticator() {

			@Override
			protected PasswordAuthentication getPasswordAuthentication() {
				if (this.getRequestorType().equals(RequestorType.PROXY))
					return new PasswordAuthentication(user, password.toCharArray());
				else
					return null;
			}

		};
	}
	return authenticator;
}
 
Example #28
Source File: SocksSocketFactory.java    From elasticsearch-hadoop with Apache License 2.0 5 votes vote down vote up
SocksSocketFactory(String socksHost, int socksPort, final String user, final String pass) {
    this.socksHost = socksHost;
    this.socksPort = socksPort;

    if (StringUtils.hasText(user)) {
        final PasswordAuthentication auth = new PasswordAuthentication(user, pass.toCharArray());

        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return auth;
            }
        });
    }
}
 
Example #29
Source File: BasicLongCredentials.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main (String[] args) throws Exception {
    HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
    try {
        Handler handler = new Handler();
        HttpContext ctx = server.createContext("/test", handler);

        BasicAuthenticator a = new BasicAuthenticator(REALM) {
            public boolean checkCredentials (String username, String pw) {
                return USERNAME.equals(username) && PASSWORD.equals(pw);
            }
        };
        ctx.setAuthenticator(a);
        server.start();

        Authenticator.setDefault(new MyAuthenticator());

        URL url = new URL("http://localhost:"+server.getAddress().getPort()+"/test/");
        HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
        InputStream is = urlc.getInputStream();
        int c = 0;
        while (is.read()!= -1) { c ++; }

        if (c != 0) { throw new RuntimeException("Test failed c = " + c); }
        if (error) { throw new RuntimeException("Test failed: error"); }

        System.out.println ("OK");
    } finally {
        server.stop(0);
    }
}
 
Example #30
Source File: HttpURLConnection.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static PasswordAuthentication
privilegedRequestPasswordAuthentication(
                        final Authenticator authenticator,
                        final String host,
                        final InetAddress addr,
                        final int port,
                        final String protocol,
                        final String prompt,
                        final String scheme,
                        final URL url,
                        final RequestorType authType) {
    return java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction<>() {
            public PasswordAuthentication run() {
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Requesting Authentication: host =" + host + " url = " + url);
                }
                PasswordAuthentication pass = Authenticator.requestPasswordAuthentication(
                    authenticator, host, addr, port, protocol,
                    prompt, scheme, url, authType);
                if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
                    logger.finest("Authentication returned: " + (pass != null ? pass.toString() : "null"));
                }
                return pass;
            }
        });
}