Java Code Examples for org.apache.hadoop.security.proto.SecurityProtos.TokenProto#getKind()

The following examples show how to use org.apache.hadoop.security.proto.SecurityProtos.TokenProto#getKind() . 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: ShuffleHandler.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void recoverJobShuffleInfo(String jobIdStr, byte[] data)
    throws IOException {
  JobID jobId;
  try {
    jobId = JobID.forName(jobIdStr);
  } catch (IllegalArgumentException e) {
    throw new IOException("Bad job ID " + jobIdStr + " in state store", e);
  }

  JobShuffleInfoProto proto = JobShuffleInfoProto.parseFrom(data);
  String user = proto.getUser();
  TokenProto tokenProto = proto.getJobToken();
  Token<JobTokenIdentifier> jobToken = new Token<JobTokenIdentifier>(
      tokenProto.getIdentifier().toByteArray(),
      tokenProto.getPassword().toByteArray(),
      new Text(tokenProto.getKind()), new Text(tokenProto.getService()));
  addJobToken(jobId, user, jobToken);
}
 
Example 2
Source File: ShuffleHandler.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void recoverJobShuffleInfo(String jobIdStr, byte[] data)
    throws IOException {
  JobID jobId;
  try {
    jobId = JobID.forName(jobIdStr);
  } catch (IllegalArgumentException e) {
    throw new IOException("Bad job ID " + jobIdStr + " in state store", e);
  }

  JobShuffleInfoProto proto = JobShuffleInfoProto.parseFrom(data);
  String user = proto.getUser();
  TokenProto tokenProto = proto.getJobToken();
  Token<JobTokenIdentifier> jobToken = new Token<JobTokenIdentifier>(
      tokenProto.getIdentifier().toByteArray(),
      tokenProto.getPassword().toByteArray(),
      new Text(tokenProto.getKind()), new Text(tokenProto.getService()));
  addJobToken(jobId, user, jobToken);
}
 
Example 3
Source File: ShuffleHandler.java    From tez with Apache License 2.0 6 votes vote down vote up
private void recoverJobShuffleInfo(String jobIdStr, byte[] data)
    throws IOException {
  JobID jobId;
  try {
    jobId = JobID.forName(jobIdStr);
  } catch (IllegalArgumentException e) {
    throw new IOException("Bad job ID " + jobIdStr + " in state store", e);
  }

  JobShuffleInfoProto proto = JobShuffleInfoProto.parseFrom(data);
  String user = proto.getUser();
  TokenProto tokenProto = proto.getJobToken();
  Token<JobTokenIdentifier> jobToken = new Token<JobTokenIdentifier>(
      tokenProto.getIdentifier().toByteArray(),
      tokenProto.getPassword().toByteArray(),
      new Text(tokenProto.getKind()), new Text(tokenProto.getService()));
  addJobToken(jobId, user, jobToken);
}
 
Example 4
Source File: OMPBHelper.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
/**
 * Converts @{@link TokenProto} to Ozone delegation token.
 *
 * @return Ozone
 */
public static Token<OzoneTokenIdentifier> convertToDelegationToken(
    TokenProto tokenProto) {
  return new Token<>(tokenProto.getIdentifier()
      .toByteArray(), tokenProto.getPassword().toByteArray(), new Text(
      tokenProto.getKind()), new Text(tokenProto.getService()));
}
 
Example 5
Source File: PBHelper.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public static Token<BlockTokenIdentifier> convert(
    TokenProto blockToken) {
  return new Token<BlockTokenIdentifier>(blockToken.getIdentifier()
      .toByteArray(), blockToken.getPassword().toByteArray(), new Text(
      blockToken.getKind()), new Text(blockToken.getService()));
}
 
Example 6
Source File: PBHelper.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public static Token<DelegationTokenIdentifier> convertDelegationToken(
    TokenProto blockToken) {
  return new Token<DelegationTokenIdentifier>(blockToken.getIdentifier()
      .toByteArray(), blockToken.getPassword().toByteArray(), new Text(
      blockToken.getKind()), new Text(blockToken.getService()));
}
 
Example 7
Source File: PBHelper.java    From big-c with Apache License 2.0 4 votes vote down vote up
public static Token<BlockTokenIdentifier> convert(
    TokenProto blockToken) {
  return new Token<BlockTokenIdentifier>(blockToken.getIdentifier()
      .toByteArray(), blockToken.getPassword().toByteArray(), new Text(
      blockToken.getKind()), new Text(blockToken.getService()));
}
 
Example 8
Source File: PBHelper.java    From big-c with Apache License 2.0 4 votes vote down vote up
public static Token<DelegationTokenIdentifier> convertDelegationToken(
    TokenProto blockToken) {
  return new Token<DelegationTokenIdentifier>(blockToken.getIdentifier()
      .toByteArray(), blockToken.getPassword().toByteArray(), new Text(
      blockToken.getKind()), new Text(blockToken.getService()));
}