Package org.apache.accumulo.core.security.thrift

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


 
  /**
   * @return this exception as a thrift exception
   */
  public ThriftSecurityException asThriftException() {
    return new ThriftSecurityException(user, errorCode);
  }
View Full Code Here


          log.debug("Failed to scan !METADATA table to wait for flush " + tableId, e);
        } catch (TabletDeletedException tde) {
          log.debug("Failed to scan !METADATA table to wait for flush " + tableId, tde);
        } catch (AccumuloSecurityException e) {
          log.warn(e.getMessage(), e);
          throw new ThriftSecurityException();
        } catch (TableNotFoundException e) {
          log.error(e.getMessage(), e);
          throw new ThriftTableOperationException();
        }
      }
View Full Code Here

    }
   
    private void authenticate(AuthInfo credentials) throws ThriftSecurityException {
      try {
        if (!authenticator.authenticateUser(credentials, credentials.user, credentials.password))
          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
      } catch (AccumuloSecurityException e) {
        throw e.asThriftException();
      }
    }
View Full Code Here

  private void checkForSystemPrivs(String request, AuthInfo credentials) throws ThriftSecurityException {
    try {
      if (!authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)) {
        LOG.warn("Got " + request + " from user: " + credentials.user);
        throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
      }
    } catch (AccumuloSecurityException e) {
      LOG.warn("Got " + request + " from unauthenticatable user: " + e.getUser());
      throw e.asThriftException();
    }
View Full Code Here

    public List<TKeyExtent> bulkImport(TInfo tinfo, AuthInfo credentials, long tid, Map<TKeyExtent,Map<String,MapFileInfo>> files, boolean setTime)
        throws ThriftSecurityException {

      try {
        if (!authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM))
          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
      } catch (AccumuloSecurityException e) {
        throw e.asThriftException();
      }

      List<TKeyExtent> failures = new ArrayList<TKeyExtent>();
View Full Code Here

      Authorizations userauths = null;

      try {
        if (!authenticator.hasTablePermission(credentials, credentials.user, new String(textent.getTable()), TablePermission.READ))
          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);

        userauths = authenticator.getUserAuthorizations(credentials, credentials.user);
        for (ByteBuffer auth : authorizations)
          if (!userauths.contains(ByteBufferUtil.toBytes(auth)))
            throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_AUTHORIZATIONS);
      } catch (AccumuloSecurityException e) {
        throw e.asThriftException();
      }

      scanCount.addAndGet(1);
View Full Code Here

      // check if user has permission to the tables
      Authorizations userauths = null;
      try {
        for (String table : tables)
          if (!authenticator.hasTablePermission(credentials, credentials.user, table, TablePermission.READ))
            throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);

        userauths = authenticator.getUserAuthorizations(credentials, credentials.user);
        for (ByteBuffer auth : authorizations)
          if (!userauths.contains(ByteBufferUtil.toBytes(auth)))
            throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_AUTHORIZATIONS);
      } catch (AccumuloSecurityException e) {
        throw e.asThriftException();
      }

      KeyExtent threadPoolExtent = null;
View Full Code Here

      // Make sure user is real
      try {
        if (!authenticator.authenticateUser(credentials, credentials.user, credentials.password)) {
          if (updateMetrics.isEnabled())
            updateMetrics.add(TabletServerUpdateMetrics.permissionErrors, 0);
          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
        }
      } catch (AccumuloSecurityException e) {
        throw e.asThriftException();
      }
View Full Code Here

    @Override
    public void update(TInfo tinfo, AuthInfo credentials, TKeyExtent tkeyExtent, TMutation tmutation) throws NotServingTabletException,
        ConstraintViolationException, ThriftSecurityException {
      try {
        if (!authenticator.hasTablePermission(credentials, credentials.user, new String(tkeyExtent.getTable()), TablePermission.WRITE))
          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
      } catch (AccumuloSecurityException e) {
        throw e.asThriftException();
      }

      KeyExtent keyExtent = new KeyExtent(tkeyExtent);
View Full Code Here

      String tableId = new String(ByteBufferUtil.toBytes(tkeyExtent.table));
      try {
        if (!authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.ALTER_TABLE)
            && !authenticator.hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM)
            && !authenticator.hasTablePermission(credentials, credentials.user, tableId, TablePermission.ALTER_TABLE))
          throw new ThriftSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
      } catch (AccumuloSecurityException e) {
        throw e.asThriftException();
      }

      KeyExtent keyExtent = new KeyExtent(tkeyExtent);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.security.thrift.ThriftSecurityException

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.