Examples of TCredentials


Examples of org.apache.accumulo.core.security.thrift.TCredentials

    ZooKeeperInstance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector connector = instance.getConnector("root", password);

    BatchWriterConfig config = new BatchWriterConfig();

    TCredentials creds = CredentialHelper.create("root", password, instance.getInstanceID());
    MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS);
    boolean mutationsRejected = false;

    try {
      final String table1 = "testOfflineTable_table1", table2 = "testOfflineTable_table2";
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

    ZooKeeperInstance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector connector = instance.getConnector("root", password);

    BatchWriterConfig config = new BatchWriterConfig();
   
    TCredentials creds = CredentialHelper.create("root", password, instance.getInstanceID());
    MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS);
    boolean mutationsRejected = false;

    try {
      final String table1 = "testOfflineTableWithCache_table1", table2 = "testOfflineTableWithCache_table2";
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

    ZooKeeperInstance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector connector = instance.getConnector("root", password);

    BatchWriterConfig config = new BatchWriterConfig();

    TCredentials creds = CredentialHelper.create("root", password, instance.getInstanceID());
    MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 0, TimeUnit.SECONDS);
    boolean mutationsRejected = false;

    try {
      final String table1 = "testOfflineTableWithoutCache_table1", table2 = "testOfflineTableWithoutCache_table2";
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

   
    writerCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).maximumSize(1000).removalListener(new CloseWriter()).build();
  }
 
  protected Connector getConnector(ByteBuffer login) throws Exception {
    TCredentials user = CredentialHelper.fromByteArray(ByteBufferUtil.toBytes(login));
    if (user == null)
      throw new org.apache.accumulo.proxy.thrift.AccumuloSecurityException("unknown user");
    Connector connector = instance.getConnector(user.getPrincipal(), CredentialHelper.extractToken(user));
    return connector;
  }
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

 
  @Override
  public ByteBuffer login(String principal, Map<String,String> loginProperties) throws org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
    try {
      AuthenticationToken token = getToken(principal, loginProperties);
      TCredentials credential = CredentialHelper.create(principal, token, instance.getInstanceID());
      ByteBuffer login = ByteBuffer.wrap(CredentialHelper.asByteArray(credential));
      getConnector(login); // check to make sure user exists
      return login;
    } catch (AccumuloSecurityException e) {
      throw new org.apache.accumulo.proxy.thrift.AccumuloSecurityException(e.toString());
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

    deletes = new String[] {"~blip/1636/b-0001", "~del/1636/b-0001/I0000"};
    test1(metadata, deletes, 1, 0);
  }
 
  private void test1(String[] metadata, String[] deletes, int expectedInitial, int expected) throws Exception {
    TCredentials auth = CredentialHelper.create("root", new PasswordToken(new byte[0]), "instance");
   
    Instance instance = new MockInstance();
    FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance());
   
    load(instance, metadata, deletes);
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

    gc.confirmDeletes(candidates);
    Assert.assertEquals(expected, candidates.size());
  }
 
  private void load(Instance instance, String[] metadata, String[] deletes) throws Exception {
    TCredentials credential = CredentialHelper.create("root", new PasswordToken(new byte[0]), "instance");
   
    Scanner scanner = instance.getConnector(credential.getPrincipal(), CredentialHelper.extractToken(credential)).createScanner(Constants.METADATA_TABLE_NAME,
        Constants.NO_AUTHS);
    int count = 0;
    for (@SuppressWarnings("unused")
    Entry<Key,Value> entry : scanner) {
      count++;
    }
   
    // ensure there is no data from previous test
    Assert.assertEquals(0, count);
   
    Connector conn = instance.getConnector(credential.getPrincipal(), CredentialHelper.extractToken(credential));
    BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
    for (String line : metadata) {
      String[] parts = line.split(" ");
      String[] columnParts = parts[1].split(":");
      Mutation m = new Mutation(parts[0]);
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

          log.error("Failed to add log recovery watcher back", e);
        }
      }
    });
   
    TCredentials systemAuths = SecurityConstants.getSystemCredentials();
    final TabletStateStore stores[] = {
        new ZooTabletStateStore(new ZooStore(zroot)),
        new RootTabletStateStore(instance, systemAuths, this),
        new MetaDataStateStore(instance, systemAuths, this)
    };
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

  }
 
  @Override
  public void changeLocalUserPassword(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
    PasswordToken token = new PasswordToken(password);
    TCredentials toChange = CredentialHelper.createSquelchError(principal, token, credentials.instanceId);
    security.changePassword(credentials, toChange);
  }
View Full Code Here

Examples of org.apache.accumulo.core.security.thrift.TCredentials

  }
 
  @Override
  public void createLocalUser(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
    PasswordToken token = new PasswordToken(password);
    TCredentials newUser = CredentialHelper.createSquelchError(principal, token, credentials.instanceId);
    security.createUser(credentials, newUser, new Authorizations());
  }
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.