"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java" between
httpcomponents-client-4.5.6-src.tar.gz and httpcomponents-client-4.5.7-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

SystemDefaultCredentialsProvider.java  (httpcomponents-client-4.5.6-src):SystemDefaultCredentialsProvider.java  (httpcomponents-client-4.5.7-src)
skipping to change at line 120 skipping to change at line 120
} }
final String host = authscope.getHost(); final String host = authscope.getHost();
if (host != null) { if (host != null) {
final HttpHost origin = authscope.getOrigin(); final HttpHost origin = authscope.getOrigin();
final String protocol = origin != null ? origin.getSchemeName() : (a uthscope.getPort() == 443 ? "https" : "http"); final String protocol = origin != null ? origin.getSchemeName() : (a uthscope.getPort() == 443 ? "https" : "http");
PasswordAuthentication systemcreds = getSystemCreds(protocol, authsc ope, Authenticator.RequestorType.SERVER); PasswordAuthentication systemcreds = getSystemCreds(protocol, authsc ope, Authenticator.RequestorType.SERVER);
if (systemcreds == null) { if (systemcreds == null) {
systemcreds = getSystemCreds(protocol, authscope, Authenticator. RequestorType.PROXY); systemcreds = getSystemCreds(protocol, authscope, Authenticator. RequestorType.PROXY);
} }
if (systemcreds == null) { if (systemcreds == null) {
final String proxyHost = System.getProperty(protocol + ".proxyHo // Look for values given using http.proxyUser/http.proxyPassword
st"); or
if (proxyHost != null) { // https.proxyUser/https.proxyPassword. We cannot simply use the
final String proxyPort = System.getProperty(protocol + ".pro protocol from
xyPort"); // the origin since a proxy retrieved from https.proxyHost/https
if (proxyPort != null) { .proxyPort will
try { // still use http as protocol
final AuthScope systemScope = new AuthScope(proxyHos systemcreds = getProxyCredentials("http", authscope);
t, Integer.parseInt(proxyPort)); if (systemcreds == null) {
if (authscope.match(systemScope) >= 0) { systemcreds = getProxyCredentials("https", authscope);
final String proxyUser = System.getProperty(prot
ocol + ".proxyUser");
if (proxyUser != null) {
final String proxyPassword = System.getPrope
rty(protocol + ".proxyPassword");
systemcreds = new PasswordAuthentication(pro
xyUser, proxyPassword != null ? proxyPassword.toCharArray() : new char[] {});
}
}
} catch (final NumberFormatException ex) {
}
}
} }
} }
if (systemcreds != null) { if (systemcreds != null) {
final String domain = System.getProperty("http.auth.ntlm.domain" ); final String domain = System.getProperty("http.auth.ntlm.domain" );
if (domain != null) { if (domain != null) {
return new NTCredentials( return new NTCredentials(
systemcreds.getUserName(), systemcreds.getUserName(),
new String(systemcreds.getPassword()), new String(systemcreds.getPassword()),
null, domain); null, domain);
} else {
if (AuthSchemes.NTLM.equalsIgnoreCase(authscope.getScheme())
) {
// Domain may be specified in a fully qualified user nam
e
return new NTCredentials(
systemcreds.getUserName(),
new String(systemcreds.getPassword()),
null, null);
} else {
return new UsernamePasswordCredentials(
systemcreds.getUserName(),
new String(systemcreds.getPassword()));
}
} }
return AuthSchemes.NTLM.equalsIgnoreCase(authscope.getScheme())
// Domain may be specified in a fully qualified
user name
? new NTCredentials(systemcreds.getUserName(),
new String(systemcreds.getPasswo
rd()), null, null)
: new UsernamePasswordCredentials(systemcreds.ge
tUserName(),
new String(systemcreds.getPasswo
rd()));
} }
} }
return null; return null;
} }
private static PasswordAuthentication getProxyCredentials(final String proto
col, final AuthScope authscope) {
final String proxyHost = System.getProperty(protocol + ".proxyHost");
if (proxyHost == null) {
return null;
}
final String proxyPort = System.getProperty(protocol + ".proxyPort");
if (proxyPort == null) {
return null;
}
try {
final AuthScope systemScope = new AuthScope(proxyHost, Integer.parse
Int(proxyPort));
if (authscope.match(systemScope) >= 0) {
final String proxyUser = System.getProperty(protocol + ".proxyUs
er");
if (proxyUser == null) {
return null;
}
final String proxyPassword = System.getProperty(protocol + ".pro
xyPassword");
return new PasswordAuthentication(proxyUser,
proxyPassword != null ? proxyPassword.toCharArray() : ne
w char[] {});
}
} catch (final NumberFormatException ex) {
}
return null;
}
@Override @Override
public void clear() { public void clear() {
internal.clear(); internal.clear();
} }
} }
 End of changes. 4 change blocks. 
36 lines changed or deleted 53 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)