Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
4.1 Final
-
None
Description
Cross realm authentication doesn't work because of incomplete server SPN passed into GSS-API.
Class Name: NegotiateScheme
Line # 205 (GSSName serverName = manager.createName("HTTP/" + authServer, null)
This piece of code doesn't append the server realm while creating name. Because of null server realm, jdk always append default realm by reading krb5.conf file. but there can be case where server realm is different than default realm configured in krb5.conf file.
Modified code:
----------------------------------------------------------------------------------------------------------------------------------------
String strServerName = Krb5Utility.mapDomainToRealm(authServer);
strServerName = strServerName == null ? "" : ("@" + strServerName);
GSSName serverName = manager.createName("HTTP/" + authServer + strServerName, null);
----------------------------------------------------------------------------------------------------------------------------------------
Krb5Utility.mapDomainToRealm method code
----------------------------------------------------------------------------------------------------------------------------------------
public static String mapDomainToRealm(String name) {
String result = null;
try {
String subname = null;
Config c = Config.getInstance();
if ((result = c.getDefault(name, "domain_realm")) != null)
return result;
else {
for (int i = 1; i < name.length(); i++) {
// mapping could be .ibm.com = AUSTIN.IBM.COM
if ((name.charAt == '.') && (i != name.length() - 1)) {
subname = name.substring;
result = c.getDefault(subname, "domain_realm");
if (result != null)
else {
// or mapping could be ibm.com = AUSTIN.IBM.COM
subname = name.substring(i + 1);
result = c.getDefault(subname, "domain_realm");
if (result != null)
}
}
}
}
} catch (KrbException e) {
}
return result;
}
----------------------------------------------------------------------------------------------------------------------------------------