Package org.apache.accumulo.core.security

Examples of org.apache.accumulo.core.security.Authorizations


      BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(file))));
     
      String line;
     
      while ((line = in.readLine()) != null) {
        auths.add(new Authorizations(line.split(",")));
      }
     
      in.close();
    }
View Full Code Here


      ranges = new ZooKeeperInstance(instance, zookeepers).getConnector(user, pass).tableOperations()
          .splitRangeByTablets(table, new Range(), Integer.parseInt(maxMaps));
    }

    job.setInputFormatClass(AccumuloInputFormat.class);
    Authorizations authorizations;
    if (auths == null || auths.trim().equals(""))
      authorizations = Constants.NO_AUTHS;
    else
      authorizations = new Authorizations(auths.split(","));

    AccumuloInputFormat.setInputInfo(job.getConfiguration(), user, pass.getBytes(), clone, authorizations);
    AccumuloInputFormat.setZooKeeperInstance(job.getConfiguration(), instance, zookeepers);
    AccumuloInputFormat.setScanOffline(job.getConfiguration(), scanOffline);
    AccumuloInputFormat.setRanges(job.getConfiguration(), ranges);
View Full Code Here

    bw.addMutation(m1);

    bw.flush();

    Scanner scanner = getConnector().createScanner("test", new Authorizations());

    int count = 0;
    for (Entry<Key,Value> entry : scanner) {
      count++;
      if (!entry.getValue().toString().equals("5")) {
View Full Code Here

   
    Job job = new Job(getConf(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
    job.setJarByClass(this.getClass());
   
    job.setInputFormatClass(AccumuloInputFormat.class);
    AccumuloInputFormat.setInputInfo(job.getConfiguration(), user, pass.getBytes(), table, new Authorizations());
    AccumuloInputFormat.setZooKeeperInstance(job.getConfiguration(), instance, zookeepers);
   
    // set up ranges
    try {
      AccumuloInputFormat.setRanges(job.getConfiguration(), new ZooKeeperInstance(instance, zookeepers).getConnector(user, pass.getBytes()).tableOperations()
View Full Code Here

    systemUserName = String.format("system_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
    tableUserName = String.format("table_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
    secTableName = String.format("security_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
   
    byte[] sysUserPass = "sysUser".getBytes();
    conn.securityOperations().createUser(systemUserName, sysUserPass, new Authorizations());
    sysConn = instance.getConnector(systemUserName, sysUserPass);
   
    SecurityHelper.setSystemConnector(state, sysConn);
    SecurityHelper.setSysUserName(state, systemUserName);
    SecurityHelper.setSysUserPass(state, sysUserPass);
   
    SecurityHelper.setTableExists(state, false);
    SecurityHelper.setTableExists(state, false);
   
    SecurityHelper.setTabUserPass(state, new byte[0]);
   
    SecurityHelper.setTableName(state, secTableName);
    SecurityHelper.setTabUserName(state, tableUserName);
   
    for (TablePermission tp : TablePermission.values()) {
      SecurityHelper.setTabPerm(state, systemUserName, tp, false);
      SecurityHelper.setTabPerm(state, tableUserName, tp, false);
    }
    for (SystemPermission sp : SystemPermission.values()) {
      SecurityHelper.setSysPerm(state, systemUserName, sp, false);
      SecurityHelper.setSysPerm(state, tableUserName, sp, false);
    }
    SecurityHelper.setUserAuths(state, tableUserName, new Authorizations());
    SecurityHelper.setAuthsMap(state, new HashMap<String,Integer>());
  }
View Full Code Here

    long max = Long.parseLong(args[6]);
   
    long sleepTime = Long.parseLong(args[7]);
   
    Connector conn = new ZooKeeperInstance(instanceName, zooKeepers).getConnector(user, password.getBytes());
    Scanner scanner = ContinuousUtil.createScanner(conn, table, new Authorizations());
   
    Random r = new Random();
   
    while (true) {
      byte[] row = ContinuousIngest.genRow(min, max, r);
View Full Code Here

    Job job = new Job(new Configuration());
    job.setInputFormatClass(AccumuloInputFormat.class);
    job.setMapperClass(TestMapper.class);
    job.setNumReduceTasks(0);
    AccumuloInputFormat.setInputInfo(job.getConfiguration(), "root", "".getBytes(), "testtable", new Authorizations());
    AccumuloInputFormat.setMockInstance(job.getConfiguration(), "testmapinstance");

    AccumuloInputFormat input = new AccumuloInputFormat();
    List<InputSplit> splits = input.getSplits(job);
    assertEquals(splits.size(), 1);

    TestMapper mapper = (TestMapper) job.getMapperClass().newInstance();
    for (InputSplit split : splits) {
      RangeInputSplit risplit = (RangeInputSplit) split;
      Assert.assertEquals("root", risplit.getUsername());
      Assert.assertArrayEquals(new byte[0], risplit.getPassword());
      Assert.assertEquals("testtable", risplit.getTable());
      Assert.assertEquals(new Authorizations(), risplit.getAuths());
      Assert.assertEquals("testmapinstance", risplit.getInstanceName());

      TaskAttemptContext tac = ContextFactory.createTaskAttemptContext(job);
      RecordReader<Key,Value> reader = input.createRecordReader(split, tac);
      Mapper<Key,Value,Key,Value>.Context context = ContextFactory.createMapContext(mapper, tac, reader, null, split);
View Full Code Here

      bw.addMutation(m);
    }
    bw.close();

    JobContext job = ContextFactory.createJobContext();
    AccumuloInputFormat.setInputInfo(job.getConfiguration(), "root", "".getBytes(), "testtable2", new Authorizations());
    AccumuloInputFormat.setMockInstance(job.getConfiguration(), "testmapinstance");
    AccumuloInputFormat input = new AccumuloInputFormat();
    RangeInputSplit ris = new RangeInputSplit();
    TaskAttemptContext tac = ContextFactory.createTaskAttemptContext(job);
    RecordReader<Key,Value> rr = input.createRecordReader(ris, tac);
View Full Code Here

      bw.addMutation(m);
    }
    bw.close();

    JobContext job = ContextFactory.createJobContext();
    AccumuloInputFormat.setInputInfo(job.getConfiguration(), "root", "".getBytes(), "testtable3", new Authorizations());
    AccumuloInputFormat.setMockInstance(job.getConfiguration(), "testmapinstance");
    final String regex = ".*1.*";
    AccumuloInputFormat.setRegex(job, org.apache.accumulo.core.client.mapreduce.InputFormatBase.RegexType.ROW, regex);
    AccumuloInputFormat input = new AccumuloInputFormat();
    RangeInputSplit ris = new RangeInputSplit();
View Full Code Here

    JobContext job = ContextFactory.createJobContext();

    String username = "user", table = "table", rowRegex = "row.*", colfRegex = "colf.*", colqRegex = "colq.*";
    String valRegex = "val.*", instance = "instance";
    byte[] password = "password".getBytes();
    Authorizations auths = new Authorizations("foo");
    Collection<Pair<Text,Text>> fetchColumns = Collections.singleton(new Pair<Text,Text>(new Text("foo"), new Text("bar")));
    boolean isolated = true, localIters = true;
    int maxVersions = 5;
    Level level = Level.WARN;

View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.security.Authorizations

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.