this.serviceName = serviceName;
}
public byte[] run() {
try {
GSSManager gssManager = GSSManager.getInstance();
Oid kerberos5Oid = new Oid("1.2.840.113554.1.2.2");
GSSName gssClient = gssManager.createName(clientPrincipal.getName(), GSSName.NT_USER_NAME);
GSSCredential credentials =
gssManager.createCredential(
gssClient, GSSCredential.DEFAULT_LIFETIME, kerberos5Oid, GSSCredential.INITIATE_ONLY
);
GSSName gssService = gssManager.createName(serviceName, GSSName.NT_HOSTBASED_SERVICE);
GSSContext secContext =
gssManager.createContext(
gssService, kerberos5Oid, credentials, GSSContext.DEFAULT_LIFETIME
);
secContext.requestMutualAuth(false);
byte[] token = new byte[0];