Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Elaborating on @Vacuum's comment</p> <p>Here's a simple way (untested, but I believe this would work)</p> <p>1) Create a new class ExUsernamePasswordAuthenticationFilter that will extend the default filter and grab the additional parameter and store it in the session. It will look something like this:</p> <pre><code> public class ExUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter { @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { final String dbValue = request.getParameter("dbParam"); request.getSession().setAttribute("dbValue", dbValue); return super.attemptAuthentication(request, response); } } </code></pre> <p>2) In your UserDetailsService implementation, modify your implementation of:</p> <pre><code>UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException; </code></pre> <p>to grab the session variable that the filter from step 1) makes available. </p> <p>3) in your <code>&lt;http /&gt;</code> security set-up, override the default filter with your custom one</p> <pre><code>&lt;custom-filter ref="beanForYourCustomFilterFromStep1" position="FORM_LOGIN_FILTER"/&gt; </code></pre> <p>Refer to this part of the documentation for more info about custom filters: <a href="http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#ns-custom-filters" rel="noreferrer">http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#ns-custom-filters</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload