use of io.questdb.std.ex.KerberosException in project questdb by bluestreak01.
the class Os method generateKerberosToken.
public static byte[] generateKerberosToken(CharSequence spn) throws KerberosException {
try (CharSequenceZ cs = new CharSequenceZ(spn)) {
final long struct = generateKrbToken(cs.address());
int status = Unsafe.getUnsafe().getInt(struct);
int bufLen = Unsafe.getUnsafe().getInt(struct + 4);
long ptoken = Unsafe.getUnsafe().getLong(struct + 8);
if (status != 0) {
freeKrbToken(struct);
throw new KerberosException(status);
}
byte[] token = new byte[bufLen];
for (int i = 0; i < bufLen; i++) {
token[i] = Unsafe.getUnsafe().getByte(ptoken + i);
}
freeKrbToken(struct);
return token;
}
}
Aggregations