Package org.springframework.security.userdetails

Examples of org.springframework.security.userdetails.UsernameNotFoundException


        Authentication auth = SecurityContextHolder.getContext()
                .getAuthentication();

        if (null == auth) {
            throw new UsernameNotFoundException("No Authentications");
        }

        Object obj = auth.getPrincipal();
        String username = "";
View Full Code Here


        if (list.size() != 1) {
            if (!username.equals("anonymousUser")) {
                log.debug("getUserByUsername UsernameNotFoundException "
                        + list.size() + " users for " + username);
            }
            throw new UsernameNotFoundException(
                    "Username not found or duplicate: " + username);
        } else {
            log.debug("load user success " + list.get(0));
            User u = (User) list.get(0);
            log.debug("user: " + u);
View Full Code Here

    public ServerSideUser loadUserByUsername(String username)
            throws UsernameNotFoundException, DataAccessException {

        log.debug("here");
        if (username == null) {
            throw new UsernameNotFoundException("Username null not found");
        }
        List<User> users = getHibernateTemplate().findByNamedParam(
                "from User where username = :name", "name",
                username.toLowerCase());

        log.debug("Found " + users.size() + " users for username "
                + username);

        if (users.size() != 1) {
            if (users.size() != 0) {
                throw new UsernameNotFoundException(
                        "Duplicate Username Problem: " + username);
            } else {

                // if OpenID
                // consider returning a ROLE 'TRANSIENT_OpenID' user...

                throw new UsernameNotFoundException(
                        "Username not found: " + username);
            }
        } else {
            log.debug("load user success " + users.get(0));
            User u = users.get(0);
View Full Code Here

  @Transactional(readOnly = true)
  public UserDetails loadUserByUsername(String userName)
      throws UsernameNotFoundException, DataAccessException {
    User user = userDao.findByLoginName(userName);
    if(user == null) throw new UsernameNotFoundException(userName + " is not existed.");
    LoxiaUserDetails result = new LoxiaUserDetails();
    User u = new User();
    OperatingUnit ou = new OperatingUnit();
    OperatingUnitType ouType = new OperatingUnitType();
    try {
View Full Code Here

        if (user != null) {
            return new UserDetailsAdaptor(user);

        } else {
            throw new UsernameNotFoundException("UserDetailsService.loadUserByUsername()");
        }
    }
View Full Code Here

     * @seeorg.springframework.security.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
     */
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        User user = getUserByUsername(username);
        if (user == null) {
            throw new UsernameNotFoundException("There is no User with login/username: " + username);
        }
        return new UserDetailsImpl(user);
    }
View Full Code Here

  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
    try {
      return findByEmail(username);
    }
    catch(final EntityNotFoundException enfe) {
      throw new UsernameNotFoundException("Username '" + username + "' not found");
    }
  }
View Full Code Here

    public User getAccountByNickname(String name) throws UsernameNotFoundException {
        try {
            return (User) entityManager.createNamedQuery("User_getUserByNickname").
                    setParameter("name", name).getSingleResult();
        } catch (NoResultException ex) {
            throw new UsernameNotFoundException(name, ex);
        }
    }
View Full Code Here

    @Override
    public Account getUserByNickName(String nickname) throws UsernameNotFoundException {
        try {
            return (Account) entityManager.createNamedQuery("Account_getEmployeeByNickname").setParameter("nickname", nickname).getSingleResult();
        } catch (NoResultException ex) {
            throw new UsernameNotFoundException(nickname);
        }

    }
View Full Code Here

    public UserDetails loadUserByUsername(String username)
            throws UsernameNotFoundException, DataAccessException {
        AppUser user = userDao.findUser(username);
        if (user == null)
            throw new UsernameNotFoundException("User not found: " + username);
        else {
            return makeUser(user);
        }
    }
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.