Examples of numberOfSecretKeys()


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

    assertTrue("Tokens for services service1 and service2 must be present",
        foundFirst && foundSecond);
    // compare secret keys
    int mapLen = m.size();
    assertEquals("wrong number of keys in the Storage",
        mapLen, ts.numberOfSecretKeys());
    for(Text a : m.keySet()) {
      byte [] kTS = ts.getSecretKey(a);
      byte [] kLocal = m.get(a);
      assertTrue("keys don't match for " + a,
          WritableComparator.compareBytes(kTS, 0, kTS.length, kLocal,
View Full Code Here

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

    MRAppMaster.initAndStartAppMaster(appMaster, conf, userName);

    // Now validate the task credentials
    Credentials appMasterCreds = appMaster.getCredentials();
    Assert.assertNotNull(appMasterCreds);
    Assert.assertEquals(1, appMasterCreds.numberOfSecretKeys());
    Assert.assertEquals(1, appMasterCreds.numberOfTokens());

    // Validate the tokens - app token should not be present
    Token<? extends TokenIdentifier> usedToken =
        appMasterCreds.getToken(tokenAlias);
View Full Code Here

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

    Assert.assertEquals("mySecretKey", new String(usedKey));

    // The credentials should also be added to conf so that OuputCommitter can
    // access it - app token should not be present
    Credentials confCredentials = conf.getCredentials();
    Assert.assertEquals(1, confCredentials.numberOfSecretKeys());
    Assert.assertEquals(1, confCredentials.numberOfTokens());
    Assert.assertEquals(storedToken, confCredentials.getToken(tokenAlias));
    Assert.assertEquals("mySecretKey",
      new String(confCredentials.getSecretKey(keyAlias)));
   
View Full Code Here

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

    Assert.assertEquals("mySecretKey",
      new String(confCredentials.getSecretKey(keyAlias)));
   
    // Verify the AM's ugi - app token should be present
    Credentials ugiCredentials = appMaster.getUgi().getCredentials();
    Assert.assertEquals(1, ugiCredentials.numberOfSecretKeys());
    Assert.assertEquals(2, ugiCredentials.numberOfTokens());
    Assert.assertEquals(storedToken, ugiCredentials.getToken(tokenAlias));
    Assert.assertEquals(appToken, ugiCredentials.getToken(appTokenService));
    Assert.assertEquals("mySecretKey",
      new String(ugiCredentials.getSecretKey(keyAlias)));
View Full Code Here

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

    // file name is passed thru env
    String jobTokenFile =
      System.getenv().get(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION);
    Credentials credentials =
      TokenCache.loadTokens(jobTokenFile, defaultConf);
    LOG.debug("loading token. # keys =" +credentials.numberOfSecretKeys() +
        "; from file=" + jobTokenFile);
   
    Token<JobTokenIdentifier> jt = TokenCache.getJobToken(credentials);
    jt.setService(new Text(address.getAddress().getHostAddress() + ":"
        + address.getPort()));
View Full Code Here

Examples of org.apache.hadoop.security.TokenStorage.numberOfSecretKeys()

    //load token cache storage
    String jobTokenFile =
      System.getenv().get(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION);
    TokenStorage ts =
      TokenCache.loadTaskTokenStorage(jobTokenFile, defaultConf);
    LOG.debug("loading token. # keys =" +ts.numberOfSecretKeys() +
        "; from file=" + jobTokenFile);
    Token<JobTokenIdentifier> jt = TokenCache.getJobToken(ts);
    jt.setService(new Text(address.getAddress().getHostAddress() + ":"
        + address.getPort()));
    UserGroupInformation current = UserGroupInformation.getCurrentUser();
View Full Code Here

Examples of org.apache.hadoop.security.TokenStorage.numberOfSecretKeys()

    assertTrue("Tokens for services service1 and service2 must be present",
        foundFirst && foundSecond);
    // compare secret keys
    int mapLen = m.size();
    assertEquals("wrong number of keys in the Storage",
        mapLen, ts.numberOfSecretKeys());
    for(Text a : m.keySet()) {
      byte [] kTS = ts.getSecretKey(a);
      byte [] kLocal = m.get(a);
      assertTrue("keys don't match for " + a,
          WritableComparator.compareBytes(kTS, 0, kTS.length, kLocal,
View Full Code Here

Examples of org.apache.hadoop.security.TokenStorage.numberOfSecretKeys()

    TokenStorage ts = new TokenStorage();
    ts.readFields(in);

    if(LOG.isDebugEnabled()) {
      LOG.debug("Task: Loaded jobTokenFile from: "+localJobTokenFile.toUri().getPath()
        +"; num of sec keys  = " + ts.numberOfSecretKeys());
    }
    in.close();
    return ts;
  }
  /**
 
View Full Code Here

Examples of org.apache.hadoop.security.TokenStorage.numberOfSecretKeys()

      int dts_size = 0;
      if(dts != null)
        dts_size = dts.size();
     
      System.out.println("inside MAP: ts==NULL?=" + (ts==null) +
          "; #keys = " + (ts==null? 0:ts.numberOfSecretKeys()) +
          ";jobToken = " (ts==null? "n/a":TokenCache.getJobToken(ts)) +
          "; alias1 key=" + new String(key1) +
          "; dts size= " + dts_size);
   
      for(Token<? extends TokenIdentifier> t : dts) {
View Full Code Here

Examples of org.apache.hadoop.security.TokenStorage.numberOfSecretKeys()

      if(dts.size() != 2) { // one job token and one delegation token
        throw new RuntimeException("tokens are not available"); // fail the test
      }
     
     
      if(key1 == null || ts == null || ts.numberOfSecretKeys() != NUM_OF_KEYS) {
        throw new RuntimeException("secret keys are not available"); // fail the test
      }
      super.map(key, value, context);
    }
  }
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.