org.apache.hadoop.mapreduce.v2.api.protocolrecords.RenewDelegationTokenRequest Java Examples

The following examples show how to use org.apache.hadoop.mapreduce.v2.api.protocolrecords.RenewDelegationTokenRequest. 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 File: MRDelegationTokenRenewer.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public long renew(Token<?> token, Configuration conf) throws IOException,
    InterruptedException {

  org.apache.hadoop.yarn.api.records.Token dToken =
      org.apache.hadoop.yarn.api.records.Token.newInstance(
        token.getIdentifier(), token.getKind().toString(),
        token.getPassword(), token.getService().toString());

  MRClientProtocol histProxy = instantiateHistoryProxy(conf,
      SecurityUtil.getTokenServiceAddr(token));
  try {
    RenewDelegationTokenRequest request = Records
        .newRecord(RenewDelegationTokenRequest.class);
    request.setDelegationToken(dToken);
    return histProxy.renewDelegationToken(request).getNextExpirationTime();
  } finally {
    stopHistoryProxy(histProxy);
  }

}
 
Example #2
Source File: HistoryClientService.java    From big-c with 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 File: HistoryClientService.java    From hadoop with 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 #4
Source File: MRDelegationTokenRenewer.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public long renew(Token<?> token, Configuration conf) throws IOException,
    InterruptedException {

  org.apache.hadoop.yarn.api.records.Token dToken =
      org.apache.hadoop.yarn.api.records.Token.newInstance(
        token.getIdentifier(), token.getKind().toString(),
        token.getPassword(), token.getService().toString());

  MRClientProtocol histProxy = instantiateHistoryProxy(conf,
      SecurityUtil.getTokenServiceAddr(token));
  try {
    RenewDelegationTokenRequest request = Records
        .newRecord(RenewDelegationTokenRequest.class);
    request.setDelegationToken(dToken);
    return histProxy.renewDelegationToken(request).getNextExpirationTime();
  } finally {
    stopHistoryProxy(histProxy);
  }

}
 
Example #5
Source File: TestJHSSecurity.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private long renewDelegationToken(final UserGroupInformation loggedInUser,
    final MRClientProtocol hsService, final Token dToken)
    throws IOException, InterruptedException {
  long nextExpTime = loggedInUser.doAs(new PrivilegedExceptionAction<Long>() {

    @Override
    public Long run() throws IOException {
      RenewDelegationTokenRequest request = Records
          .newRecord(RenewDelegationTokenRequest.class);
      request.setDelegationToken(dToken);
      return hsService.renewDelegationToken(request).getNextExpirationTime();
    }
  });
  return nextExpTime;
}
 
Example #6
Source File: MRClientProtocolPBClientImpl.java    From hadoop with 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 File: MRClientProtocolPBClientImpl.java    From big-c with 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 #8
Source File: TestJHSSecurity.java    From big-c with Apache License 2.0 5 votes vote down vote up
private long renewDelegationToken(final UserGroupInformation loggedInUser,
    final MRClientProtocol hsService, final Token dToken)
    throws IOException, InterruptedException {
  long nextExpTime = loggedInUser.doAs(new PrivilegedExceptionAction<Long>() {

    @Override
    public Long run() throws IOException {
      RenewDelegationTokenRequest request = Records
          .newRecord(RenewDelegationTokenRequest.class);
      request.setDelegationToken(dToken);
      return hsService.renewDelegationToken(request).getNextExpirationTime();
    }
  });
  return nextExpTime;
}
 
Example #9
Source File: NotRunningJob.java    From big-c with 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 #10
Source File: NotRunningJob.java    From tez with 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 #11
Source File: NotRunningJob.java    From incubator-tez with 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 File: TestRPCFactories.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  return null;
}
 
Example #13
Source File: MRClientService.java    From hadoop with 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 #14
Source File: MRClientService.java    From big-c with 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 #15
Source File: TestRPCFactories.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
  return null;
}
 
Example #16
Source File: NotRunningJob.java    From hadoop with 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 #17
Source File: MRClientProtocol.java    From big-c with 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 #18
Source File: MRClientProtocol.java    From hadoop with 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;