Package org.apache.accumulo.core.client

Examples of org.apache.accumulo.core.client.Connector.securityOperations()


    assertTrue(c.securityOperations().getUserAuthorizations("greg").isEmpty());
    c.securityOperations().changeUserAuthorizations("greg", new Authorizations("A".getBytes()));
    assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("A".getBytes()));
    c.securityOperations().changeUserAuthorizations("greg", new Authorizations("X", "Y", "Z"));
    assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("X".getBytes()));
    assertFalse(c.securityOperations().getUserAuthorizations("greg").contains("A".getBytes()));
  }
 
  @Test
  public void testAggregation() throws Exception {
    MockInstance mockInstance = new MockInstance();
View Full Code Here


            AccumuloConfiguration.getDefaultConfiguration());
        writer.startDefaultLocalityGroup();
      } else {
        Connector connector = opts.getConnector();
        bw = connector.createBatchWriter(opts.getTableName(), bwOpts.getBatchWriterConfig());
        connector.securityOperations().changeUserAuthorizations(opts.principal, AUTHS);
      }
      Text labBA = new Text(opts.columnVisibility.getExpression());
     
      long startTime = System.currentTimeMillis();
      for (int i = 0; i < opts.rows; i++) {
View Full Code Here

      Connector connector = opts.getConnector();
     
      byte[][] bytevals = TestIngest.generateValues(opts);
     
      Authorizations labelAuths = new Authorizations("L1", "L2", "G1", "GROUP2");
      connector.securityOperations().changeUserAuthorizations(opts.principal, labelAuths);
     
      int expectedRow = opts.startRow;
      int expectedCol = 0;
      int recsRead = 0;
     
View Full Code Here

    ClientOpts opts = new ClientOpts();
    BatchWriterOpts bwOpts = new BatchWriterOpts();
    opts.parseArgs(GCLotsOfCandidatesTest.class.getName(), args, bwOpts);
   
    Connector conn = opts.getConnector();
    conn.securityOperations().grantTablePermission(conn.whoami(), Constants.METADATA_TABLE_NAME, TablePermission.WRITE);
    BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, bwOpts.getBatchWriterConfig());
   
    for (int i = 0; i < 100000; ++i) {
      final Text emptyText = new Text("");
      Text row = new Text(String.format("%s%s%020d%s", Constants.METADATA_DELETE_FLAG_PREFIX, "/", i,
View Full Code Here

    @SuppressWarnings("unchecked")
    List<String> userNames = (List<String>) state.get("users");
   
    String userName = userNames.get(rand.nextInt(userNames.size()));
    try {
      List<byte[]> auths = new ArrayList<byte[]>(conn.securityOperations().getUserAuthorizations(userName).getAuthorizations());
     
      if (rand.nextBoolean()) {
        String authorization = String.format("a%d", rand.nextInt(5000));
        log.debug("adding authorization " + authorization);
        auths.add(authorization.getBytes());
View Full Code Here

      } else {
        if (auths.size() > 0) {
          log.debug("removing authorization " + new String(auths.remove(0)));
        }
      }
      conn.securityOperations().changeUserAuthorizations(userName, new Authorizations(auths));
    } catch (AccumuloSecurityException ex) {
      log.debug("Unable to change user authorizations: " + ex.getCause());
    }
  }
 
View Full Code Here

    String tableName = tableNames.get(rand.nextInt(tableNames.size()));
   
    try {
      if (rand.nextBoolean()) {
        log.debug("Checking systerm permission " + userName);
        conn.securityOperations().hasSystemPermission(userName, SystemPermission.values()[rand.nextInt(SystemPermission.values().length)]);
      } else {
        log.debug("Checking table permission " + userName + " " + tableName);
        conn.securityOperations().hasTablePermission(userName, tableName, TablePermission.values()[rand.nextInt(TablePermission.values().length)]);
      }
     
View Full Code Here

      if (rand.nextBoolean()) {
        log.debug("Checking systerm permission " + userName);
        conn.securityOperations().hasSystemPermission(userName, SystemPermission.values()[rand.nextInt(SystemPermission.values().length)]);
      } else {
        log.debug("Checking table permission " + userName + " " + tableName);
        conn.securityOperations().hasTablePermission(userName, tableName, TablePermission.values()[rand.nextInt(TablePermission.values().length)]);
      }
     
    } catch (AccumuloSecurityException ex) {
      log.debug("Unable to check permissions: " + ex.getCause());
    }
View Full Code Here

    if (!isConnectorInfoSet(job))
      throw new IOException("Connector info has not been set.");
    try {
      // if the instance isn't configured, it will complain here
      Connector c = getInstance(job).getConnector(getPrincipal(job), CredentialHelper.extractToken(getTokenClass(job), getToken(job)));
      if (!c.securityOperations().authenticateUser(getPrincipal(job), CredentialHelper.extractToken(getTokenClass(job), getToken(job))))
        throw new IOException("Unable to authenticate user");
    } catch (AccumuloException e) {
      throw new IOException(e);
    } catch (AccumuloSecurityException e) {
      throw new IOException(e);
View Full Code Here

    if (!isConnectorInfoSet(job))
      throw new IOException("Connector info has not been set.");
    try {
      // if the instance isn't configured, it will complain here
      Connector c = getInstance(job).getConnector(getPrincipal(job), CredentialHelper.extractToken(getTokenClass(job), getToken(job)));
      if (!c.securityOperations().authenticateUser(getPrincipal(job), CredentialHelper.extractToken(getTokenClass(job), getToken(job))))
        throw new IOException("Unable to authenticate user");
    } catch (AccumuloException e) {
      throw new IOException(e);
    } catch (AccumuloSecurityException e) {
      throw new IOException(e);
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.