Examples of WebAuthenticationDetails


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

   *
   */
  private void login(HttpServletRequest request, String username, String password) {
    WikiUserDetails userDetails = new WikiUserDetails(username, password, true, true, true, true, JAMWikiAuthenticationConfiguration.getDefaultGroupRoles());
    UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities());
    authentication.setDetails(new WebAuthenticationDetails(request));
    SecurityContextHolder.getContext().setAuthentication(authentication);
  }
View Full Code Here

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

  }
 
  public void authenticationCustomer(final HttpServletRequest request, final Customer customer) {
    try {
      UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(customer.getEmail(), customer.getPassword());
      token.setDetails(new WebAuthenticationDetails(request));
      Authentication authenticatedUser = authenticationManager.authenticate(token);
 
      SecurityContextHolder.getContext().setAuthentication(authenticatedUser);
      request.getSession().setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
   
View Full Code Here

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

 
  public void authenticationUser(final HttpServletRequest request, final User user) {
    try {
   
      UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user.getEmail(), user.getPassword());
      token.setDetails(new WebAuthenticationDetails(request));
      Authentication authenticatedUser = authenticationManager.authenticate(token);
 
      SecurityContextHolder.getContext().setAuthentication(authenticatedUser);
      request.getSession().setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
   
View Full Code Here

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

    return result;
  }

  private String convertClientAddress(Authentication authentication) {
    try {
      WebAuthenticationDetails details = (WebAuthenticationDetails) authentication.getDetails();
      return details.getRemoteAddress();
    } catch (ClassCastException e) {
      // securitycontext ist vom falschen Typ!
      return "<unbekannt>";
    }
  }
View Full Code Here

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

    }
  }

  private String convertClientSessionId(Authentication authentication) {
    try {
      WebAuthenticationDetails details = (WebAuthenticationDetails) authentication.getDetails();
      return details.getSessionId();
    } catch (ClassCastException e) {
      // securitycontext ist vom falschen Typ!
      return "<unbekannt>";
    }
  }
View Full Code Here

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

   * @see org.saiku.web.service.ISessionService#authenticate(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
   */
  public void authenticate(HttpServletRequest req, String username, String password) {
    try {
      UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
      token.setDetails(new WebAuthenticationDetails(req));
      Authentication authentication = this.authenticationManager.authenticate(token);
      LOG.debug("Logging in with [{}]", authentication.getPrincipal());
      SecurityContextHolder.getContext().setAuthentication(authentication);
    } catch (BadCredentialsException bd) {
      throw new RuntimeException("Authentication failed for: " + username, bd);
View Full Code Here

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

        if (!(details instanceof WebAuthenticationDetails)) {
            return "";
        }

        WebAuthenticationDetails webDetails = (WebAuthenticationDetails) details;

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

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

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));
        }

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

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

            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
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.