Package org.apache.accumulo.core.security

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


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


      log.info("Not verifying bulk import test due to import failures");
      return;
    }
   
    String user = state.getConnector().whoami();
    Authorizations auths = state.getConnector().securityOperations().getUserAuthorizations(user);
    Scanner scanner = state.getConnector().createScanner(Setup.getTableName(), auths);
    scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY);
    for (Entry<Key,Value> entry : scanner) {
      byte[] value = entry.getValue().get();
      if (!Arrays.equals(value, zero)) {
View Full Code Here

    ScannerOpts scanOpts = new ScannerOpts();
    BatchScannerOpts bsOpts = new BatchScannerOpts();
    opts.parseArgs(ContinuousBatchWalker.class.getName(), args, scanOpts, bsOpts);
   
    Random r = new Random();
    Authorizations auths = opts.randomAuths.getAuths(r);

    Connector conn = opts.getConnector();
    Scanner scanner = ContinuousUtil.createScanner(conn, opts.getTableName(), auths);
    scanner.setBatchSize(scanOpts.scanBatchSize);
   
View Full Code Here

  public static void main(String[] args) throws Exception {
    ScanOpts opts = new ScanOpts();
    opts.parseArgs(Scan.class.getName(), args);
   
    Connector connector = opts.getConnector();
    Scanner scanner = connector.createScanner(opts.getTableName(), new Authorizations());
   
    if (opts.isolate) {
      scanner.enableIsolation();
    }
   
View Full Code Here

      bw.addMutation(m);
    }
   
    bw.close();
   
    Scanner scanner = getConnector().createScanner("foo", new Authorizations());
   
    setupIter(scanner);
    verify(scanner, 1, 999);
   
    BatchScanner bscanner = getConnector().createBatchScanner("foo", new Authorizations(), 3);
    bscanner.setRanges(Collections.singleton(new Range((Key) null, null)));
   
    setupIter(bscanner);
    verify(bscanner, 1, 999);
   
View Full Code Here

    Random r = new Random();

    long distance = 1000000000000l;
   
    Connector conn = opts.getConnector();
    Authorizations auths = opts.randomAuths.getAuths(r);
    Scanner scanner = ContinuousUtil.createScanner(conn, opts.getTableName(), auths);
    scanner.setBatchSize(scanOpts.scanBatchSize);
   
    double delta = Math.min(.05, .05 / (opts.numToScan / 1000.0));
   
View Full Code Here

    indexTableName = state.getString("indexTableName");
    imageTableName = state.getString("imageTableName");
   
    Connector conn = state.getConnector();
   
    Scanner indexScanner = conn.createScanner(indexTableName, new Authorizations());
    Scanner imageScanner = conn.createScanner(imageTableName, new Authorizations());
   
    String uuid = UUID.randomUUID().toString();
   
    MessageDigest alg = MessageDigest.getInstance("SHA-1");
    alg.update(uuid.getBytes(Constants.UTF8));
View Full Code Here

          break;
        case ALTER_USER:
          user = "__ALTER_USER_WITHOUT_PERM_TEST__";
          root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
          try {
            test_user_conn.securityOperations().changeUserAuthorizations(user, new Authorizations("A", "B"));
            throw new IllegalStateException("Should NOT be able to alter a user");
          } catch (AccumuloSecurityException e) {
            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED || !root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
              throw e;
          }
View Full Code Here

            throw new IllegalStateException("Should be able to delete a user");
          break;
        case ALTER_USER:
          user = "__ALTER_USER_WITH_PERM_TEST__";
          root_conn.securityOperations().createLocalUser(user, new PasswordToken(password));
          test_user_conn.securityOperations().changeUserAuthorizations(user, new Authorizations("A", "B"));
          if (root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
            throw new IllegalStateException("Should be able to alter a user");
          break;
        case SYSTEM:
          // test for system permission would go here
View Full Code Here

    @Override
    public InitialScan startScan(TInfo tinfo, TCredentials credentials, TKeyExtent textent, TRange range, List<TColumn> columns, int batchSize,
        List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations, boolean waitForWrites, boolean isolated)
        throws NotServingTabletException, ThriftSecurityException, org.apache.accumulo.core.tabletserver.thrift.TooManyFilesException {
     
      Authorizations userauths = null;
      if (!security.canScan(credentials, new String(textent.getTable(), Constants.UTF8)))
        throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
     
      userauths = security.getUserAuthorizations(credentials);
      for (ByteBuffer auth : authorizations)
        if (!userauths.contains(ByteBufferUtil.toBytes(auth)))
          throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.BAD_AUTHORIZATIONS);
     
      KeyExtent extent = new KeyExtent(textent);
     
      // wait for any writes that are in flight.. this done to ensure
      // consistency across client restarts... assume a client writes
      // to accumulo and dies while waiting for a confirmation from
      // accumulo... the client process restarts and tries to read
      // data from accumulo making the assumption that it will get
      // any writes previously made... however if the server side thread
      // processing the write from the dead client is still in progress,
      // the restarted client may not see the write unless we wait here.
      // this behavior is very important when the client is reading the
      // !METADATA table
      if (waitForWrites)
        writeTracker.waitForWrites(TabletType.type(extent));
     
      Tablet tablet = onlineTablets.get(extent);
      if (tablet == null)
        throw new NotServingTabletException(textent);
     
      ScanSession scanSession = new ScanSession();
      scanSession.user = credentials.getPrincipal();
      scanSession.extent = new KeyExtent(extent);
      scanSession.columnSet = new HashSet<Column>();
      scanSession.ssiList = ssiList;
      scanSession.ssio = ssio;
      scanSession.auths = new Authorizations(authorizations);
      scanSession.interruptFlag = new AtomicBoolean();
     
      for (TColumn tcolumn : columns) {
        scanSession.columnSet.add(new Column(tcolumn));
      }
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.