Package org.apache.accumulo.core.client

Examples of org.apache.accumulo.core.client.AccumuloSecurityException


    }
  }
 
  private void verify(AuthInfo credentials, boolean match) throws ThriftSecurityException {
    if (!match)
      throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED).asThriftException();
  }
View Full Code Here


      } catch (TApplicationException tae) {
        updateServerErrors(location, tae);
        throw new AccumuloServerException(location, tae);
      } catch (ThriftSecurityException e) {
        updateAuthorizationFailures(tabMuts.keySet());
        throw new AccumuloSecurityException(e.user, e.code, e);
      } catch (TException e) {
        throw new IOException(e);
      } catch (NoSuchScanIDException e) {
        throw new IOException(e);
      } finally {
View Full Code Here

        TSerializer ts = new TSerializer();
        try {
            return ts.serialize(cred);
        } catch (TException e) {
            // This really shouldn't happen
            throw new AccumuloSecurityException(cred.getUser(), SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
        }
    }
View Full Code Here

            AuthInfo toRet = new AuthInfo();
            td.deserialize(toRet, serializedCredential);
            return toRet;
        } catch (TException e) {
            // This really shouldn't happen
            throw new AccumuloSecurityException("unknown", SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
        }
    }
View Full Code Here

      shellState.getReader().printNewline();
      return 0;
    } // user canceled
   
    if (!shellState.getConnector().securityOperations().authenticateUser(currentUser, new PasswordToken(oldPassword)))
      throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
   
    password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
    if (password == null) {
      shellState.getReader().printNewline();
      return 0;
View Full Code Here

            for (Entry<Key,Value> entry : scanner)
              i += 1 + entry.getKey().getRowData().length();
            if (i != 0)
              throw new IllegalStateException("Should NOT be able to read from the table");
          } catch (RuntimeException e) {
            AccumuloSecurityException se = (AccumuloSecurityException) e.getCause();
            if (se.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
              throw se;
          }
          break;
        case WRITE:
          try {
            writer = test_user_conn.createBatchWriter(TEST_TABLE, new BatchWriterConfig());
            m = new Mutation(new Text("row"));
            m.put(new Text("a"), new Text("b"), new Value("c".getBytes()));
            writer.addMutation(m);
            try {
              writer.close();
            } catch (MutationsRejectedException e1) {
              if (e1.getAuthorizationFailuresMap().size() > 0)
                throw new AccumuloSecurityException(test_user_conn.whoami(), org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.PERMISSION_DENIED,
                    e1);
            }
            throw new IllegalStateException("Should NOT be able to write to a table");
          } catch (AccumuloSecurityException e) {
            if (e.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
View Full Code Here

  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

        return Translator.translate(failures, Translator.TKET);
      } finally {
        ThriftUtil.returnClient((TServiceClient) client);
      }
    } catch (ThriftSecurityException e) {
      throw new AccumuloSecurityException(e.user, e.code, e);
    } catch (Throwable t) {
      t.printStackTrace();
      throw new AccumuloException(t);
    }
  }
View Full Code Here

 
  public void initializeSecurity(TCredentials credentials, String rootPrincipal, byte[] token) throws AccumuloSecurityException, ThriftSecurityException {
    authenticate(credentials);
   
    if (!credentials.getPrincipal().equals(SecurityConstants.SYSTEM_PRINCIPAL))
      throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
   
    authenticator.initializeSecurity(credentials, rootPrincipal, token);
    authorizor.initializeSecurity(credentials, rootPrincipal);
    permHandle.initializeSecurity(credentials, rootPrincipal);
    try {
View Full Code Here

  private AuthenticationToken reassembleToken(TCredentials toAuth) throws AccumuloSecurityException {
    String tokenClass = toAuth.getTokenClassName();
    if (authenticator.validTokenClass(tokenClass)) {
      return CredentialHelper.extractToken(toAuth);
    }
    throw new AccumuloSecurityException(toAuth.getPrincipal(), SecurityErrorCode.INVALID_TOKEN);
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.AccumuloSecurityException

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.