Java Code Examples for org.apache.hadoop.mapreduce.v2.api.protocolrecords.RenewDelegationTokenResponse

The following examples show how to use org.apache.hadoop.mapreduce.v2.api.protocolrecords.RenewDelegationTokenResponse. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   Source File: HistoryClientService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
    if (!isAllowedDelegationTokenOp()) {
      throw new IOException(
          "Delegation Token can be renewed only with kerberos authentication");
    }

    org.apache.hadoop.yarn.api.records.Token protoToken = request.getDelegationToken();
    Token<MRDelegationTokenIdentifier> token =
        new Token<MRDelegationTokenIdentifier>(
            protoToken.getIdentifier().array(), protoToken.getPassword()
                .array(), new Text(protoToken.getKind()), new Text(
                protoToken.getService()));

    String user = UserGroupInformation.getCurrentUser().getShortUserName();
    long nextExpTime = jhsDTSecretManager.renewToken(token, user);
    RenewDelegationTokenResponse renewResponse = Records
        .newRecord(RenewDelegationTokenResponse.class);
    renewResponse.setNextExpirationTime(nextExpTime);
    return renewResponse;
}
 
Example 2
Source Project: big-c   Source File: HistoryClientService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
    if (!isAllowedDelegationTokenOp()) {
      throw new IOException(
          "Delegation Token can be renewed only with kerberos authentication");
    }

    org.apache.hadoop.yarn.api.records.Token protoToken = request.getDelegationToken();
    Token<MRDelegationTokenIdentifier> token =
        new Token<MRDelegationTokenIdentifier>(
            protoToken.getIdentifier().array(), protoToken.getPassword()
                .array(), new Text(protoToken.getKind()), new Text(
                protoToken.getService()));

    String user = UserGroupInformation.getCurrentUser().getShortUserName();
    long nextExpTime = jhsDTSecretManager.renewToken(token, user);
    RenewDelegationTokenResponse renewResponse = Records
        .newRecord(RenewDelegationTokenResponse.class);
    renewResponse.setNextExpirationTime(nextExpTime);
    return renewResponse;
}
 
Example 3
Source Project: hadoop   Source File: MRClientProtocolPBServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public RenewDelegationTokenResponseProto renewDelegationToken(
    RpcController controller, RenewDelegationTokenRequestProto proto)
    throws ServiceException {
  RenewDelegationTokenRequestPBImpl request =
      new RenewDelegationTokenRequestPBImpl(proto);
    try {
      RenewDelegationTokenResponse response = real.renewDelegationToken(request);
      return ((RenewDelegationTokenResponsePBImpl)response).getProto();
    } catch (IOException e) {
      throw new ServiceException(e);
    }
}
 
Example 4
Source Project: hadoop   Source File: MRClientProtocolPBClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  RenewDelegationTokenRequestProto requestProto = 
      ((RenewDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new RenewDelegationTokenResponsePBImpl(proxy.renewDelegationToken(
        null, requestProto));
  } catch (ServiceException e) {
    throw unwrapAndThrowException(e);
  }
}
 
Example 5
Source Project: big-c   Source File: MRClientProtocolPBServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public RenewDelegationTokenResponseProto renewDelegationToken(
    RpcController controller, RenewDelegationTokenRequestProto proto)
    throws ServiceException {
  RenewDelegationTokenRequestPBImpl request =
      new RenewDelegationTokenRequestPBImpl(proto);
    try {
      RenewDelegationTokenResponse response = real.renewDelegationToken(request);
      return ((RenewDelegationTokenResponsePBImpl)response).getProto();
    } catch (IOException e) {
      throw new ServiceException(e);
    }
}
 
Example 6
Source Project: big-c   Source File: MRClientProtocolPBClientImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  RenewDelegationTokenRequestProto requestProto = 
      ((RenewDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new RenewDelegationTokenResponsePBImpl(proxy.renewDelegationToken(
        null, requestProto));
  } catch (ServiceException e) {
    throw unwrapAndThrowException(e);
  }
}
 
Example 7
Source Project: hadoop   Source File: MRClientService.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  throw new IOException("MR AM not authorized to renew delegation" +
      " token");
}
 
Example 8
Source Project: hadoop   Source File: NotRunningJob.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  /* Should not be invoked by anyone. */
  throw new NotImplementedException();
}
 
Example 9
Source Project: hadoop   Source File: TestRPCFactories.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  return null;
}
 
Example 10
Source Project: big-c   Source File: MRClientService.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  throw new IOException("MR AM not authorized to renew delegation" +
      " token");
}
 
Example 11
Source Project: big-c   Source File: NotRunningJob.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  /* Should not be invoked by anyone. */
  throw new NotImplementedException();
}
 
Example 12
Source Project: big-c   Source File: TestRPCFactories.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  return null;
}
 
Example 13
Source Project: incubator-tez   Source File: NotRunningJob.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  /* Should not be invoked by anyone. */
  throw new NotImplementedException();
}
 
Example 14
Source Project: tez   Source File: NotRunningJob.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  /* Should not be invoked by anyone. */
  throw new NotImplementedException();
}
 
Example 15
Source Project: hadoop   Source File: MRClientProtocol.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Renew an existing delegation token.
 * 
 * @param request the delegation token to be renewed.
 * @return the new expiry time for the delegation token.
 * @throws IOException
 */
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException;
 
Example 16
Source Project: big-c   Source File: MRClientProtocol.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Renew an existing delegation token.
 * 
 * @param request the delegation token to be renewed.
 * @return the new expiry time for the delegation token.
 * @throws IOException
 */
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException;