title: Spring Security login with multiple parameters
body: <p>I'm using Spring MVC and Spring Security for the authentication. I'm doing the login with username and password but I would like to send two more parameters. Is there any way to do that?</p>
  
  <p>This is the login form:</p>
  
  <pre><code>&lt;form action="#" th:action="@{/auth/login}" th:object="${loginBean}"  method="post"&gt;  
      &lt;input type="hidden" th:field="*{timezone}" th:value="*{timezone}" /&gt;
      &lt;input type="hidden" th:field="*{language}" th:value="*{language}" /&gt;
      &lt;input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" /&gt;
      &lt;input type="text" placeholder="Email" th:field="*{username}" required="required" 
          title="Email pattern does not match" pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$"/&gt;
      &lt;span th:if="${#fields.hasErrors('username')}" th:errors="*{username}"&gt;Email Error&lt;/span&gt;
      &lt;input type="password" placeholder="Password" th:field="*{password}" required="required" /&gt;
      &lt;span th:if="${#fields.hasErrors('password')}" th:errors="*{password}"&gt;Password Error&lt;/span&gt;
      &lt;button type="submit" id="login-button"&gt;Login&lt;/button&gt;                      
  &lt;/form&gt;
  </code></pre>
  
  <p>I would like to send the timezone and language in the login too.</p>
  
  <p>And the <code>AuthenticationProvider</code>:</p>
  
  <pre><code>@Component
  public class CustomAuthenticationProvider implements AuthenticationProvider {
  
      @Override
      public Authentication authenticate(Authentication authentication) throws AuthenticationException {
          String name = authentication.getName();
  
          // You can get the password here
          String password = authentication.getCredentials().toString();
  
          TokenDTO t = new TokenDTO();
          t.setIdioma("en-US");
  
          //try {
  
          CustomUserService  userService = new CustomUserService();
  
          UserDetails user =  userService.loadUser(name, password);
  
          if (user == null)
              throw new BadCredentialsException("Username not found.");
  
          Collection&lt;? extends GrantedAuthority&gt; authorities = user.getAuthorities();
  
          Authentication auth = new UsernamePasswordAuthenticationToken(user, user.getPassword(), authorities);
  
          return auth;     
      }
  
      @Override
      public boolean supports(Class&lt;?&gt; authentication) {
          return authentication.equals(UsernamePasswordAuthenticationToken.class);
      }
  }
  </code></pre>
  
  <p>Is it possible to send more params in the authentications?</p>