Package org.apache.shiro.authc

Examples of org.apache.shiro.authc.AuthenticationException


                    Connection connection = connectionDAO.getByAPIKey((String) id, GatewayProvider.TYPE);
                    return connection.getUser();
                }
            }
        } catch (UnavailableSecurityManagerException e) {
            throw new AuthenticationException(e.getMessage());
        }
        throw new AuthenticationException(ErrorMessages.INVALID_CREDENTIAL);
    }
View Full Code Here


    // look the user in the example user store
    SimpleUser user = this.userStore.getUser(userId);

    if (user == null) {
      throw new AuthenticationException("Invalid username '" + userId + "'");
    }

    return new SimpleAuthenticationInfo(user.getUserId(), user.getPassword(), getName());
  }
View Full Code Here

    String username = upToken.getUsername();
    String pass = String.valueOf(upToken.getPassword());

    // Verify non-empty password
    if (Strings.isNullOrEmpty(pass)) {
      throw new AuthenticationException("Password must not be empty");
    }

    try {
      this.ldapManager.authenticateUser(username, pass);
      // creating AuthInfo with plain pass (relates to creds matcher too)
View Full Code Here

  @Override
  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
      throws AuthenticationException
  {
    throw new AuthenticationException("This realm only throws exceptions");
  }
View Full Code Here

        try {
            resolvedUser = userManager.findUser(username);

        } catch (PersistenceException e) {
            FireLogger.logSevere("Realm {0} has encountered a database problem: {1}", getName(), e.getClass());
            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);
View Full Code Here

                throw ((AuthenticationException) t);
            } else {
                String msg = "Unable to acquire account data from realm [" + realm + "].  The [" +
                        getClass().getName() + " implementation requires all configured realm(s) to operate successfully " +
                        "for a successful authentication.";
                throw new AuthenticationException(msg, t);
            }
        }
        if (info == null) {
            String msg = "Realm [" + realm + "] could not find any associated account data for the submitted " +
                    "AuthenticationToken [" + token + "].  The [" + getClass().getName() + "] implementation requires " +
View Full Code Here

     */
    public AuthenticationInfo afterAllAttempts(AuthenticationToken token, AuthenticationInfo aggregate) throws AuthenticationException {
        //we know if one or more were able to succesfully authenticate if the aggregated account object does not
        //contain null or empty data:
        if (aggregate == null || CollectionUtils.isEmpty(aggregate.getPrincipals())) {
            throw new AuthenticationException("Authentication token of type [" + token.getClass() + "] " +
                    "could not be authenticated by any configured realms.  Please ensure that at least one realm can " +
                    "authenticate these tokens.");
        }

        return aggregate;
View Full Code Here

            info = queryForAuthenticationInfo(token, getContextFactory());
        } catch (AuthenticationNotSupportedException e) {
            String msg = "Unsupported configured authentication mechanism";
            throw new UnsupportedAuthenticationMechanismException(msg, e);
        } catch (javax.naming.AuthenticationException e) {
            throw new AuthenticationException("LDAP authentication failed.", e);
        } catch (NamingException e) {
            String msg = "LDAP naming error while attempting to authenticate user.";
            throw new AuthenticationException(msg, e);
        }

        return info;
    }
View Full Code Here

    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        AuthenticationInfo info;
        try {
            info = queryForAuthenticationInfo(token, getContextFactory());
        } catch (javax.naming.AuthenticationException e) {
            throw new AuthenticationException("LDAP authentication failed.", e);
        } catch (NamingException e) {
            String msg = "LDAP naming error while attempting to authenticate user.";
            throw new AuthenticationException(msg, e);
        }

        return info;
    }
View Full Code Here

    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        AuthenticationInfo info;
        try {
            info = queryForAuthenticationInfo(token, ensureContextFactory());
        } catch (javax.naming.AuthenticationException e) {
            throw new AuthenticationException("LDAP authentication failed.", e);
        } catch (NamingException e) {
            String msg = "LDAP naming error while attempting to authenticate user.";
            throw new AuthenticationException(msg, e);
        }

        return info;
    }
View Full Code Here

TOP

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

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.