hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1724852 - /httpcomponents/httpclient/branches/4.5.x/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
Date Fri, 15 Jan 2016 16:38:08 GMT
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);
                 }



Mime
View raw message