if (gssManager == null) {
gssManager = GSSManager.getInstance();
}
}
GSSName clientName = gssManager.createName(
clientPrincipal.getName(), KerberosUtil.krb5NameType);
GSSCredential clientCred = gssManager.createCredential(
clientName, GSSCredential.INDEFINITE_LIFETIME,
KerberosUtil.krb5MechOid, GSSCredential.INITIATE_ONLY);
GSSName serverName = gssManager.createName(
serverPrincipal.getName(), KerberosUtil.krb5NameType);
for (int i = maxGssContextRetries; i > 0; i--) {
gssContext = gssManager.createContext(
serverName, KerberosUtil.krb5MechOid, clientCred,