org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequestProto Java Examples

The following examples show how to use org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequestProto. 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: TestOMGetDelegationTokenRequest.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
private void setupRequest() {
  GetDelegationTokenRequestProto getDelegationTokenRequestProto =
      GetDelegationTokenRequestProto.newBuilder()
      .setRenewer(identifier.getRenewer().toString())
      .build();

  originalRequest = OMRequest.newBuilder()
      .setClientId(UUID.randomUUID().toString())
      .setCmdType(Type.GetDelegationToken)
      .setGetDelegationTokenRequest(getDelegationTokenRequestProto)
      .build();

  omGetDelegationTokenRequest =
      new OMGetDelegationTokenRequest(originalRequest);

  modifiedRequest = null;
}
 
Example #2
Source File: TestOMGetDelegationTokenResponse.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
@Before
public void setupGetDelegationToken() {
  Text tester = new Text("tester");
  identifier = new OzoneTokenIdentifier(tester, tester, tester);
  identifier.setOmCertSerialId("certID");

  GetDelegationTokenRequestProto getDelegationTokenRequestProto =
      GetDelegationTokenRequestProto.newBuilder()
      .setRenewer(identifier.getRenewer().toString())
      .build();

  OMRequest omRequest = OMRequest.newBuilder()
      .setClientId(UUID.randomUUID().toString())
      .setCmdType(Type.GetDelegationToken)
      .setGetDelegationTokenRequest(getDelegationTokenRequestProto)
      .build();

  updateGetDelegationTokenRequest =
      new OMGetDelegationTokenRequest(omRequest)
          .getOmRequest()
          .getUpdateGetDelegationTokenRequest();
}
 
Example #3
Source File: ClientNamenodeProtocolServerSideTranslatorPB.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public GetDelegationTokenResponseProto getDelegationToken(
    RpcController controller, GetDelegationTokenRequestProto req)
    throws ServiceException {
  try {
    Token<DelegationTokenIdentifier> token = server
        .getDelegationToken(new Text(req.getRenewer()));
    GetDelegationTokenResponseProto.Builder rspBuilder = 
        GetDelegationTokenResponseProto.newBuilder();
    if (token != null) {
      rspBuilder.setToken(PBHelper.convert(token));
    }
    return rspBuilder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
Example #4
Source File: ClientNamenodeProtocolServerSideTranslatorPB.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public GetDelegationTokenResponseProto getDelegationToken(
    RpcController controller, GetDelegationTokenRequestProto req)
    throws ServiceException {
  try {
    Token<DelegationTokenIdentifier> token = server
        .getDelegationToken(new Text(req.getRenewer()));
    GetDelegationTokenResponseProto.Builder rspBuilder = 
        GetDelegationTokenResponseProto.newBuilder();
    if (token != null) {
      rspBuilder.setToken(PBHelper.convert(token));
    }
    return rspBuilder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
Example #5
Source File: ClientNamenodeProtocolTranslatorPB.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer)
    throws IOException {
  GetDelegationTokenRequestProto req = GetDelegationTokenRequestProto
      .newBuilder()
      .setRenewer(renewer.toString())
      .build();
  try {
    GetDelegationTokenResponseProto resp = rpcProxy.getDelegationToken(null, req);
    return resp.hasToken() ? PBHelper.convertDelegationToken(resp.getToken())
        : null;
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example #6
Source File: OzoneManagerProtocolClientSideTranslatorPB.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
/**
 * Get a valid Delegation Token.
 *
 * @param renewer the designated renewer for the token
 * @return Token<OzoneDelegationTokenSelector>
 * @throws OMException
 */
@Override
public Token<OzoneTokenIdentifier> getDelegationToken(Text renewer)
    throws OMException {
  GetDelegationTokenRequestProto req = GetDelegationTokenRequestProto
      .newBuilder()
      .setRenewer(renewer == null ? "" : renewer.toString())
      .build();

  OMRequest omRequest = createOMRequest(Type.GetDelegationToken)
      .setGetDelegationTokenRequest(req)
      .build();

  final GetDelegationTokenResponseProto resp;
  try {
    resp =
        handleError(submitRequest(omRequest)).getGetDelegationTokenResponse();
    return resp.getResponse().hasToken() ?
        OMPBHelper.convertToDelegationToken(resp.getResponse().getToken())
        : null;
  } catch (IOException e) {
    if(e instanceof OMException) {
      throw (OMException)e;
    }
    throw new OMException("Get delegation token failed.", e,
        TOKEN_ERROR_OTHER);
  }
}
 
Example #7
Source File: MRClientProtocolPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponse getDelegationToken(
    GetDelegationTokenRequest request) throws IOException {
  GetDelegationTokenRequestProto requestProto = ((GetDelegationTokenRequestPBImpl)
      request).getProto();
  try {
    return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
        null, requestProto));
  } catch (ServiceException e) {
    throw unwrapAndThrowException(e);
  }
}
 
Example #8
Source File: MRClientProtocolPBServiceImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponseProto getDelegationToken(
    RpcController controller, GetDelegationTokenRequestProto proto)
    throws ServiceException {
  GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(proto);
  try {
    GetDelegationTokenResponse response = real.getDelegationToken(request);
    return ((GetDelegationTokenResponsePBImpl)response).getProto();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
Example #9
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #10
Source File: ApplicationClientProtocolPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponse getDelegationToken(
    GetDelegationTokenRequest request) throws YarnException,
    IOException {
  GetDelegationTokenRequestProto requestProto =
      ((GetDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #11
Source File: ApplicationHistoryProtocolPBClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponse getDelegationToken(
    GetDelegationTokenRequest request) throws YarnException, IOException {
  GetDelegationTokenRequestProto requestProto =
      ((GetDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #12
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer)
    throws IOException {
  GetDelegationTokenRequestProto req = GetDelegationTokenRequestProto
      .newBuilder()
      .setRenewer(renewer.toString())
      .build();
  try {
    GetDelegationTokenResponseProto resp = rpcProxy.getDelegationToken(null, req);
    return resp.hasToken() ? PBHelper.convertDelegationToken(resp.getToken())
        : null;
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example #13
Source File: MRClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponse getDelegationToken(
    GetDelegationTokenRequest request) throws IOException {
  GetDelegationTokenRequestProto requestProto = ((GetDelegationTokenRequestPBImpl)
      request).getProto();
  try {
    return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
        null, requestProto));
  } catch (ServiceException e) {
    throw unwrapAndThrowException(e);
  }
}
 
Example #14
Source File: MRClientProtocolPBServiceImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponseProto getDelegationToken(
    RpcController controller, GetDelegationTokenRequestProto proto)
    throws ServiceException {
  GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(proto);
  try {
    GetDelegationTokenResponse response = real.getDelegationToken(request);
    return ((GetDelegationTokenResponsePBImpl)response).getProto();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
Example #15
Source File: GetDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #16
Source File: ApplicationHistoryProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponse getDelegationToken(
    GetDelegationTokenRequest request) throws YarnException, IOException {
  GetDelegationTokenRequestProto requestProto =
      ((GetDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #17
Source File: ApplicationClientProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public GetDelegationTokenResponse getDelegationToken(
    GetDelegationTokenRequest request) throws YarnException,
    IOException {
  GetDelegationTokenRequestProto requestProto =
      ((GetDelegationTokenRequestPBImpl) request).getProto();
  try {
    return new GetDelegationTokenResponsePBImpl(proxy.getDelegationToken(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
Example #18
Source File: GetDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestPBImpl() {
  builder = GetDelegationTokenRequestProto.newBuilder();
}
 
Example #19
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestPBImpl() {
  builder = GetDelegationTokenRequestProto.newBuilder();
}
 
Example #20
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestPBImpl (
    GetDelegationTokenRequestProto proto) {
  this.proto = proto;
  viaProto = true;
}
 
Example #21
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #22
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private void maybeInitBuilder() {
  if (viaProto || builder == null) {
    builder = GetDelegationTokenRequestProto.newBuilder(proto);
  }
  viaProto = false;
}
 
Example #23
Source File: GetDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestPBImpl (
    GetDelegationTokenRequestProto proto) {
  this.proto = proto;
  viaProto = true;
}
 
Example #24
Source File: GetDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private void maybeInitBuilder() {
  if (viaProto || builder == null) {
    builder = GetDelegationTokenRequestProto.newBuilder(proto);
  }
  viaProto = false;
}
 
Example #25
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestPBImpl() {
  builder = GetDelegationTokenRequestProto.newBuilder();
}
 
Example #26
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestPBImpl (
    GetDelegationTokenRequestProto proto) {
  this.proto = proto;
  viaProto = true;
}
 
Example #27
Source File: GetDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private void maybeInitBuilder() {
  if (viaProto || builder == null) {
    builder = GetDelegationTokenRequestProto.newBuilder(proto);
  }
  viaProto = false;
}
 
Example #28
Source File: GetDelegationTokenRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private void maybeInitBuilder() {
  if (viaProto || builder == null) {
    builder = GetDelegationTokenRequestProto.newBuilder(proto);
  }
  viaProto = false;
}
 
Example #29
Source File: GetDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestProto getProto() {
  mergeLocalToProto();
  proto = viaProto ? proto : builder.build();
  viaProto = true;
  return proto;
}
 
Example #30
Source File: GetDelegationTokenRequestPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public GetDelegationTokenRequestPBImpl (
    GetDelegationTokenRequestProto proto) {
  this.proto = proto;
  viaProto = true;
}