Search in sources :

Example 1 with TCancelDelegationTokenResp

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

the class ThriftCLIService method CancelDelegationToken.

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

Example 2 with TCancelDelegationTokenResp

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

the class ThriftCLIServiceClient method cancelDelegationToken.

@Override
public void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
    TCancelDelegationTokenReq cancelReq = new TCancelDelegationTokenReq(sessionHandle.toTSessionHandle(), tokenStr);
    try {
        TCancelDelegationTokenResp cancelResp = cliService.CancelDelegationToken(cancelReq);
        checkStatus(cancelResp.getStatus());
        return;
    } catch (TException e) {
        throw new HiveSQLException(e);
    }
}
Also used : TException(org.apache.thrift.TException) HiveSQLException(org.apache.hive.service.cli.HiveSQLException) TCancelDelegationTokenReq(org.apache.hive.service.rpc.thrift.TCancelDelegationTokenReq) TCancelDelegationTokenResp(org.apache.hive.service.rpc.thrift.TCancelDelegationTokenResp)

Example 3 with TCancelDelegationTokenResp

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

the class HiveConnection method cancelDelegationToken.

public void cancelDelegationToken(String tokenStr) throws SQLException {
    TCancelDelegationTokenReq cancelReq = new TCancelDelegationTokenReq(sessHandle, tokenStr);
    try {
        TCancelDelegationTokenResp cancelResp = client.CancelDelegationToken(cancelReq);
        Utils.verifySuccess(cancelResp.getStatus());
        return;
    } catch (TException e) {
        throw new SQLException("Could not cancel token: " + e.getMessage(), " 08S01", e);
    }
}
Also used : TException(org.apache.thrift.TException) SQLException(java.sql.SQLException) TCancelDelegationTokenReq(org.apache.hive.service.rpc.thrift.TCancelDelegationTokenReq) TCancelDelegationTokenResp(org.apache.hive.service.rpc.thrift.TCancelDelegationTokenResp)

Aggregations

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