PasswordAuthentication () { String siteStr = getRequestingSite() == null ? null : getRequestingSite().toString(); LOG.debug("CommonAuthenticator.getPasswordAuthentication called for " + siteStr); String host = getHostNameReliably(getRequestingHost(), getRequestingSite(), getRequestingURL()); int port = getRequestingPort(); final Map<String, NonStaticAuthenticator> copy; synchronized (myLock) { // for hosts defined as no proxy we will NOT pass authentication to not provoke credentials HostInfo hostInfo = new HostInfo(getRequestingProtocol(), host, port); Pair<HostInfo, Thread> pair = new Pair<>(hostInfo, Thread.currentThread()); if (myNoProxy.contains(pair)) { LOG.debug("CommonAuthenticator.getPasswordAuthentication found host in no proxies set (" + siteStr + ")"); return null; } copy = Map.copyOf(myCustomAuth); } if (!copy.isEmpty()) { for (Map.Entry<String, NonStaticAuthenticator> entry : copy.entrySet()) { final NonStaticAuthenticator authenticator = entry.getValue(); prepareAuthenticator(authenticator); final PasswordAuthentication authentication = authenticator.getPasswordAuthentication(); if (authentication != null) { LOG.debug("CommonAuthenticator.getPasswordAuthentication found custom authenticator for " + siteStr + ", " + entry.getKey() + ", " + authenticator); logAuthentication(authentication); return authentication; } } } return null; }