title: remember-me and authentication-success-handler
body: <p>i have strange issue of for login sucess and redirect to page. </p>
  
  <p>below is my spring security configuration. </p>
  
  <pre><code>&lt;http auto-config="true" use-expressions="true"&gt;
      &lt;intercept-url pattern="/login.hst**" access="anonymous or authenticated" /&gt;
      &lt;intercept-url pattern="/**/*.hst" access="authenticated" /&gt;
      &lt;form-login login-page="/login.hst"
          authentication-failure-url="/login.hst?error=true"
          authentication-success-handler-ref="loginSucessHandler" /&gt;
      &lt;logout invalidate-session="true" logout-success-url="/home.hst"
          logout-url="/logout.hst" /&gt;
      &lt;remember-me key="jbcpHaverERP" authentication-success-handler-ref="loginSucessHandler"/&gt;
      &lt;session-management&gt;
      &lt;concurrency-control max-sessions="1" /&gt;
  &lt;/session-management&gt;
  &lt;/http&gt;
  </code></pre>
  
  <p>LoginSuessHandler class:</p>
  
  <pre><code>@Service
  public class LoginSucessHandler extends
          SavedRequestAwareAuthenticationSuccessHandler {
  
      @Override
      public void onAuthenticationSuccess(HttpServletRequest request,
              HttpServletResponse response, Authentication authentication)
              throws ServletException, IOException {
              ...
          super.setUseReferer(true);
          super.onAuthenticationSuccess(request, response, authentication);
      }
  
  }
  </code></pre>
  
  <p>now problem of redirect to requested page on success. if i directly refer to any secure url spring redirects me to login page and on successful login to original requested link. 
  but this is not working in case if user had earlier selected remember-me and then closing browser and now requesting direct URL, he is being properly authenticated but instead of redirecting him to requested page spring redirects to /. i have checked log and some spring source code and found it is not able to determine target url. </p>
  
  <p>i have tried to set refer but referer value is null. but one strange thing i have noticed that  in spring security configuration if i remove  authentication-success-handler from remember-me configuration then it works. </p>
  
  <pre><code>    &lt;remember-me key="jbcpHaverERP" authentication-success-handler-ref="loginSucessHandler"/&gt;
  </code></pre>
  
  <p>not able to figure out issue. is authentication-success-handler implementation requied to be different for form login and remember-me? </p>