Package org.springframework.security.userdetails

Examples of org.springframework.security.userdetails.UsernameNotFoundException


      throws UsernameNotFoundException, DataAccessException {

    UserIndex userIndex = _userService.getUserIndexForId(key);

    if (userIndex == null)
      throw new UsernameNotFoundException(key.toString());
   
    setLastAccessTimeForUser(userIndex);
   
    return new IndexedUserDetailsImpl(_authoritiesService, userIndex);
  }
View Full Code Here


            DataAccessException {
        checkUserMap();

        UserDetails user = userMap.get(username);
        if (user == null)
            throw new UsernameNotFoundException("Could not find user: " + username);

        return user;
    }
View Full Code Here

    {
        if (bypassUserName.equalsIgnoreCase(username))
        {
            String errorMessage = "Configured to skip loading user details for " + username;
            log.debug(errorMessage);
            throw new UsernameNotFoundException(errorMessage);
        }

        Person person = null;
        PersistentLogin login = null;
        List<GrantedAuthority> authorities = null;
        try
        {
            person = personMapper.findByAccountId(username);
            login = (loginRepository == null) ? null : loginRepository.getPersistentLogin(username);
            authorities = (authorityProvider == null) ? new ArrayList<GrantedAuthority>(0) : authorityProvider
                    .loadAuthoritiesByUsername(username);

            // if user not found in DB, try to create from LDAP
            if (person == null)
            {
                person = (Person) serviceActionController.execute(new ServiceActionContext(username, null),
                        createUserfromLdapAction);
            }
        }
        catch (Exception e)
        {
            String errorMessage = "Error loading user details for: " + username;
            log.error(errorMessage + " " + e.getMessage());

            throw new DataRetrievalFailureException(errorMessage, e);
        }

        // If user still not found, give up.
        if (person == null)
        {
            String errorMessage = "User not found: " + username;
            log.info(errorMessage);
            throw new UsernameNotFoundException(errorMessage);
        }

        return new ExtendedUserDetailsImpl(person, login,
                authorities.toArray(new GrantedAuthority[authorities.size()]), authenticationType);
    }
View Full Code Here

    private DirectoryManager directoryManager;

    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        final User user = getDirectoryManager().getUserByUsername(username);
        if (user == null) {
            throw new UsernameNotFoundException(username);
        }

        UserDetails details = new WorkflowUserDetails(user);
        return details;
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.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.