Package org.apache.accumulo.core.client.security.tokens

Examples of org.apache.accumulo.core.client.security.tokens.PasswordToken


            config = LumifyTestClusterConfigurationLoader.getConfigurationProperties();
            if (LumifyTestClusterConfigurationLoader.isTestServer()) {
                FormatLumify.deleteElasticSearchIndex(config);

                ZooKeeperInstance zooKeeperInstance = new ZooKeeperInstance(config.getProperty("bigtable.accumulo.instanceName"), config.getProperty("bigtable.accumulo.zookeeperServerNames"));
                Connector connector = zooKeeperInstance.getConnector(config.getProperty("bigtable.accumulo.username"), new PasswordToken(config.getProperty("bigtable.accumulo.password")));
                ModelSession modelSession = new AccumuloSession(connector, true);
                ModelUserContext modelUserContext = modelSession.createModelUserContext(LumifyVisibility.SUPER_USER_VISIBILITY_STRING);
                SystemUser user = new SystemUser(modelUserContext);
                ModelUtil.deleteTables(modelSession, user);
                ModelUtil.initializeTables(modelSession, user);
View Full Code Here


  @Test
  public void multipleStopsIsAllowed() throws Exception {
    MiniAccumuloCluster accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret");
    accumulo.start();
   
    Connector conn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("root", new PasswordToken("superSecret"));
    conn.tableOperations().create("foo");

    accumulo.stop();
    accumulo.stop();
  }
View Full Code Here

  }
 
  @Test
  public void test() throws Exception {
    Instance instance = new MockInstance();
    Connector connector = instance.getConnector("root", new PasswordToken(""));
    BatchWriter bw = connector.createBatchWriter("!METADATA", new BatchWriterConfig());
   
    // Create a fake METADATA table with these splits
    String splits[] = {"a", "e", "j", "o", "t", "z"};
    // create metadata for a table "t" with the splits above
    Text tableId = new Text("t");
    Text pr = null;
    for (String s : splits) {
      Text split = new Text(s);
      Mutation prevRow = KeyExtent.getPrevRowUpdateMutation(new KeyExtent(tableId, split, pr));
      prevRow.put(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY, new Text("123456"), new Value("127.0.0.1:1234".getBytes()));
      Constants.METADATA_CHOPPED_COLUMN.put(prevRow, new Value("junk".getBytes()));
      bw.addMutation(prevRow);
      pr = split;
    }
    // Add the default tablet
    Mutation defaultTablet = KeyExtent.getPrevRowUpdateMutation(new KeyExtent(tableId, null, pr));
    defaultTablet.put(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY, new Text("123456"), new Value("127.0.0.1:1234".getBytes()));
    bw.addMutation(defaultTablet);
    bw.close();
   
    // Read out the TabletLocationStates
    MockCurrentState state = new MockCurrentState(new MergeInfo(new KeyExtent(tableId, new Text("p"), new Text("e")), MergeInfo.Operation.MERGE));
    TCredentials auths = CredentialHelper.create("root", new PasswordToken(new byte[0]), "instance");
   
    // Verify the tablet state: hosted, and count
    MetaDataStateStore metaDataStateStore = new MetaDataStateStore(instance, auths, state);
    int count = 0;
    for (TabletLocationState tss : metaDataStateStore) {
View Full Code Here

    System.arraycopy(b1, 0, ball, 0, b1.length);
    ball[b1.length] = (byte) 0;
    System.arraycopy(b2, 0, ball, b1.length + 1, b2.length);

    Instance instance = new MockInstance();
    Connector conn = instance.getConnector("root", new PasswordToken(new byte[0]));

    conn.tableOperations().create(table);
    BatchWriter bw = conn.createBatchWriter(table, new BatchWriterConfig());
    Mutation m = new Mutation(ball);
    m.put(new byte[0], new byte[0], new byte[0]);
View Full Code Here

    String principal = conf.get(Property.TRACE_USER);
    AuthenticationToken at;
    Map<String,String> loginMap = conf.getAllPropertiesWithPrefix(Property.TRACE_TOKEN_PROPERTY_PREFIX);
    if (loginMap.isEmpty()) {
      Property p = Property.TRACE_PASSWORD;
      at = new PasswordToken(conf.get(p).getBytes(Constants.UTF8));
    } else {
      Properties props = new Properties();
      int prefixLength = Property.TRACE_TOKEN_PROPERTY_PREFIX.getKey().length() + 1;
      for (Entry<String,String> entry : loginMap.entrySet()) {
        props.put(entry.getKey().substring(prefixLength), entry.getValue());
View Full Code Here

  public String getUserName() {
    return props.getProperty("USERNAME");
  }
 
  public AuthenticationToken getToken() {
    return new PasswordToken(props.getProperty("PASSWORD"));
  }
View Full Code Here

  }

  @Test
  public void test1() throws Exception {
    MockInstance instance = new MockInstance("rft1");
    Connector conn = instance.getConnector("", new PasswordToken(""));

    conn.tableOperations().create("table1");
    BatchWriter bw = conn.createBatchWriter("table1", new BatchWriterConfig());

    for (Mutation m : createMutations()) {
View Full Code Here

  }

  @Test
  public void testChainedRowFilters() throws Exception {
    MockInstance instance = new MockInstance("rft1");
    Connector conn = instance.getConnector("", new PasswordToken(""));

    conn.tableOperations().create("chained_row_filters");
    BatchWriter bw = conn.createBatchWriter("chained_row_filters", new BatchWriterConfig());
    for (Mutation m : createMutations()) {
      bw.addMutation(m);
View Full Code Here

  }

  @Test
  public void testFilterConjunction() throws Exception {
    MockInstance instance = new MockInstance("rft1");
    Connector conn = instance.getConnector("", new PasswordToken(""));

    conn.tableOperations().create("filter_conjunction");
    BatchWriter bw = conn.createBatchWriter("filter_conjunction", new BatchWriterConfig());
    for (Mutation m : createMutations()) {
      bw.addMutation(m);
View Full Code Here

   
  }
 
  @Test(timeout = 30000)
  public void test() throws Exception {
    Connector conn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("root", new PasswordToken("superSecret"));
   
    conn.tableOperations().create("table1");
   
    conn.securityOperations().createLocalUser("user1", new PasswordToken("pass1"));
    conn.securityOperations().changeUserAuthorizations("user1", new Authorizations("A", "B"));
    conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.WRITE);
    conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.READ);
   
    IteratorSetting is = new IteratorSetting(10, SummingCombiner.class);
    SummingCombiner.setEncodingType(is, LongCombiner.Type.STRING);
    SummingCombiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("META", "COUNT")));
   
    conn.tableOperations().attachIterator("table1", is);
   
    Connector uconn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("user1", new PasswordToken("pass1"));
   
    BatchWriter bw = uconn.createBatchWriter("table1", new BatchWriterConfig());
   
    UUID uuid = UUID.randomUUID();
   
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.security.tokens.PasswordToken

Copyright © 2018 www.massapicom. 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.