Package org.springframework.security.core.userdetails

Examples of org.springframework.security.core.userdetails.UsernameNotFoundException


   *
   * @see org.springframework.security.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
   */
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
    if (StringUtils.isBlank(username)) {
      throw new UsernameNotFoundException("Cannot retrieve user without a valid username");
    }
    String encryptedPassword = null;
    try {
      encryptedPassword = WikiBase.getDataHandler().lookupWikiUserEncryptedPassword(username);
    } catch (org.jamwiki.DataAccessException e) {
      throw new DataAccessResourceFailureException("Unable to retrieve authorities for user: " + username, e);
    }
    if (encryptedPassword == null) {
      throw new UsernameNotFoundException("Failure retrieving user information for " + username);
    }
    Collection<GrantedAuthority> authorities = this.retrieveUserAuthorities(username);
    return new WikiUserDetails(username, encryptedPassword, true, true, true, true, authorities);
  }
View Full Code Here


      throws UsernameNotFoundException {

  UserInfo user = users.get(username.toLowerCase());

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

  UserInfo newUser = new UserInfo(user.getUsername(), user.getPassword(),
    user.getAuthorities(), user.getLastName(), user.getAge());
View Full Code Here

      throws UsernameNotFoundException {

  UserInfo user = users.get(username.toLowerCase());

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

  UserInfo newUser = new UserInfo(user.getUsername(), user.getPassword(),
    user.getAuthorities(), user.getLastName());
View Full Code Here

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        log.debug("loadUserByUsername called with: " + username);
        final User user = userRepository.getByUsername(username);
        if(user == null) {
            throw new UsernameNotFoundException("User with username '" + username + "' was not found!");
        }
        return user;
    }
View Full Code Here

    @Override
    public void setAuthenticatedUser(long userId) {
        final User user = userRepository.get(userId);
        if(user == null) {
            throw new UsernameNotFoundException("User with id '" + userId + "' was not found!");
        }
        SecurityContext securityContext = createContext(user);
        SecurityContextHolder.setContext(securityContext);
    }
View Full Code Here

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        log.debug("loadUserByUsername called with: {}", username);
        final User user = userRepository.getByUsername(username);
        if (user == null) {
            throw new UsernameNotFoundException("User with username '" + username + "' was not found!");
        }
        return user;
    }
View Full Code Here

    @Override
    public void setAuthenticatedUser(long userId) {
        final User user = userRepository.get(userId);
        if (user == null) {
            throw new UsernameNotFoundException("User with id '" + userId + "' was not found!");
        }
        SecurityContext securityContext = createContext(user);
        SecurityContextHolder.setContext(securityContext);
    }
View Full Code Here

            }
        } else {
            final SyncopeUser user = userDAO.find(username);

            if (user == null) {
                throw new UsernameNotFoundException("Could not find any user with id " + username);
            }

            // Give entitlements based on roles assigned to user (and their ancestors)
            final Set<SyncopeRole> roles = new HashSet<SyncopeRole>(user.getRoles());
            for (SyncopeRole role : user.getRoles()) {
View Full Code Here

  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException
  {
    AkteraUser user = findUserByName(username);
    if (user == null)
    {
      throw new UsernameNotFoundException("User " + username + " not found");
    }
    return new UserDetailsImpl(user.getName(), user.getPassword());
  }
View Full Code Here

  @Transactional(readOnly = true)
  public org.springframework.security.core.userdetails.User loadUserByUsername(String usernameOrEmail) throws UsernameNotFoundException, DataAccessException {
    Customer customerDetails = null;
    customerDetails = customerService.getCustomerByLoginOrEmail(usernameOrEmail);
    if (customerDetails == null) {
      throw new UsernameNotFoundException("user not found");
    }
    return assembler.buildUserFromCustomerEntity(customerDetails);
  }
View Full Code Here

TOP

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