public java.lang.Object getFieldValue(_Fields field) { switch (field) { case USER: return getUser(); case CODE: return getCode(); } throw new java.lang.IllegalStateException(); }
/** * Construct a user-facing exception from a serialized version. * * @param thrift * a serialized version */ public AccumuloSecurityException(final ThriftSecurityException thrift) { this(thrift.getUser(), thrift.getCode(), thrift); }
@Override public synchronized void dropUser(String user) throws AccumuloSecurityException { final String encodedUser = Base64.getEncoder().encodeToString(user.getBytes(UTF_8)); try { zkAuthenticator.dropUser(encodedUser); } catch (AccumuloSecurityException e) { throw new AccumuloSecurityException(user, e.asThriftException().getCode(), e.getCause()); } }
/** * Inspects the {@link ThriftSecurityException} and throws a {@link ThriftTableOperationException} * if the {@link SecurityErrorCode} on the {@link ThriftSecurityException} was * {code}TABLE_DOESNT_EXIST{code}. If the {@link ThriftSecurityException} is thrown because a * table doesn't exist anymore, clients will likely see an {@link AccumuloSecurityException} * instead of a {@link TableNotFoundException} as expected. If the {@link ThriftSecurityException} * has a different {@link SecurityErrorCode}, this method does nothing and expects the caller to * properly handle the original exception. * * @param e * A caught ThriftSecurityException * @param tableId * Table ID being operated on, or null * @param tableName * Table name being operated on, or null * @param op * The TableOperation the Master was attempting to perform * @throws ThriftTableOperationException * Thrown if {@code e} was thrown because {@link SecurityErrorCode#TABLE_DOESNT_EXIST} */ private void throwIfTableMissingSecurityException(ThriftSecurityException e, Table.ID tableId, String tableName, TableOperation op) throws ThriftTableOperationException { // ACCUMULO-3135 Table can be deleted after we get table ID but before we can check permission if (e.isSetCode() && e.getCode() == SecurityErrorCode.TABLE_DOESNT_EXIST) { throw new ThriftTableOperationException(tableId.canonicalID(), tableName, op, TableOperationExceptionType.NOTFOUND, "Table no longer exists"); } }
throw new AccumuloSecurityException(base.getUser(), base.asThriftException().getCode(), base.getTableInfo(), excep); } else if (excep instanceof AccumuloServerException) {
us.authTimes.addStat(t2 - t1); us.currentTablet = null; us.authFailures.put(keyExtent, e.getCode()); if (updateMetrics.isEnabled()) updateMetrics.add(TabletServerUpdateMetrics.PERMISSION_ERRORS, 0);
throw new AccumuloSecurityException(e.getUser(), e.getCode()); } catch (TTransportException e) {
_createUser(credentials, creds); } catch (ThriftSecurityException e) { if (e.getCode() != SecurityErrorCode.USER_EXISTS) {
context.getCredentials().getPrincipal(), tse.getCode(), Tables.getPrintableTableInfoFromId(context, tableId), tse); queueException(location, cmidToCm, ase);
switch (e.getCode()) { case TABLE_DOESNT_EXIST: throw new TableNotFoundException(tableId.canonicalID(), null, e.getMessage(), e);
switch (e.getCode()) { case TABLE_DOESNT_EXIST: throw new TableNotFoundException(null, tableOrNamespaceName,