Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.User


        }
    }

    @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


        return User.class.isAssignableFrom(aClass);
    }

    public void validate(Object obj, Errors errors) {
        logger.debug("Validator called");
        User user = (User) obj;

        //check if the password is null or empty
        if (StringUtils.isBlank(user.getPassword())) {
            errors.rejectValue("password", "password.required");
            logger.info("Password required");
        }
        //check if the password length is less than 4
        else if (user.getPassword().length() < 4) {
            errors.rejectValue("password", "password.invalid.length");
            logger.info("Password must be at least 4 characters long");
        }
        //check if the confirm password is null or empty
        if (StringUtils.isBlank(user.getConfirmPassword())) {
            errors.rejectValue("confirmPassword", "confirmPassword.required");
            logger.info("Confirm Password required");
        }

        //check if the confirm password matches the previous entered password
        if (user.getConfirmPassword() != null && !(user.getConfirmPassword().equals(user.getPassword()))) {
            errors.rejectValue("confirmPassword", "confirmPassword.mismatch");
            logger.info("Password mismatch");
        }

        validateEmail(errors, user);
View Full Code Here

    private boolean isInvalidEmailAddress(String emailAddress) {
        return !EmailValidator.getInstance().isValid(emailAddress);
    }

    private boolean isExistingEmailAddress(User user, String email) {
        final User userByEmail = userService.getUserByEmail(email);
        return userByEmail != null && !userByEmail.equals(user);
    }
View Full Code Here

    // TODO RAVE-154 why .jsp?
    @RequestMapping(value ="/userProfile.jsp")
   public void setUpForm(ModelMap model) {
      logger.debug("Initializing form");
      User user=userService.getAuthenticatedUser();
      model.addAttribute(ModelKeys.USER_PROFILE,user);
   }
View Full Code Here

        this.userService = userService;
    }
    @RequestMapping(value = {"/page/view", "/index.html"}, method = RequestMethod.GET)
    public String viewDefault(Model model) {
        User user = userService.getAuthenticatedUser();
        List<Page> pages = pageService.getAllPages(user.getEntityId());
        model.addAttribute(ModelKeys.PAGE, pages.get(0));
        model.addAttribute(ModelKeys.PAGES, pages);
        return ViewNames.HOME;
    }         
View Full Code Here

        return ViewNames.HOME;
    }         
   
    @RequestMapping(value = "/page/view/{pageId}", method = RequestMethod.GET)
    public String view(@PathVariable Long pageId, Model model) {
        User user = userService.getAuthenticatedUser();
        logger.debug("attempting to get pageId " + pageId + " for " + user);
       
        List<Page> pages = pageService.getAllPages(user.getEntityId());
        Page page = pageService.getPageFromList(pageId, pages);
              
        model.addAttribute(ModelKeys.PAGE, page);
        model.addAttribute(ModelKeys.PAGES, pages);
        return ViewNames.HOME;
View Full Code Here

    @Autowired
    private UserRepository repository;

    @Test
    public void getById_validId() {
        User user = repository.get(USER_ID);
        assertThat(user, CoreMatchers.notNullValue());
        assertThat(user.getUsername(), is(equalTo(USER_NAME)));
        assertThat(user.getPassword(), is(equalTo(HASHED_SALTED_PASSWORD)));
        assertThat(user.isAccountNonExpired(), is(true));
      assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }
View Full Code Here

      assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }

    @Test
    public void getById_invalidId() {
        User user = repository.get(INVALID_USER);
        assertThat(user, is(nullValue()));
    }
View Full Code Here

        assertThat(user, is(nullValue()));
    }

    @Test
    public void getByUsername_valid() {
        User user = repository.getByUsername(USER_NAME);
        assertThat(user, CoreMatchers.notNullValue());
        assertThat(user.getEntityId(), is(equalTo(USER_ID)));
        assertThat(user.getPassword(), is(equalTo(HASHED_SALTED_PASSWORD)));
        assertThat(user.isAccountNonExpired(), is(true));
      assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }
View Full Code Here

      assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }

    @Test
    public void getByUsername_invalid() {
        User user = repository.get(INVALID_USER);
        assertThat(user, is(nullValue()));
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.User

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.