HTTPCLIENT-1056: Fixed bug causing the RequestAuthCache protocol interceptor to generate an invalid AuthScope instance when looking up user credentials for preemptive authentication
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1068881 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7302f4b7a3
commit
f4ef817d25
|
@ -1,5 +1,9 @@
|
|||
Changes since 4.1
|
||||
|
||||
* [HTTPCLIENT-1056] Fixed bug causing the RequestAuthCache protocol interceptor to generate
|
||||
an invalid AuthScope instance when looking up user credentials for preemptive authentication.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
||||
* [HTTPCLIENT-1053] Fixed the way DigestScheme generates nonce-count values.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ package org.apache.http.auth;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.annotation.Immutable;
|
||||
|
||||
import org.apache.http.util.LangUtils;
|
||||
|
@ -109,6 +110,20 @@ public class AuthScope {
|
|||
this.scheme = (scheme == null) ? ANY_SCHEME: scheme.toUpperCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
public AuthScope(final HttpHost host, final String realm, final String schemeName) {
|
||||
this(host.getHostName(), host.getPort(), realm, schemeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
public AuthScope(final HttpHost host) {
|
||||
this(host, ANY_REALM, ANY_SCHEME);
|
||||
}
|
||||
|
||||
/** Creates a new credentials scope for the given
|
||||
* <tt>host</tt>, <tt>port</tt>, <tt>realm</tt>, and any
|
||||
* authentication scheme.
|
||||
|
|
|
@ -116,7 +116,7 @@ public class RequestAuthCache implements HttpRequestInterceptor {
|
|||
}
|
||||
|
||||
Credentials creds = credsProvider.getCredentials(
|
||||
new AuthScope(host.getHostName(), host.getPort(), schemeName));
|
||||
new AuthScope(host, AuthScope.ANY_REALM, schemeName));
|
||||
|
||||
if (creds != null) {
|
||||
authState.setAuthScheme(authScheme);
|
||||
|
|
Loading…
Reference in New Issue