Package org.acegisecurity.userdetails

Examples of org.acegisecurity.userdetails.UsernameNotFoundException


  public UserDetails loadUserByUsername(String username)
      throws UsernameNotFoundException, DataAccessException {
    User user = (User) getUserByName(username);
    if (user == null) {
      throw new UsernameNotFoundException("user '" + username
          + "' not found...");
    }
    return SecurityHelper.u2ud(user, SecurityHelper.p2ga(dao.find(
        M_PERMIS_BY_USER, user.getId())));
  }
View Full Code Here


                            groups.toArray(new GrantedAuthority[groups.size()]));
            }
            else
            {
                LOGGER.warning("MySQLSecurity: Invalid Username or Password");
                throw new UsernameNotFoundException("MySQL: User not found");
            }

        }
        catch (Exception e)
        {
View Full Code Here

    @Override
    public GroupDetails loadGroupByGroupname(String groupname)
            throws UsernameNotFoundException, DataAccessException
    {
        LOGGER.warning("ERROR: Group lookup is not supported.");
        throw new UsernameNotFoundException("MySQLSecurityRealm: Non-supported function");
    }
View Full Code Here

            if (user == null && getUserSearch() != null) {
                user = getUserSearch().searchForUser(username);
            }

            if (user == null) {
                throw new UsernameNotFoundException(username);
            }

            Attribute passwordAttribute = user.getAttributes().get(passwordAttributeName);

            if(passwordAttribute != null) {
View Full Code Here

            String[] args = new String[] { LdapUtils.escapeNameForFilter(username) };

            NamingEnumeration results = ctx.search(searchBase, searchFilter, args, ctls);

            if (!results.hasMore()) {
                throw new UsernameNotFoundException("User " + username + " not found in directory.");
            }

            SearchResult searchResult = (SearchResult)results.next();

            if (results.hasMore()) {
View Full Code Here

     */
    public User getUser(String username) throws UsernameNotFoundException {
        User result = (User) this.userMap.get(username.toLowerCase());

        if (result == null) {
            throw new UsernameNotFoundException("Could not find user: "
                + username);
        }

        return result;
    }
View Full Code Here

    public UserDetails loadUserByUsername(String username)
        throws UsernameNotFoundException, DataAccessException {
        List users = usersByUsernameMapping.execute(username);

        if (users.size() == 0) {
            throw new UsernameNotFoundException("User not found");
        }

        UserDetails user = (UserDetails) users.get(0); // contains no GrantedAuthority[]

        List dbAuths = authoritiesByUsernameMapping.execute(user.getUsername());

        if (dbAuths.size() == 0) {
            throw new UsernameNotFoundException("User has no GrantedAuthority");
        }

        GrantedAuthority[] arrayAuths = {};

        addCustomauthorities(user.getUsername(), dbAuths);
View Full Code Here

                UserDetails targetUser = this.userDetailsService
                        .loadUserByUsername(username);

                    // user not found
                    if (targetUser == null) {
                        throw new UsernameNotFoundException(messages.getMessage(
                                "SwitchUserProcessingFilter.usernameNotFound",
                                new Object[] {username},
                                "Username {0} not found"));
                    }
View Full Code Here

    * @see org.acegisecurity.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
    */
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        List users = getHibernateTemplate().find("from User where username=?", username);
        if (users == null || users.isEmpty()) {
            throw new UsernameNotFoundException("user '" + username + "' not found...");
        } else {
            return (UserDetails) users.get(0);
        }
    }
View Full Code Here

    throws UsernameNotFoundException,
      DataAccessException {

    UserDetails user = findUserByName(pUsername);
    if (user == null) {
      throw new UsernameNotFoundException("user not found:" + pUsername);
    }

    return user;
  }
View Full Code Here

TOP

Related Classes of org.acegisecurity.userdetails.UsernameNotFoundException

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.