Package org.springframework.security.core.userdetails

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


  @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


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

    try {
      user = getUserByLoginname(userId);

      if (user == null) {
        throw new UsernameNotFoundException("Invalid User");
      }

      grantedAuthorities = getGrantedAuthority(user);

    } catch (final NumberFormatException e) {
View Full Code Here

    User user = new User();
    user.setIdentifier(ident);
    user = loadUser(user);

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

    return user;
  }
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(String 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

  public UserDetails loadUserDetails(OpenIDAuthenticationToken token) throws UsernameNotFoundException {
    final String openId = token.getIdentityUrl();
    User user = this.getUserByOpenId(openId);
    if (user == null) {
      log.info("Open ID User with URL "+openId+" was not found!");
      throw new UsernameNotFoundException("Open ID User with URL "+openId+" was not found!");
    }
    return user;
  }
View Full Code Here

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        logger.info("Custom User Service called to get user information");
        final User user = userRepository.getByUsername(username);
        if (user == null) {
            throw new UsernameNotFoundException("User with username '" + username + "' was not found!");
        }
        fetchCustomCredential(user);
        return user;
    }
View Full Code Here

        Page personProfile = new PageImpl();
        PageLayout pageLayout = new PageLayoutImpl();
        pageLayout.setCode("person_profile");
        personProfile.setPageLayout(pageLayout);

        expect(userService.getUserByUsername(username)).andThrow(new UsernameNotFoundException("Username does not exist"));

        replay(userService, pageService);

        String view = profileController.viewProfileByUsername(username, model, null, response);
        assertThat(view, is(ViewNames.USER_NOT_FOUND));
View Full Code Here

        Page personProfile = new PageImpl();
        PageLayout pageLayout = new PageLayoutImpl();
        pageLayout.setCode("person_profile");
        personProfile.setPageLayout(pageLayout);

        expect(userService.getUserById(username)).andThrow(new UsernameNotFoundException("Username does not exist"));

        replay(userService, pageService);

        String view = profileController.viewProfile(username, model, null, response);
        assertThat(view, is(ViewNames.USER_NOT_FOUND));
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.