Announcement Announcement Module
No announcement yet.
Sending Client Operating System Information along with authenticate() method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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)

  • Marten Deinum
    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...

    Leave a comment:

  • thobson
    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

    Leave a comment: