I am trying to set the database name as the request input parameter from the spring security login page. At present I am only getting username that’s been retrieved using spring security SecurityContextHolder.getContext().getAuthentication().
How to access the additional field that’s been set on the login page?
Here’s a simple way (untested, but I believe this would work)
ExUsernamePasswordAuthenticationFilterthat will extend the default filter and grab the additional parameter and store it in the session. It will look something like this:UserDetailsServiceimplementation, modify your implementation of:to grab the session variable that the filter from step 1) makes available.
<http />security set-up, override the default filter with your custom oneRefer to this part of the documentation for more info about custom filters: http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#ns-custom-filters