Credentials result = matchCredentials(this.cachedCredentials, authscope);
// If we have a match, return credentials
if (result != null)
return result;
// If we don't have a match, first get ECF proxy, if any
Proxy proxy = getECFProxy();
if (proxy == null)
return null;
// Make sure that authscope and proxy host and port match
if (!matchAuthScopeAndProxy(authscope, proxy))
return null;
// Then match scheme, and get credentials from proxy (if it's scheme we know about)
Credentials credentials = null;
if ("ntlm".equalsIgnoreCase(authscope.getScheme())) { //$NON-NLS-1$
credentials = getNTLMCredentials(proxy);
} else if ("basic".equalsIgnoreCase(authscope.getScheme()) || //$NON-NLS-1$
"digest".equalsIgnoreCase(authscope.getScheme())) { //$NON-NLS-1$
final String proxyUsername = proxy.getUsername();
final String proxyPassword = proxy.getPassword();
// If credentials present for proxy then we're done
if (proxyUsername != null) {
credentials = new UsernamePasswordCredentials(proxyUsername, proxyPassword);
}
} else if ("negotiate".equalsIgnoreCase(authscope.getScheme())) { //$NON-NLS-1$