Examples of UserDetails


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

            logger.debug("Unable to retrieve username");
            return;
        }

        if (!StringUtils.hasLength(password)) {
            UserDetails user = getUserDetailsService().loadUserByUsername(username);
            password = user.getPassword();

            if (!StringUtils.hasLength(password)) {
                logger.debug("Unable to obtain password for user: " + username);
                return;
            }
View Full Code Here

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

            .andExpect(authenticated().withUsername("admin"));
    }

    @Test
    public void requestProtectedUrlWithUserDetails() throws Exception {
        UserDetails user = userDetailsService.loadUserByUsername("user");
        mvc
            .perform(get("/").with(user(user)))
            // Ensure we got past Security
            .andExpect(status().isNotFound())
            // Ensure it appears we are authenticated with user
View Full Code Here

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

        // Lookup password for presented username
        // NB: DAO-provided password MUST be clear text - not encoded/salted
        // (unless this instance's passwordAlreadyEncoded property is 'false')
        boolean cacheWasUsed = true;
        UserDetails user = userCache.getUserFromCache(digestAuth.getUsername());
        String serverDigestMd5;

        try {
            if (user == null) {
                cacheWasUsed = false;
                user = userDetailsService.loadUserByUsername(digestAuth.getUsername());

                if (user == null) {
                    throw new AuthenticationServiceException(
                            "AuthenticationDao returned null, which is an interface contract violation");
                }

                userCache.putUserInCache(user);
            }

            serverDigestMd5 = digestAuth.calculateServerDigest(user.getPassword(), request.getMethod());

            // If digest is incorrect, try refreshing from backend and recomputing
            if (!serverDigestMd5.equals(digestAuth.getResponse()) && cacheWasUsed) {
                if (logger.isDebugEnabled()) {
                    logger.debug(
                            "Digest comparison failure; trying to refresh user from DAO in case password had changed");
                }

                user = userDetailsService.loadUserByUsername(digestAuth.getUsername());
                userCache.putUserInCache(user);
                serverDigestMd5 = digestAuth.calculateServerDigest(user.getPassword(), request.getMethod());
            }

        } catch (UsernameNotFoundException notFound) {
            fail(request, response,
                    new BadCredentialsException(messages.getMessage("DigestAuthenticationFilter.usernameNotFound",
View Full Code Here

Examples of org.springframework.security.userdetails.UserDetails

  @Resource
  private AccountService accountService;

  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    Account account = accountService.getByLoginName(username);
    UserDetails userDetails = new UserDetailsImpl(account);
    return userDetails;   
  }
View Full Code Here

Examples of org.xdams.security.UserDetails

  }

  @ModelAttribute
  public void userLoad(Model model) {
    if (!model.containsAttribute("userBean")) {
      UserDetails userDetails = null;
      try {
        userDetails = (UserDetails) ((SecurityContext) SecurityContextHolder.getContext()).getAuthentication().getPrincipal();
        UserBean userBean = LoadUserManager.executeLoad(userDetails, authenticationType);
        model.addAttribute("userBean", userBean);
      } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.