Search in sources :

Example 1 with TRenewDelegationTokenResp

use of org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp in project hive by apache.

the class ThriftCLIService method RenewDelegationToken.

@Override
public TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req) throws TException {
    TRenewDelegationTokenResp resp = new TRenewDelegationTokenResp();
    if (hiveAuthFactory == null || !hiveAuthFactory.isSASLKerberosUser()) {
        resp.setStatus(unsecureTokenErrorStatus());
    } else {
        try {
            cliService.renewDelegationToken(new SessionHandle(req.getSessionHandle()), hiveAuthFactory, req.getDelegationToken());
            resp.setStatus(OK_STATUS);
        } catch (HiveSQLException e) {
            LOG.error("Error obtaining renewing token", e);
            resp.setStatus(HiveSQLException.toTStatus(e));
        }
    }
    return resp;
}
Also used : TRenewDelegationTokenResp(org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) SessionHandle(org.apache.hive.service.cli.SessionHandle)

Example 2 with TRenewDelegationTokenResp

use of org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp in project hive by apache.

the class HiveConnection method renewDelegationToken.

public void renewDelegationToken(String tokenStr) throws SQLException {
    TRenewDelegationTokenReq cancelReq = new TRenewDelegationTokenReq(sessHandle, tokenStr);
    try {
        TRenewDelegationTokenResp renewResp = client.RenewDelegationToken(cancelReq);
        Utils.verifySuccess(renewResp.getStatus());
        return;
    } catch (TException e) {
        throw new SQLException("Could not renew token: " + e.getMessage(), " 08S01", e);
    }
}
Also used : TException(org.apache.thrift.TException) SQLException(java.sql.SQLException) TRenewDelegationTokenResp(org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp) TRenewDelegationTokenReq(org.apache.hive.service.rpc.thrift.TRenewDelegationTokenReq)

Example 3 with TRenewDelegationTokenResp

use of org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp in project hive by apache.

the class ThriftCLIServiceClient method renewDelegationToken.

@Override
public void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
    TRenewDelegationTokenReq cancelReq = new TRenewDelegationTokenReq(sessionHandle.toTSessionHandle(), tokenStr);
    try {
        TRenewDelegationTokenResp renewResp = cliService.RenewDelegationToken(cancelReq);
        checkStatus(renewResp.getStatus());
        return;
    } catch (Exception e) {
        throw new HiveSQLException(e);
    }
}
Also used : TRenewDelegationTokenResp(org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TRenewDelegationTokenReq(org.apache.hive.service.rpc.thrift.TRenewDelegationTokenReq) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TException(org.apache.thrift.TException)

Aggregations

TRenewDelegationTokenResp (org.apache.hive.service.rpc.thrift.TRenewDelegationTokenResp)3 HiveSQLException (org.apache.hive.service.cli.HiveSQLException)2 TRenewDelegationTokenReq (org.apache.hive.service.rpc.thrift.TRenewDelegationTokenReq)2 TException (org.apache.thrift.TException)2 SQLException (java.sql.SQLException)1 SessionHandle (org.apache.hive.service.cli.SessionHandle)1