Package org.apache.accumulo.core.security

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


          log.error("Failed to add log recovery watcher back", e);
        }
      }
    });

    Credentials systemCreds = SystemCredentials.get();
    watchers.add(new TabletGroupWatcher(this, new MetaDataStateStore(instance, systemCreds, this), null));
    watchers.add(new TabletGroupWatcher(this, new RootTabletStateStore(instance, systemCreds, this), watchers.get(0)));
    watchers.add(new TabletGroupWatcher(this, new ZooTabletStateStore(new ZooStore(zroot)), watchers.get(1)));
    for (TabletGroupWatcher watcher : watchers) {
      watcher.start();
View Full Code Here


  protected void authenticate(TCredentials credentials) throws ThriftSecurityException {
    if (!credentials.getInstanceId().equals(HdfsZooInstance.getInstance().getInstanceID()))
      throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.INVALID_INSTANCEID);

    Credentials creds = Credentials.fromThrift(credentials);
    if (isSystemUser(credentials)) {
      if (!(SystemCredentials.get().equals(creds))) {
        throw new ThriftSecurityException(creds.getPrincipal(), SecurityErrorCode.BAD_CREDENTIALS);
      }
    } else {
      try {
        if (!authenticator.authenticateUser(creds.getPrincipal(), creds.getToken())) {
          throw new ThriftSecurityException(creds.getPrincipal(), SecurityErrorCode.BAD_CREDENTIALS);
        }
      } catch (AccumuloSecurityException e) {
        log.debug(e);
        throw e.asThriftException();
      }
View Full Code Here

    canAskAboutUser(credentials, toAuth.getPrincipal());
    // User is already authenticated from canAskAboutUser
    if (credentials.equals(toAuth))
      return true;
    try {
      Credentials toCreds = Credentials.fromThrift(toAuth);
      return authenticator.authenticateUser(toCreds.getPrincipal(), toCreds.getToken());
    } catch (AccumuloSecurityException e) {
      throw e.asThriftException();
    }
  }
View Full Code Here

      throw new IllegalArgumentException("Couldn't open password file called \"" + tokenFile + "\".");
    }
    java.util.Scanner fileScanner = new java.util.Scanner(in);
    try {
      while (fileScanner.hasNextLine()) {
        Credentials creds = Credentials.deserialize(fileScanner.nextLine());
        if (principal.equals(creds.getPrincipal())) {
          return creds.getToken();
        }
      }
      throw new IllegalArgumentException("Couldn't find token for user \"" + principal + "\" in file \"" + tokenFile + "\"");
    } finally {
      if (fileScanner != null && fileScanner.ioException() == null)
View Full Code Here

    String userTableName = "A";
    MockInstance instance = new MockInstance("metadataTest");
    Connector connector = instance.getConnector("root", new PasswordToken(""));
    connector.tableOperations().create(userTableName);
    String userTableId = connector.tableOperations().tableIdMap().get(userTableName);
    Credentials credentials = new Credentials("root", new PasswordToken(""));
   
    MetadataServicer ms = MetadataServicer.forTableId(instance, credentials, RootTable.ID);
    assertTrue(ms instanceof ServicerForRootTable);
    assertFalse(ms instanceof TableMetadataServicer);
    assertEquals(RootTable.ID, ms.getServicedTableId());
View Full Code Here

    connector = getConnector();
    mtbw = getMultiTableBatchWriter(60);
  }

  public MultiTableBatchWriter getMultiTableBatchWriter(long cacheTimeoutInSeconds) {
    return new MultiTableBatchWriterImpl(connector.getInstance(), new Credentials("root", new PasswordToken(getStaticCluster().getConfig().getRootPassword())),
        new BatchWriterConfig(), cacheTimeoutInSeconds, TimeUnit.SECONDS);
  }
View Full Code Here

    return getConnector(user, ByteBufferUtil.toBytes(pass));
  }

  @Override
  public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
    return new ConnectorImpl(this, new Credentials(principal, token));
  }
View Full Code Here

  public boolean getNamespaceExists() {
    return Boolean.parseBoolean(state.getString(namespaceExists));
  }

  public TCredentials getSysCredentials() {
    return new Credentials(getSysUserName(), getSysToken()).toThrift(this.state.getInstance());
  }
View Full Code Here

  public TCredentials getSysCredentials() {
    return new Credentials(getSysUserName(), getSysToken()).toThrift(this.state.getInstance());
  }

  public TCredentials getTabCredentials() {
    return new Credentials(getTabUserName(), getTabToken()).toThrift(this.state.getInstance());
  }
View Full Code Here

  @Test(timeout = 5 * 60 * 1000)
  public void test() throws Exception {
    // make some tablets, spread 'em around
    Connector c = getConnector();
    Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
    String table = this.getUniqueNames(1)[0];
    c.securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
    c.securityOperations().grantTablePermission("root", RootTable.NAME, TablePermission.WRITE);
    c.tableOperations().create(table);
    SortedSet<Text> partitions = new TreeSet<Text>();
View Full Code Here

TOP

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

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.