Package org.apache.hadoop.hbase.stargate

Examples of org.apache.hadoop.hbase.stargate.User


    }
    boolean admin = conf.getBoolean("stargate.auth.user." + name + ".admin",
      false);
    boolean disabled = conf.getBoolean("stargate.auth.user." + name + ".disabled",
      false);
    return new User(name, token, admin, disabled);
  }
View Full Code Here


    boolean disabled = false;
    value = result.getValue(USER, DISABLED);
    if (value != null) {
      disabled = Bytes.toBoolean(value);
    }
    return new User(name, token, admin, disabled);
  }
View Full Code Here

        results = userFetchStmt.executeQuery();
      }
      if (!results.next()) {
        return null;
      }
      return new User(results.getString(1), token, results.getBoolean(2),
        results.getBoolean(3));
    } catch (SQLException e) {
      connection = null;
      if (++retries > MAX_RETRIES) {
        throw new IOException(e);
View Full Code Here

        return null;
      }
      UserModel model =
        unmarshaller.unmarshalFromJSON(new ByteArrayInputStream(data),
          UserModel.class);
      return new User(model.name, token, model.admin, model.disabled);
    } catch (KeeperException.NoNodeException e) {
      return null;
    } catch (Exception e) {
      throw new IOException(e);
    }
View Full Code Here

    assertFalse(user.isAdmin());
    assertFalse(user.isDisabled());
  }

  public void testGetDisabledUser() throws Exception {
    User user = authenticator.getUserForToken(DISABLED_TOKEN);
    assertNotNull(user);
    assertEquals(user.getName(), DISABLED_USERNAME);
    assertFalse(user.isAdmin());
    assertTrue(user.isDisabled());
  }
View Full Code Here

    }
    authenticator = new HTableAuthenticator(conf, TABLE);
  }

  public void testGetUserUnknown() throws Exception {
    User user = authenticator.getUserForToken(UNKNOWN_TOKEN);
    assertNull(user);
  }
View Full Code Here

    User user = authenticator.getUserForToken(UNKNOWN_TOKEN);
    assertNull(user);
  }

  public void testGetAdminUser() throws Exception {
    User user = authenticator.getUserForToken(ADMIN_TOKEN);
    assertNotNull(user);
    assertEquals(user.getName(), ADMIN_USERNAME);
    assertTrue(user.isAdmin());
    assertFalse(user.isDisabled());
  }
View Full Code Here

    assertTrue(user.isAdmin());
    assertFalse(user.isDisabled());
  }

  public void testGetPlainUser() throws Exception {
    User user = authenticator.getUserForToken(USER_TOKEN);
    assertNotNull(user);
    assertEquals(user.getName(), USER_USERNAME);
    assertFalse(user.isAdmin());
    assertFalse(user.isDisabled());
  }
View Full Code Here

    assertFalse(user.isAdmin());
    assertFalse(user.isDisabled());
  }

  public void testGetDisabledUser() throws Exception {
    User user = authenticator.getUserForToken(DISABLED_TOKEN);
    assertNotNull(user);
    assertEquals(user.getName(), DISABLED_USERNAME);
    assertFalse(user.isAdmin());
    assertTrue(user.isDisabled());
  }
View Full Code Here

    cacheControl.setNoCache(true);
    cacheControl.setNoTransform(false);
  }

  private final User auth(final String token) throws IOException {
    User user = servlet.getAuthenticator().getUserForToken(token);
    if (user == null || user.isDisabled()) {
      throw new WebApplicationException(Response.Status.FORBIDDEN);
    }
    return user;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.stargate.User

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.