code: private AuthenticationResult handleRedirect(HttpServletRequest req,
                                                  HttpServletResponse res,
                                                  WebRequest webRequest) {
          AuthenticationResult authResult;
  
          String loginURL = getFormLoginURL(req, webRequest, webAppSecurityConfig);
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "form login URL: " + loginURL);
          }
  
          authResult = new AuthenticationResult(AuthResult.REDIRECT, loginURL);
  
          if (allowToAddCookieToResponse(webAppSecurityConfig, req)) {
              postParameterHelper.save(req, res, authResult);
              ReferrerURLCookieHandler referrerURLHandler = webAppSecurityConfig.createReferrerURLCookieHandler();
  //            referrerURLHandler.setReferrerURLCookie(authResult, getReqURL(req));
              Cookie c = referrerURLHandler.createReferrerURLCookie(ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME, getReqURL(req), req);
              authResult.setCookie(c);
          }
  
          return authResult;
      }
docs: This method save post parameters in the cookie or session and
  redirect to a login page.
  
  @param req
  @param res
  @param loginURL
  @return authenticationResult