}
// retrieve delegation token for the given user
public String getDelegationToken(String owner, String renewer) throws HiveSQLException {
if (saslServer == null) {
throw new HiveSQLException(
"Delegation token only supported over kerberos authentication");
}
try {
String tokenStr = saslServer.getDelegationTokenWithService(owner, renewer, HS2_CLIENT_TOKEN);
if (tokenStr == null || tokenStr.isEmpty()) {
throw new HiveSQLException("Received empty retrieving delegation token for user " + owner);
}
return tokenStr;
} catch (IOException e) {
throw new HiveSQLException("Error retrieving delegation token for user " + owner, e);
} catch (InterruptedException e) {
throw new HiveSQLException("delegation token retrieval interrupted", e);
}
}