Package org.waveprotocol.box.server.account

Examples of org.waveprotocol.box.server.account.HumanAccountDataImpl


  protected void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    AccountStore store = new MemoryStore();
    HumanAccountData account =
        new HumanAccountDataImpl(USER, new PasswordDigest("password".toCharArray()));
    store.putAccount(account);

    servlet = new AuthenticationServlet(store, AuthTestUtil.makeConfiguration(),
        manager, "examPLe.com", false, "", false, false, welcomeBot, "UA-someid");
    AccountStoreHolder.init(store, "eXaMple.com");
View Full Code Here


  @Override
  protected void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    AccountStore store = new MemoryStore();
    account = new HumanAccountDataImpl(ParticipantId.ofUnsafe("tubes@example.com"));
    store.putAccount(account);
    sessionManager = new SessionManagerImpl(store, jettySessionManager);
  }
View Full Code Here

      byte[] salt = (byte[]) digestObj.get(PASSWORD_SALT_FIELD);
      byte[] digest = (byte[]) digestObj.get(PASSWORD_DIGEST_FIELD);
      passwordDigest = PasswordDigest.from(salt, digest);
    }

    return new HumanAccountDataImpl(id, passwordDigest);
  }
View Full Code Here

      AccountData account = accountStore.getAccount(participant);
      HumanAccountData humanAccount;
      if (account != null) {
        humanAccount = account.asHuman();
      } else {
        humanAccount = new HumanAccountDataImpl(participant);
      }
      humanAccount.setLocale(locale);
      accountStore.putAccount(humanAccount);
    } catch (PersistenceException ex) {
      throw new IOException(ex);
View Full Code Here

    return id;
  }

  public static boolean createAccountIfMissing(AccountStore accountStore, ParticipantId id,
      PasswordDigest password, WelcomeRobot welcomeBot) {
    HumanAccountDataImpl account = new HumanAccountDataImpl(id, password);
    try {
      LOG.info("Registering new account for" + id);
      accountStore.putAccount(account);
    } catch (PersistenceException e) {
      LOG.severe("Failed to cretaea new account for " + id, e);
      return false;
    }
    try {
      welcomeBot.greet(account.getId());
    } catch (IOException e) {
      LOG.warning("Failed to create a welcome wavelet for " + id, e);;
    }
    return true;
  }
View Full Code Here

  @Override
  public AccountData getAccount(ParticipantId id) {
    AccountData account = accounts.get(id);

    if (account == null && !id.getAddress().startsWith("xxx")) {
      account = new HumanAccountDataImpl(id, new PasswordDigest("".toCharArray()));
      accounts.put(id, account);
    }

    return account;
  }
View Full Code Here

  }

  private static HumanAccountData deserialize(String account_id, ProtoHumanAccountData data) {
    ParticipantId id = ParticipantId.ofUnsafe(account_id);
    if (data.hasPasswordDigest()) {
      return new HumanAccountDataImpl(id, deserialize(data.getPasswordDigest()));
    } else {
      return new HumanAccountDataImpl(id);
    }
  }
View Full Code Here

    if (password == null) {
      // Register the user with an empty password.
      password = "";
    }

    HumanAccountDataImpl account =
      new HumanAccountDataImpl(id, new PasswordDigest(password.toCharArray()));
    try {
      accountStore.putAccount(account);
    } catch (PersistenceException e) {
      LOG.severe("Failed to create new account for " + id, e);
      return "An unexpected error occured while trying to create the account";
    }
    try {
      welcomeBot.greet(account.getId());
    } catch (IOException e) {
      LOG.warning("Failed to create a welcome wavelet for " + id, e);
    }
    return null;
  }
View Full Code Here

  @Override
  public AccountData getAccount(ParticipantId id) {
    AccountData account = accounts.get(id);

    if (account == null && !id.getAddress().startsWith("xxx")) {
      account = new HumanAccountDataImpl(id, new PasswordDigest("".toCharArray()));
      accounts.put(id, account);
    }

    return account;
  }
View Full Code Here

  }
 
  private static HumanAccountData deserialize(String account_id, ProtoHumanAccountData data) {
    ParticipantId id = ParticipantId.ofUnsafe(account_id);
    if (data.hasPasswordDigest()) {
      return new HumanAccountDataImpl(id, deserialize(data.getPasswordDigest()));
    } else {
      return new HumanAccountDataImpl(id);
    }
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.box.server.account.HumanAccountDataImpl

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.