--- GGSSchemeBase.java 2016-01-14 14:35:26.226684157 +0100 +++ GGSSchemeBase_new.java 2016-01-14 14:43:11.694667943 +0100 @@ -28,6 +28,7 @@ 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; @@ -80,6 +81,9 @@ /** base64 decoded challenge **/ private byte[] token; + /** the service name to authenticate to */ + private String service; + GGSSchemeBase(final boolean stripPort, final boolean useCanonicalHostname) { super(); this.base64codec = new Base64(0); @@ -116,7 +120,7 @@ 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) { @@ -215,6 +219,9 @@ if (log.isDebugEnabled()) { log.debug("init " + authServer); } + + service = host.getSchemeName().toUpperCase(Locale.ROOT); + token = generateToken(token, authServer, credentials); state = State.TOKEN_GENERATED; } catch (final GSSException gsse) {