Examples of writeTokenStorageFile()


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

      Credentials creds = new Credentials();
      Token<?> token1 = fs1.getDelegationToken(renewer);
      Token<?> token2 = fs2.getDelegationToken(renewer);
      creds.addToken(token1.getService(), token1);
      creds.addToken(token2.getService(), token2);
      creds.writeTokenStorageFile(new Path(binaryTokenFile), conf);


      Credentials newCreds = new Credentials();
      TokenCache.mergeBinaryTokens(newCreds, conf, binaryTokenFile);
View Full Code Here

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

    Token<?> token = new Token<AbstractDelegationTokenIdentifier>(
        "identifier".getBytes(), "password".getBytes(),
        new Text("token-kind"), new Text("token-service"));
    Credentials creds = new Credentials();
    creds.addToken(new Text("token-alias"), token);
    creds.writeTokenStorageFile(tmpPath, conf);

    new GenericOptionsParser(conf, args);
    String fileName = conf.get("mapreduce.job.credentials.json");
    assertNotNull("files is null", fileName);
    assertEquals("files option does not match", tmpPath.toString(), fileName);
View Full Code Here

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

    Path tokenFilePath = new Path(testDir.getAbsolutePath(), "tokens-file");
    Map<String, String> newEnv = new HashMap<String, String>();
    newEnv.put(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION, tokenFilePath
      .toUri().getPath());
    setNewEnvironmentHack(newEnv);
    credentials.writeTokenStorageFile(tokenFilePath, conf);

    ApplicationId appId = ApplicationId.newInstance(12345, 56);
    ApplicationAttemptId applicationAttemptId =
        ApplicationAttemptId.newInstance(appId, 1);
    ContainerId containerId =
View Full Code Here

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

    Token<?> token2 = fs2.getDelegationToken(renewer);
    creds.addToken(token1.getService(), token1);
    creds.addToken(token2.getService(), token2);
    // wait to set, else the obtain tokens call above will fail with FNF
    conf.set(MRJobConfig.MAPREDUCE_JOB_CREDENTIALS_BINARY, binaryTokenFile);
    creds.writeTokenStorageFile(new Path(binaryTokenFile), conf);
   
    // re-init creds and add a newer token for fs1
    creds = new Credentials();
    Token<?> newerToken1 = fs1.getDelegationToken(renewer);
    assertFalse(newerToken1.equals(token1));
View Full Code Here

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

              } else {
                FileSystem fs = FileSystem.get(conf);
                Token<?> token = fs.getDelegationToken(renewer);
                Credentials cred = new Credentials();
                cred.addToken(token.getService(), token);
                cred.writeTokenStorageFile(tokenFile, conf);
                System.out.println("Fetched token for " + token.getService()
                    + " into " + tokenFile);
              }
            }
            return null;
View Full Code Here

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

              }
            } else {
              // otherwise we are fetching
              if (webUrl != null) {
                Credentials creds = getDTfromRemote(webUrl, renewer);
                creds.writeTokenStorageFile(tokenFile, conf);
                for (Token<?> token : creds.getAllTokens()) {
                  System.out.println("Fetched token via " + webUrl + " for "
                      + token.getService() + " into " + tokenFile);
                }
              } else {
View Full Code Here

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

              }
            } else {
              // otherwise we are fetching
              if (webUrl != null) {
                Credentials creds = getDTfromRemote(webUrl, renewer);
                creds.writeTokenStorageFile(tokenFile, conf);
                for (Token<?> token : creds.getAllTokens()) {
                  System.out.println("Fetched token via " + webUrl + " for "
                      + token.getService() + " into " + tokenFile);
                }
              } else {
View Full Code Here

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

              } else {
                FileSystem fs = FileSystem.get(conf);
                Token<?> token = fs.getDelegationToken(renewer);
                Credentials cred = new Credentials();
                cred.addToken(token.getService(), token);
                cred.writeTokenStorageFile(tokenFile, conf);
                System.out.println("Fetched token for " + token.getService()
                    + " into " + tokenFile);
              }
            }
            return null;
View Full Code Here

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

    ugi.doAs(new PrivilegedExceptionAction<Object>() {
      public Object run() throws IOException {
        Credentials cred = new Credentials();
        cred.addToken(fsToken.getService(), fsToken);
        cred.addToken(msToken.getService(), msToken);
        cred.writeTokenStorageFile(tokenPath, conf);
        return null;
      }
    });

  }
View Full Code Here

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

    Path tokenPath = new Path(t.toURI());

    //write credential with token to file
    Credentials cred = new Credentials();
    cred.addToken(fsToken.getService(), fsToken);
    cred.writeTokenStorageFile(tokenPath, conf);

    return tokenPath;
  }

  @Override
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.