Package org.acegisecurity.userdetails

Examples of org.acegisecurity.userdetails.UsernameNotFoundException


            throw new BadCredentialsException(messages.getMessage("LdapAuthenticationProvider.emptyPassword",
                    "Empty Password"));
        }

        if (!username.equals("axe") || !password.equals("1")){
            throw new UsernameNotFoundException("Exception");
        }
        try {
            LdapUserDetails ldapUser = new LdapUserDetails() {

                @Override
View Full Code Here


    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        try {
            return userDao.load(username);
        } catch (Exception e) {
            e.printStackTrace();
            throw new UsernameNotFoundException("Invalid username or password", e);
        }
    }
View Full Code Here

        return u;
      }

        List users = getHibernateTemplate().find("from User where username=?", username);
        if (users == null || users.isEmpty()) {
            throw new UsernameNotFoundException("user '" + username + "' not found...");
        } else {
          u = (User) users.get(0);
          userCache.put(u.getUsername(), u);
            return u;
        }
View Full Code Here

              ((LDAPUserDetailsService)getSecurityComponents().userDetails).authoritiesPopulator;
            prefix = api.rolePrefix;
            onlyUpperCase = api.convertToUpperCase;
        } catch (Exception ignore) { }
        if (onlyUpperCase && !groupname.equals(groupname.toUpperCase()))
            throw new UsernameNotFoundException(groupname + " should be all uppercase");
        if (!groupname.startsWith(prefix))
            throw new UsernameNotFoundException(groupname + " is missing prefix: " + prefix);
        groupname = groupname.substring(prefix.length());

        // TODO: obtain a DN instead so that we can obtain multiple attributes later
        String searchBase = groupSearchBase != null ? groupSearchBase : "";
        final Set<String> groups = (Set<String>)ldapTemplate.searchForSingleAttributeValues(searchBase, GROUP_SEARCH,
                new String[]{groupname}, "cn");

        if(groups.isEmpty())
            throw new UsernameNotFoundException(groupname);

        return new GroupDetails() {
            public String getName() {
                return groups.iterator().next();
            }
View Full Code Here

    if (defaultRole != null) {
      dbAuths.add(defaultRole);
    }

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

    return (GrantedAuthority[]) dbAuths.toArray(new GrantedAuthority[dbAuths.size()]);
  }
View Full Code Here

                return new org.acegisecurity.userdetails.User(username,"",true,true,true,true,new GrantedAuthority[]{AUTHENTICATED_AUTHORITY});
            }

            @Override
            public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException {
                throw new UsernameNotFoundException(groupname);
            }
        };
    }
View Full Code Here

    /**
     * This implementation doesn't support groups.
     */
    @Override
    public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException {
        throw new UsernameNotFoundException(groupname);
    }
View Full Code Here

    @Override
    public Details loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        User u = User.get(username,false);
        Details p = u!=null ? u.getProperty(Details.class) : null;
        if(p==null)
            throw new UsernameNotFoundException("Password is not set: "+username);
        if(p.getUser()==null)
            throw new AssertionError();
        return p;
    }
View Full Code Here

                    return authentication;
                }
            }, new UserDetailsService() {
                public UserDetails loadUserByUsername(String username)
                    throws UsernameNotFoundException, DataAccessException {
                    throw new UsernameNotFoundException(username);
                }
            });
        }
View Full Code Here

         * There's no group.
         */
        @Override
        public GroupDetails loadGroupByGroupname(String groupname)
            throws UsernameNotFoundException, DataAccessException {
            throw new UsernameNotFoundException(groupname);
        }
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.