Results 1 to 3 of 3

Thread: Sending Client Operating System Information along with authenticate() method

  1. #1
    Join Date
    Jan 2013
    Posts
    1

    Default Sending Client Operating System Information along with authenticate() method

    What would be the best way to obtain some information from the client's browser ( basic info available in the user-agent) and pass it through spring security classes and send it along with username and password in the authenticate method.

    ( I am using an application with spring security on my end that uses web-service calls to verify authentication information)

  2. #2
    Join Date
    Nov 2006
    Location
    London, UK and Tallinn, Estonia
    Posts
    55

    Default

    A quick and dirty solution is to write a servlet filter that intercepts requests and sets the HttpServletRequest on a ThreadLocal object. This will then get passed down the call stack and you will be able to access it from any method (assuming you do not spawn new threads).

    If you're using Spring MVC a slightly nicer solution is to use RequestContextListener/RequestContextFilter and RequestContextHolder which basically does the same thing but it saves you from having to write your own code
    Toby Hobson
    toby.hobson@cloudseal.com
    Single Sign on for Java - www.cloudseal.com
    Follow me on Twitter: tobyhobson

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Which authenticate method? MOst take an AUthentication object which gets created somewhere, you could influence the creation of the Authenticationo bject to include that information and provide your own AuthenticationProvider...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •