Examples of WebAuthenticationDetails


Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

  public void updateLogin(
      AuthenticationSuccessEvent authenticationSuccessEvent) {
    UserDAO userDAO = (UserDAO) getDao();
    String username = authenticationSuccessEvent.getAuthentication().getName();
    BaseUser user = userDAO.loadByUsername(username);
    WebAuthenticationDetails details = (WebAuthenticationDetails) authenticationSuccessEvent.getAuthentication().getDetails();
    String address = details.getRemoteAddress();
    if (user.getTotalLoginCount()== null)
      user.setTotalLoginCount(1l);
    else
      user.setTotalLoginCount(user.getTotalLoginCount()+1);
    user.setPrevLoginIP(user.getLastLoginIP());
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

      List<GrantedAuthority> list = Lists.newArrayList((GrantedAuthority) new GrantedAuthorityImpl("role_foo"));
      User user = new User(USER_NAME, "bar", false, false, false, false, list);

      UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(user, null,
          list);
      authentication.setDetails(new WebAuthenticationDetails(request));
      context.setAuthentication(authentication);
      return context;
    }
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

    Object details = authentication.getDetails();
    if (!(details instanceof WebAuthenticationDetails)) {
      return "";
    }

    WebAuthenticationDetails webDetails = (WebAuthenticationDetails) details;
    return webDetails.getRemoteAddress();
  }
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

  public static void saveUserDetailsToContext(UserDetails userDetails, HttpServletRequest request) {
    PreAuthenticatedAuthenticationToken authentication = new PreAuthenticatedAuthenticationToken(userDetails,
        userDetails.getPassword(), userDetails.getAuthorities());

    if (request != null) {
      authentication.setDetails(new WebAuthenticationDetails(request));
    }

    SecurityContextHolder.getContext().setAuthentication(authentication);
  }
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

      uid = auth.getPrincipal().toString();
    }

    if (CapString.isEmpty(ipAddress)
        && auth!=null && auth.getDetails() instanceof WebAuthenticationDetails) {
      WebAuthenticationDetails details = (WebAuthenticationDetails) auth
          .getDetails();
      ipAddress = details.getRemoteAddress();
    }
    if (CapString.isEmpty(ipAddress)){
      ServletRequest req =  params.getServletRequest();
      ipAddress = req.getRemoteAddr();
    }
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

        Object details = authentication.getDetails();
        if (!(details instanceof WebAuthenticationDetails)) {
            return "";
        }

        WebAuthenticationDetails webDetails = (WebAuthenticationDetails) details;
        return webDetails.getRemoteAddress();
    }
View Full Code Here

Examples of org.springframework.security.web.authentication.WebAuthenticationDetails

    public static void saveUserDetailsToContext(UserDetails userDetails, HttpServletRequest request) {
        PreAuthenticatedAuthenticationToken authentication = new PreAuthenticatedAuthenticationToken(userDetails,
                userDetails.getPassword(), userDetails.getAuthorities());

        if (request != null) {
            authentication.setDetails(new WebAuthenticationDetails(request));
        }

        SecurityContextHolder.getContext().setAuthentication(authentication);
    }
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.