Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.AccountException


      String currentCaptcha = (String) session.getAttribute(getSessionCaptchaKeyAttribute());
      //获取用户输入的验证码
      String submitCaptcha = getCaptcha(request);
      //如果验证码不匹配,登录失败
      if (StringUtils.isEmpty(submitCaptcha) || !StringUtils.equals(currentCaptcha,submitCaptcha.toLowerCase())) {
        return onLoginFailure(this.createToken(request, response), new AccountException("验证码不正确"), request, response);
      }
   
    }
   
    return super.executeLogin(request, response);
View Full Code Here


        UsernamePasswordToken upToken = (UsernamePasswordToken) token;
        String username = upToken.getUsername();

        // Null username is invalid
        if (username == null) {
            throw new AccountException("Null usernames are not allowed by this realm.");
        }

        Connection conn = null;
        SimpleAuthenticationInfo info = null;
        try {
View Full Code Here

    String username = ((UsernamePasswordToken) token).getUsername();
    log.info("Attempting to authenticate " + username + " in DB realm...");

    // Null username is invalid
    if (username == null) {
      throw new AccountException(
          "Null usernames are not allowed by this realm.");
    }

    // Get the user with the given username. If the user is not
    // found, then they don't have an account and we throw an
View Full Code Here

  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user == null){
      throw new AccountException("Not authenticated.");
    }
   
    return new SimpleAuthenticationInfo(user, null, getName());
  }
View Full Code Here

    // if the user can authenticate we are good to go
    if (authenticateViaUrl(upToken)) {
      return buildAuthenticationInfo(upToken);
    }
    else {
      throw new AccountException("User \"" + upToken.getUsername()
          + "\" cannot be authenticated via Kenai Realm.");
    }
  }
View Full Code Here

    CUser user;
    try {
      user = configuration.readUser(upToken.getUsername());
    }
    catch (UserNotFoundException e) {
      throw new AccountException("User '" + upToken.getUsername() + "' cannot be retrieved.", e);
    }

    if (user.getPassword() == null) {
      throw new AccountException("User '" + upToken.getUsername() + "' has no password, cannot authenticate.");
    }

    if (CUser.STATUS_ACTIVE.equals(user.getStatus())) {
      //Check for legacy user that has unsalted password hash
      //Update if legacy user, and valid credentials were specified
      if (this.isLegacyUser(user) && this.isValidCredentials(upToken, user)) {
        this.reHashPassword(user, new String(upToken.getPassword()));
      }

      return this.createAuthenticationInfo(user);
    }
    else if (CUser.STATUS_DISABLED.equals(user.getStatus())) {
      throw new DisabledAccountException("User '" + upToken.getUsername() + "' is disabled.");
    }
    else {
      throw new AccountException("User '" + upToken.getUsername() + "' is in illegal status '"
          + user.getStatus() + "'.");
    }
  }
View Full Code Here

    UsernamePasswordToken upToken = (UsernamePasswordToken) token;
    String username = upToken.getUsername();

    // Null username is invalid
    if (username == null) {
        throw new AccountException("Null usernames are not allowed by this realm.");
    }
    String password = jsonDbService.getPassword(username);

    return  new SimpleAuthenticationInfo(username, password, this.getName());
  }
View Full Code Here

      }
       
        String username = token.getUsername();

        if (username == null) {
            throw new AccountException("Null usernames are not allowed by this realm.");
        }

        Connection conn = null;
        AuthenticationInfo info = null;
        try {
View Full Code Here

TOP

Related Classes of org.apache.shiro.authc.AccountException

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.