Examples of writeTokenStorageToStream()


Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

        for (Token<? extends TokenIdentifier> t : cred1.getAllTokens()) {
          cred2.addToken(new Text("Hdfs"), t);
        }
        DataOutputStream os = new DataOutputStream(new FileOutputStream(
            binaryTokenFileName.toString()));
        cred2.writeTokenStorageToStream(os);
        os.close();
        job.getConfiguration().set("mapreduce.job.credentials.binary",
            binaryTokenFileName.toString());
      } catch (IOException e) {
        Assert.fail("Exception " + e);
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

      TokenCache.setJobToken(jobToken, taskCredentials);

      DataOutputBuffer containerTokens_dob = new DataOutputBuffer();
      LOG.info("Size of containertokens_dob is "
          + taskCredentials.numberOfTokens());
      taskCredentials.writeTokenStorageToStream(containerTokens_dob);
      taskCredentialsBuffer =
          ByteBuffer.wrap(containerTokens_dob.getData(), 0,
              containerTokens_dob.getLength());

      // Add shuffle token
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

    UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
    Credentials credentials =
      currentUser.getCredentials();
    DataOutputBuffer dob = new DataOutputBuffer();
    credentials.writeTokenStorageToStream(dob);
    dob.close();
    // Now remove the AM->RM token so that containers cannot access it.
    Iterator<Token<?>> iter = credentials.getAllTokens().iterator();
    while (iter.hasNext()) {
      Token<?> token = iter.next();
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

          LocalizerTokenIdentifier id = secretManager.createIdentifier();
          Token<LocalizerTokenIdentifier> localizerToken =
              new Token<LocalizerTokenIdentifier>(id, secretManager);
          credentials.addToken(id.getKind(), localizerToken);
        }
        credentials.writeTokenStorageToStream(tokenOut);
      } finally {
        if (tokenOut != null) {
          tokenOut.close();
        }
      }
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

      alias.set("token" + i);
      Token token = new Token(identifier, password, kind, service);
      creds.addToken(alias, token);
    }
    DataOutputBuffer buf = new DataOutputBuffer();
    creds.writeTokenStorageToStream(buf);
    DataInputBuffer ret = new DataInputBuffer();
    ret.reset(buf.getData(), 0, buf.getLength());
    return ret;
  }
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

    Assert.assertEquals(tokenSet, rm1.getRMContext()
      .getDelegationTokenRenewer().getDelegationTokens());

    // assert delegation tokens are saved
    DataOutputBuffer dob = new DataOutputBuffer();
    ts.writeTokenStorageToStream(dob);
    ByteBuffer securityTokens =
        ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
    securityTokens.rewind();
    Assert.assertEquals(securityTokens, appState
      .getApplicationSubmissionContext().getAMContainerSpec()
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

        for (Token<?> token : tokens) {
          LOG.info("Got dt for " + fs.getUri() + "; " + token);
        }
      }
      DataOutputBuffer dob = new DataOutputBuffer();
      credentials.writeTokenStorageToStream(dob);
      ByteBuffer fsTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
      amContainer.setTokens(fsTokens);
    }

    appContext.setAMContainerSpec(amContainer);
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

    LOG.info("Starting ApplicationMaster");

    Credentials credentials =
        UserGroupInformation.getCurrentUser().getCredentials();
    DataOutputBuffer dob = new DataOutputBuffer();
    credentials.writeTokenStorageToStream(dob);
    // Now remove the AM->RM token so that containers cannot access it.
    Iterator<Token<?>> iter = credentials.getAllTokens().iterator();
    while (iter.hasNext()) {
      Token<?> token = iter.next();
      if (token.getKind().equals(AMRMTokenIdentifier.KIND_NAME)) {
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

          Credentials credentials = attemptState.getAppAttemptCredentials();
          ByteBuffer appAttemptTokens = null;
          try {
            if(credentials != null){
              DataOutputBuffer dob = new DataOutputBuffer();
                credentials.writeTokenStorageToStream(dob);
              appAttemptTokens =
                  ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
            }
            ApplicationAttemptStateDataPBImpl attemptStateData =
              (ApplicationAttemptStateDataPBImpl) ApplicationAttemptStateDataPBImpl
View Full Code Here

Examples of org.apache.hadoop.security.Credentials.writeTokenStorageToStream()

        }
      }

      Credentials ts = new Credentials();
      DataOutputBuffer dob = new DataOutputBuffer();
      ts.writeTokenStorageToStream(dob);
      ByteBuffer securityTokens =
          ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
      ContainerLaunchContext clc =
          Records.newRecord(ContainerLaunchContext.class);
      clc.setTokens(securityTokens);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.