Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.UnknownAccountException


            try {
                currentUser.login(token);
                LOG.debug("Current user {} successfully authenticated", currentUser.getPrincipal());
            } catch (UnknownAccountException uae) {
                throw new UnknownAccountException("Authentication Failed. There is no user with username of " + token.getPrincipal(), uae.getCause());
            } catch (IncorrectCredentialsException ice) {
                throw new IncorrectCredentialsException("Authentication Failed. Password for account " + token.getPrincipal() + " was incorrect!", ice.getCause());
            } catch (LockedAccountException lae) {
                throw new LockedAccountException("Authentication Failed. The account for username " + token.getPrincipal() + " is locked."
                        + "Please contact your administrator to unlock it.", lae.getCause());
View Full Code Here


           
            try {
                currentUser.login(token);
                LOG.debug("Current User {} successfully authenticated", currentUser.getPrincipal());
            } catch (UnknownAccountException uae) {
                throw new UnknownAccountException("Authentication Failed. There is no user with username of " + token.getPrincipal(), uae.getCause());
            } catch (IncorrectCredentialsException ice) {
                throw new IncorrectCredentialsException("Authentication Failed. Password for account " + token.getPrincipal() + " was incorrect!", ice.getCause());
            } catch (LockedAccountException lae) {
                throw new LockedAccountException("Authentication Failed. The account for username " + token.getPrincipal() + " is locked."
                    + "Please contact your administrator to unlock it.", lae.getCause());
View Full Code Here

      else {
        throw new IncorrectCredentialsException("User [" + userId + "] bad credentials.");
      }
    }
    catch (UserNotFoundException e) {
      throw new UnknownAccountException("User [" + userId + "] not found.");
    }
  }
View Full Code Here

            throw new AuthenticationException("Database error: " + e.getMessage());
        }

        if (resolvedUser == null) {
            FireLogger.logSevere("Realm {0} found no match for user {1}", getName(), username);
            throw new UnknownAccountException("Unable to locate user: " + username);
        }

        // Extract password and check for match
        Password resolvedPassword;
        try {
            resolvedPassword = passwordManager.findPassword(resolvedUser);

        } catch (Exception e) {
            FireLogger.logSevere("Realm {0} has encountered a database problem: {1}", getName(), e.getClass());
            throw new AuthenticationException("Database error: " + e.getMessage());
        }

         // If the password does not exist, the user will have to create a new one
        if (resolvedPassword == null) {
            FireLogger.logSevere("Realm {0} found no matching password for user {1}", getName(), username);
            throw new UnknownAccountException("Password for account could not be found. New password must be created");
        }

        FireLogger.logInfo("Realm {0} generated SimpleAuthenticationToken for user {1}", getName(), username);

        return new SimpleAuthenticationInfo(resolvedUser.getEmail(),
View Full Code Here

        if (info == null) {
            String msg = "Realm [" + realm + "] could not find any associated account data for the submitted " +
                    "AuthenticationToken [" + token + "].  The [" + getClass().getName() + "] implementation requires " +
                    "all configured realm(s) to acquire valid account data for a submitted token during the " +
                    "log-in process.";
            throw new UnknownAccountException(msg);
        }

        log.debug("Account successfully authenticated using realm [{}]", realm);

        // If non-null account is returned, then the realm was able to authenticate the
View Full Code Here

            try {
                currentUser.login(token);
                LOG.debug("Current user {} successfully authenticated", currentUser.getPrincipal());
            } catch (UnknownAccountException uae) {
                throw new UnknownAccountException("Authentication Failed. There is no user with username of " + token.getPrincipal(), uae.getCause());
            } catch (IncorrectCredentialsException ice) {
                throw new IncorrectCredentialsException("Authentication Failed. Password for account " + token.getPrincipal() + " was incorrect!", ice.getCause());
            } catch (LockedAccountException lae) {
                throw new LockedAccountException("Authentication Failed. The account for username " + token.getPrincipal() + " is locked."
                        + "Please contact your administrator to unlock it.", lae.getCause());
View Full Code Here

                currentUser.login(token);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Current User " + currentUser.getPrincipal() + " successfully authenticated");
                }
            } catch (UnknownAccountException uae) {
                throw new UnknownAccountException("Authentication Failed. There is no user with username of " + token.getPrincipal(), uae.getCause());
            } catch (IncorrectCredentialsException ice) {
                throw new IncorrectCredentialsException("Authentication Failed. Password for account " + token.getPrincipal() + " was incorrect!", ice.getCause());
            } catch (LockedAccountException lae) {
                throw new LockedAccountException("Authentication Failed. The account for username " + token.getPrincipal() + " is locked."
                    + "Please contact your administrator to unlock it.", lae.getCause());
View Full Code Here

            conn = dataSource.getConnection();

            String password = getPasswordForUser(conn, username);

            if (password == null) {
                throw new UnknownAccountException("No account found for user [" + username + "]");
            }

            SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(username, password, getName());
           
            simpleAuthenticationInfo.setCredentialsSalt(ByteSource.Util.bytes(username));
View Full Code Here

TOP

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

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.