You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2016/01/15 17:38:08 UTC
svn commit: r1724852 -
/httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
Author: olegk
Date: Fri Jan 15 16:38:07 2016
New Revision: 1724852
URL: http://svn.apache.org/viewvc?rev=1724852&view=rev
Log:
HTTPCLIENT-1712: SPNego schemes to take service scheme into account when generating auth token
Contributed by Georg Romstorfer <georg.romstorfer at gmail.com>
Modified:
httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
Modified: httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java?rev=1724852&r1=1724851&r2=1724852&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java (original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java Fri Jan 15 16:38:07 2016
@@ -28,6 +28,7 @@ package org.apache.http.impl.auth;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.util.Locale;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.logging.Log;
@@ -79,6 +80,7 @@ public abstract class GGSSchemeBase exte
/** base64 decoded challenge **/
private byte[] token;
+ private String service;
GGSSchemeBase(final boolean stripPort, final boolean useCanonicalHostname) {
super();
@@ -116,7 +118,7 @@ public abstract class GGSSchemeBase exte
inputBuff = new byte[0];
}
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;
if (credentials instanceof KerberosCredentials) {
@@ -212,6 +214,8 @@ public abstract class GGSSchemeBase exte
authServer = hostname + ":" + host.getPort();
}
+ service = host.getSchemeName().toUpperCase(Locale.ROOT);
+
if (log.isDebugEnabled()) {
log.debug("init " + authServer);
}