Examples of TCredentials


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

 
  @Override
  public List<String> bulkImportFiles(TInfo tinfo, final TCredentials tikw, final long tid, final String tableId, final List<String> files,
      final String errorDir, final boolean setTime) throws ThriftSecurityException, ThriftTableOperationException, TException {
    try {
      final TCredentials credentials = new TCredentials(tikw);
      if (!security.hasSystemPermission(credentials, credentials.getPrincipal(), SystemPermission.SYSTEM))
        throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
      return transactionWatcher.run(Constants.BULK_ARBITRATOR_TYPE, tid, new Callable<List<String>>() {
        @Override
        public List<String> call() throws Exception {
          return BulkImporter.bulkLoad(new ServerConfiguration(instance).getConfiguration(), instance, credentials, tid, tableId, files, errorDir, setTime);
        }
View Full Code Here

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

        } else
          initiateMinor = true;
      }
     
      if (updateMetadata) {
        TCredentials creds = SecurityConstants.getSystemCredentials();
        // if multiple threads were allowed to update this outside of a sync block, then it would be
        // a race condition
        MetadataTable.updateTabletFlushID(extent, tableFlushID, creds, tabletServer.getLock());
      } else if (initiateMinor)
        initiateMinorCompaction(tableFlushID, MinorCompactionReason.USER);
View Full Code Here

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

public class CredentialHelper {
  static Logger log = Logger.getLogger(CredentialHelper.class);
 
  public static TCredentials create(String principal, AuthenticationToken token, String instanceID) throws AccumuloSecurityException {
    String className = token.getClass().getName();
    return new TCredentials(principal, className, ByteBuffer.wrap(toBytes(token)), instanceID);
  }
View Full Code Here

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

  public static TCredentials fromByteArray(byte[] serializedCredential) throws AccumuloSecurityException {
    if (serializedCredential == null)
      return null;
    TDeserializer td = new TDeserializer();
    try {
      TCredentials toRet = new TCredentials();
      td.deserialize(toRet, serializedCredential);
      return toRet;
    } catch (TException e) {
      // This really shouldn't happen
      log.error(e, e);
View Full Code Here

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

        String tableId = null;
        tl = getTabletLocator(job);
        // its possible that the cache could contain complete, but old information about a tables tablets... so clear it
        tl.invalidateCache();
        while (!tl.binRanges(ranges, binnedRanges,
            new TCredentials(getPrincipal(job), getTokenClass(job), ByteBuffer.wrap(getToken(job)), getInstance(job).getInstanceID())).isEmpty()) {
          if (!(instance instanceof MockInstance)) {
            if (tableId == null)
              tableId = Tables.getTableId(instance, tableName);
            if (!Tables.exists(instance, tableId))
              throw new TableDeletedException(tableId);
View Full Code Here

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

        log.debug("Creating connector with user: " + user);
        Connector conn = instance.getConnector(user, CredentialHelper.extractToken(tokenClass, password));
        log.debug("Creating scanner for table: " + getInputTableName(job));
        log.debug("Authorizations are: " + authorizations);
        if (isOfflineScan(job)) {
          scanner = new OfflineScanner(instance, new TCredentials(user, tokenClass, ByteBuffer.wrap(password), instance.getInstanceID()), Tables.getTableId(
              instance, getInputTableName(job)), authorizations);
        } else {
          scanner = conn.createScanner(getInputTableName(job), authorizations);
        }
        if (isIsolated(job)) {
View Full Code Here

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

        String tableId = null;
        tl = getTabletLocator(context);
        // its possible that the cache could contain complete, but old information about a tables tablets... so clear it
        tl.invalidateCache();
        while (!tl.binRanges(ranges, binnedRanges,
            new TCredentials(getPrincipal(context), getTokenClass(context), ByteBuffer.wrap(getToken(context)), getInstance(context).getInstanceID()))
            .isEmpty()) {
          if (!(instance instanceof MockInstance)) {
            if (tableId == null)
              tableId = Tables.getTableId(instance, tableName);
            if (!Tables.exists(instance, tableId))
View Full Code Here

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

        log.debug("Creating connector with user: " + principal);
        Connector conn = instance.getConnector(principal, CredentialHelper.extractToken(tokenClass, token));
        log.debug("Creating scanner for table: " + getInputTableName(attempt));
        log.debug("Authorizations are: " + authorizations);
        if (isOfflineScan(attempt)) {
          scanner = new OfflineScanner(instance, new TCredentials(principal, tokenClass, ByteBuffer.wrap(token), instance.getInstanceID()), Tables.getTableId(
              instance, getInputTableName(attempt)), authorizations);
        } else {
          scanner = conn.createScanner(getInputTableName(attempt), authorizations);
        }
        if (isIsolated(attempt)) {
View Full Code Here

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

  }
 
  @Override
  public boolean authenticateUser(final String principal, final AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
    ArgumentChecker.notNull(principal, token);
    final TCredentials toAuth = CredentialHelper.create(principal, token, instance.getInstanceID());
    return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
      @Override
      public Boolean execute(ClientService.Client client) throws Exception {
        return client.authenticateUser(Tracer.traceInfo(), credentials, toAuth);
      }
View Full Code Here

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

  }
 
  @Override
  public void changeLocalUserPassword(final String principal, final PasswordToken token) throws AccumuloException, AccumuloSecurityException {
    ArgumentChecker.notNull(principal, token);
    final TCredentials toChange = CredentialHelper.create(principal, token, instance.getInstanceID());
    execute(new ClientExec<ClientService.Client>() {
      @Override
      public void execute(ClientService.Client client) throws Exception {
        client.changeLocalUserPassword(Tracer.traceInfo(), credentials, principal, ByteBuffer.wrap(token.getPassword()));
      }
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.