org.apache.hadoop.yarn.api.records.Token.getPassword()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.apache.hadoop.yarn.api.records.Token.getPassword()方法的一些代码示例,展示了Token.getPassword()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.getPassword()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.Token
类名称:Token
方法名:getPassword

Token.getPassword介绍

[英]Get the token password
[中]获取令牌密码

代码示例

代码示例来源:origin: Qihoo360/XLearning

@Override
public CancelDelegationTokenResponse cancelDelegationToken(
  CancelDelegationTokenRequest request) throws IOException {
 if (!isAllowedDelegationTokenOp()) {
  throw new IOException(
    "Delegation Token can be cancelled 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().getUserName();
 jhsDTSecretManager.cancelToken(token, user);
 return Records.newRecord(CancelDelegationTokenResponse.class);
}

代码示例来源:origin: Qihoo360/XLearning

@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;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-common

public static ContainerTokenIdentifier newContainerTokenIdentifier(
  Token containerToken) throws IOException {
 org.apache.hadoop.security.token.Token<ContainerTokenIdentifier> token =
   new org.apache.hadoop.security.token.Token<ContainerTokenIdentifier>(
     containerToken.getIdentifier()
       .array(), containerToken.getPassword().array(), new Text(
       containerToken.getKind()),
     new Text(containerToken.getService()));
 return token.decodeIdentifier();
}

代码示例来源:origin: io.hops/hadoop-yarn-server-common

public static ContainerTokenIdentifier newContainerTokenIdentifier(
  Token containerToken) throws IOException {
 org.apache.hadoop.security.token.Token<ContainerTokenIdentifier> token =
   new org.apache.hadoop.security.token.Token<ContainerTokenIdentifier>(
     containerToken.getIdentifier()
       .array(), containerToken.getPassword().array(), new Text(
       containerToken.getKind()),
     new Text(containerToken.getService()));
 return token.decodeIdentifier();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-common

public static ContainerTokenIdentifier newContainerTokenIdentifier(
  Token containerToken) throws IOException {
 org.apache.hadoop.security.token.Token<ContainerTokenIdentifier> token =
   new org.apache.hadoop.security.token.Token<ContainerTokenIdentifier>(
     containerToken.getIdentifier()
       .array(), containerToken.getPassword().array(), new Text(
       containerToken.getKind()),
     new Text(containerToken.getService()));
 return token.decodeIdentifier();
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
    .getIdentifier().array(), token.getPassword().array(), new Text(
    token.getKind()), new Text(token.getService()));
 UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
 currentUGI.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-app

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
    .getIdentifier().array(), token.getPassword().array(), new Text(
    token.getKind()), new Text(token.getService()));
 UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
 currentUGI.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-app

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
    .getIdentifier().array(), token.getPassword().array(), new Text(
    token.getKind()), new Text(token.getService()));
 UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
 currentUGI.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-client

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
    .getIdentifier().array(), token.getPassword().array(), new Text(
    token.getKind()), new Text(token.getService()));
 // Preserve the token service sent by the RM when adding the token
 // to ensure we replace the previous token setup by the RM.
 // Afterwards we can update the service address for the RPC layer.
 UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
 currentUGI.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
    .getIdentifier().array(), token.getPassword().array(), new Text(
    token.getKind()), new Text(token.getService()));
 UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
 currentUGI.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-app

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
    .getIdentifier().array(), token.getPassword().array(), new Text(
    token.getKind()), new Text(token.getService()));
 UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
 currentUGI.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-app

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
    .getIdentifier().array(), token.getPassword().array(), new Text(
    token.getKind()), new Text(token.getService()));
 UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
 currentUGI.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-client

private void updateAMRMToken(Token token) throws IOException {
  org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
    new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
     .getIdentifier().array(), token.getPassword().array(), new Text(
     token.getKind()), new Text(token.getService()));
  // Preserve the token service sent by the RM when adding the token
  // to ensure we replace the previous token setup by the RM.
  // Afterwards we can update the service address for the RPC layer.
  UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
  currentUGI.addToken(amrmToken);
  amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-client

private void updateAMRMToken(Token token) throws IOException {
  org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
    new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(token
     .getIdentifier().array(), token.getPassword().array(), new Text(
     token.getKind()), new Text(token.getService()));
  // Preserve the token service sent by the RM when adding the token
  // to ensure we replace the previous token setup by the RM.
  // Afterwards we can update the service address for the RPC layer.
  UserGroupInformation currentUGI = UserGroupInformation.getCurrentUser();
  currentUGI.addToken(amrmToken);
  amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConfig()));
 }
}

代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager

private void updateAMRMToken(Token token) throws IOException {
 org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> amrmToken =
   new org.apache.hadoop.security.token.Token<AMRMTokenIdentifier>(
     token.getIdentifier().array(), token.getPassword().array(),
     new Text(token.getKind()), new Text(token.getService()));
 // Preserve the token service sent by the RM when adding the token
 // to ensure we replace the previous token setup by the RM.
 // Afterwards we can update the service address for the RPC layer.
 user.addToken(amrmToken);
 amrmToken.setService(ClientRMProxy.getAMRMTokenService(getConf()));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-nodemanager

protected ContainerTokenIdentifier verifyAndGetContainerTokenIdentifier(
  org.apache.hadoop.yarn.api.records.Token token,
  ContainerTokenIdentifier containerTokenIdentifier) throws YarnException,
  InvalidToken {
 byte[] password =
   context.getContainerTokenSecretManager().retrievePassword(
    containerTokenIdentifier);
 byte[] tokenPass = token.getPassword().array();
 if (password == null || tokenPass == null
   || !Arrays.equals(password, tokenPass)) {
  throw new InvalidToken(
   "Invalid container token used for starting container on : "
     + context.getNodeId().toString());
 }
 return containerTokenIdentifier;
}

代码示例来源:origin: io.hops/hadoop-yarn-common

public static ContainerTokenIdentifier newContainerTokenIdentifier(
  Token containerToken) throws IOException {
 org.apache.hadoop.security.token.Token<ContainerTokenIdentifier> token =
   new org.apache.hadoop.security.token.Token<ContainerTokenIdentifier>(
     containerToken.getIdentifier()
       .array(), containerToken.getPassword().array(), new Text(
       containerToken.getKind()),
     new Text(containerToken.getService()));
 return token.decodeIdentifier();
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

public static ContainerTokenIdentifier newContainerTokenIdentifier(
  Token containerToken) throws IOException {
 org.apache.hadoop.security.token.Token<ContainerTokenIdentifier> token =
   new org.apache.hadoop.security.token.Token<ContainerTokenIdentifier>(
     containerToken.getIdentifier()
       .array(), containerToken.getPassword().array(), new Text(
       containerToken.getKind()),
     new Text(containerToken.getService()));
 return token.decodeIdentifier();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

public static ContainerTokenIdentifier newContainerTokenIdentifier(
  Token containerToken) throws IOException {
 org.apache.hadoop.security.token.Token<ContainerTokenIdentifier> token =
   new org.apache.hadoop.security.token.Token<ContainerTokenIdentifier>(
     containerToken.getIdentifier()
       .array(), containerToken.getPassword().array(), new Text(
       containerToken.getKind()),
     new Text(containerToken.getService()));
 return token.decodeIdentifier();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-common

public static ContainerTokenIdentifier newContainerTokenIdentifier(
  Token containerToken) throws IOException {
 org.apache.hadoop.security.token.Token<ContainerTokenIdentifier> token =
   new org.apache.hadoop.security.token.Token<ContainerTokenIdentifier>(
     containerToken.getIdentifier()
       .array(), containerToken.getPassword().array(), new Text(
       containerToken.getKind()),
     new Text(containerToken.getService()));
 return token.decodeIdentifier();
}

相关文章