title: Httpservletrequest.authenticate() method not sending redirection to login page
body: <p>My application is running on Websphere application server 9.0.0.9. I have the following security constraints added in the web.xml file of my application. The intention is to secure every request irrespective of whether it needs to be authenticated or not.</p>
  
  <pre><code>&lt;security-constraint&gt;
      &lt;web-resource-collection&gt;
          &lt;web-resource-name&gt;All&lt;/web-resource-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/web-resource-collection&gt;
      &lt;user-data-constraint&gt;
              &lt;description&gt;Ensure to allow only confidential communication&lt;/description&gt;
              &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
      &lt;/user-data-constraint&gt;
  &lt;/security-constraint&gt;
  &lt;!-- For FORM authentication --&gt;
      &lt;login-config&gt;
          &lt;auth-method&gt;FORM&lt;/auth-method&gt;
          &lt;form-login-config&gt;
              &lt;form-login-page&gt;/login.jsp&lt;/form-login-page&gt;
              &lt;form-error-page&gt;/login.jsp?error=true&lt;/form-error-page&gt;
          &lt;/form-login-config&gt;
      &lt;/login-config&gt;
  </code></pre>
  
  <p>Next in one of the servlet filters I am calling:</p>
  
  <pre><code> if (CommonUtils.isNullOrEmpty(user)) {
    response.setHeader( "auth-msg", "auth-required");
    request.authenticate(response);
    return;
  }
  </code></pre>
  
  <p>In the browser, upon hitting the /home url, I am always getting a 200 OK response with the above "auth-msg" header set in the response and a blank page. The expected behavior is to take the user to the login page but that doesn't happen. The "Enable application security" is also checked in the WAS console. What else could be missing here? The only workaround here is to explicitly hit the login.jsp page. The login page shows up and I can login from there and things work. But the automatic redirection to login page isn't happing. The same setup works fine in WAS liberty.</p>