HTTPCLIENT-1712: SPNego schemes to take service scheme into account when generating auth token
Contributed by Georg Romstorfer <georg.romstorfer at gmail.com> git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1724852 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b781fa8e03
commit
1d50c1a1a1
|
@ -28,6 +28,7 @@ package org.apache.http.impl.auth;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -79,6 +80,7 @@ public abstract class GGSSchemeBase extends AuthSchemeBase {
|
||||||
|
|
||||||
/** base64 decoded challenge **/
|
/** base64 decoded challenge **/
|
||||||
private byte[] token;
|
private byte[] token;
|
||||||
|
private String service;
|
||||||
|
|
||||||
GGSSchemeBase(final boolean stripPort, final boolean useCanonicalHostname) {
|
GGSSchemeBase(final boolean stripPort, final boolean useCanonicalHostname) {
|
||||||
super();
|
super();
|
||||||
|
@ -116,7 +118,7 @@ public abstract class GGSSchemeBase extends AuthSchemeBase {
|
||||||
inputBuff = new byte[0];
|
inputBuff = new byte[0];
|
||||||
}
|
}
|
||||||
final GSSManager manager = getManager();
|
final GSSManager manager = getManager();
|
||||||
final GSSName serverName = manager.createName("HTTP@" + authServer, GSSName.NT_HOSTBASED_SERVICE);
|
final GSSName serverName = manager.createName(service + "@" + authServer, GSSName.NT_HOSTBASED_SERVICE);
|
||||||
|
|
||||||
final GSSCredential gssCredential;
|
final GSSCredential gssCredential;
|
||||||
if (credentials instanceof KerberosCredentials) {
|
if (credentials instanceof KerberosCredentials) {
|
||||||
|
@ -212,6 +214,8 @@ public abstract class GGSSchemeBase extends AuthSchemeBase {
|
||||||
authServer = hostname + ":" + host.getPort();
|
authServer = hostname + ":" + host.getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service = host.getSchemeName().toUpperCase(Locale.ROOT);
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("init " + authServer);
|
log.debug("init " + authServer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue