Пример #1
0
  public DbUser getDatabase(String username) {

    List<DbUser> users = internalDatabase();

    for (DbUser dbUser : users) {
      if (dbUser.getUsername().equals(username) == true) {
        logger.debug("User found");
        return dbUser;
      }
    }
    logger.error("User does not exist!");
    throw new RuntimeException("User does not exist!");
  }
Пример #2
0
  /** тѕЮтДІтїќТЋ░ТЇ? */
  private List<DbUser> internalDatabase() {

    List<DbUser> users = new ArrayList<DbUser>();
    DbUser user = null;

    user = new DbUser();
    user.setUsername("admin");

    // "admin"у╗ЈУ┐ЄMD5тіат»єтљ?
    user.setPassword("21232f297a57a5a743894a0e4a801fc3");
    user.setAccess(1);

    users.add(user);

    user = new DbUser();
    user.setUsername("user");

    // "user"у╗ЈУ┐ЄMD5тіат»єтљ?
    user.setPassword("ee11cbb19052e40b07aac0ca060c23ee");
    user.setAccess(2);

    users.add(user);

    return users;
  }