Package org.springframework.security.web.authentication

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


        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


        PreAuthenticatedAuthenticationToken authentication = new PreAuthenticatedAuthenticationToken(
                userDetails, userDetails.getPassword(),
                userDetails.getAuthorities());

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

        securityContext.setAuthentication(authentication);
    }
View Full Code Here

            for (String key : data.keySet()) {
                Object object = data.get(key);

                // Extract the data that will be saved.
                if (object instanceof WebAuthenticationDetails) {
                    WebAuthenticationDetails authenticationDetails = (WebAuthenticationDetails) object;
                    results.put("remoteAddress", authenticationDetails.getRemoteAddress());
                    results.put("sessionId", authenticationDetails.getSessionId());
                } else {
                    results.put(key, object.toString());
                }
            }
        }
View Full Code Here

  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

      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

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

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

  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

      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

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

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

    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

Related Classes of org.springframework.security.web.authentication.WebAuthenticationDetails

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.