Package com.google.gerrit.server.account

Examples of com.google.gerrit.server.account.AuthRequest


      return;
    }

    username = username.trim();

    final AuthRequest req = AuthRequest.forUser(username);
    req.setPassword(password);

    final AuthResult res;
    try {
      res = accountManager.authenticate(req);
    } catch (AccountUserNameException e) {
View Full Code Here


        out.close();
      }
      return;
    }

    final AuthRequest areq = AuthRequest.forUser(user);
    final AuthResult arsp;
    try {
      arsp = accountManager.authenticate(areq);
    } catch (AccountException e) {
      log.error("Unable to authenticate user \"" + user + "\"", e);
View Full Code Here

    if (!user.matches(Account.USER_NAME_PATTERN)) {
      throw new CmdLineException(owner, "user \"" + user + "\" not found");
    }

    try {
      AuthRequest req = AuthRequest.forUser(user);
      req.setSkipAuthentication(true);
      return accountManager.authenticate(req).getAccountId();
    } catch (AccountException e) {
      throw new CmdLineException(owner, "user \"" + user + "\" not found");
    }
  }
View Full Code Here

  }

  private AuthResult create() {
    String fakeId = AccountExternalId.SCHEME_UUID + UUID.randomUUID();
    try {
      return accountManager.authenticate(new AuthRequest(fakeId));
    } catch (AccountException e) {
      getServletContext().log("cannot create new account", e);
      return null;
    }
  }
View Full Code Here

    if (m.matches()) {
      userName = m.group(1);
    } else {
      throw new ServletException("Couldn't extract username from your certificate");
    }
    final AuthRequest areq = AuthRequest.forUser(userName);
    final AuthResult arsp;
    try {
      arsp = accountManager.authenticate(areq);
    } catch (AccountException e) {
      String err = "Unable to authenticate user \"" + userName + "\"";
View Full Code Here

          + ": account inactive or not provisioned in Gerrit");
      rsp.sendError(SC_UNAUTHORIZED);
      return false;
    }

    AuthRequest whoAuth = AuthRequest.forUser(username);
    whoAuth.setPassword(password);

    try {
      AuthResult whoAuthResult = accountManager.authenticate(whoAuth);
      session.get().setUserAccountId(whoAuthResult.getAccountId(),
          AuthMethod.PASSWORD);
View Full Code Here

      log.debug("User name: " + username);
       AccountState who = accountCache.getByUsername(username);
       log.debug("AccountState " + who);
      if (who == null && username.matches("^([a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]|[a-zA-Z0-9])$")) {
        log.debug("User is not registered with Gerrit. Register now."); // This approach assumes an auth type of HTTP_LDAP
        final AuthRequest areq = AuthRequest.forUser(username);
        try {
          accountManager.authenticate(areq);
          who = accountCache.getByUsername(username);
          if (who == null) {
            log.warn("Unable to register user \"" + username
View Full Code Here

      log.debug("User name: " + username);
       AccountState who = accountCache.getByUsername(username);
       log.debug("AccountState " + who);
      if (who == null && username.matches("^([a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]|[a-zA-Z0-9])$")) {
        log.debug("User is not registered with Gerrit. Register now."); // This approach assumes an auth type of HTTP_LDAP
        final AuthRequest areq = AuthRequest.forUser(username);
        try {
          accountManager.authenticate(areq);
          who = accountCache.getByUsername(username);
          if (who == null) {
            log.warn("Unable to register user \"" + username
View Full Code Here

TOP

Related Classes of com.google.gerrit.server.account.AuthRequest

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.