1 Reply Latest reply on Dec 23, 2015 5:02 AM by narciskom

    Wildfly 8.1.0.Final - request.getRemoteUser() returns null

    narciskom

      Hi there,

       

      I use Wildfly 8.1.0.Final as my App Server.

       

      I have also apache HTTPD server konfigured with reverse proxy to my Wildfly. The goal af Apache httpd server in my case is to provide authentication. That works fine, I get the Authorization header into my request, but when I try to use request.getRemoteUser (or request.getAuthType()) I get null.

       

      Here a sample code from my servlet

       

      @Override

          public final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

              LOGGER.error(request.getAuthType());

              LOGGER.error(request.getRemoteUser());

              for (Enumeration<String> headers = request.getHeaderNames(); headers.hasMoreElements();)

                  LOGGER.error(headers.nextElement());

              LOGGER.error(request.getHeader("Authorization"));

          }

       

      Output:

      2015-12-15 11:24:17,738  (default task-14) null

      2015-12-15 11:25:04,139  (default task-14) null

       

      2015-12-15 11:25:09,933  (default task-14) Cookie

      2015-12-15 11:25:10,852  (default task-14) Accept

      2015-12-15 11:25:11,452  (default task-14) User-Agent

      2015-12-15 11:25:12,091  (default task-14) X-Forwarded-Host

      2015-12-15 11:25:16,177  (default task-14) Host

      2015-12-15 11:25:16,177  (default task-14) Accept-Encoding

      2015-12-15 11:25:16,177  (default task-14) Pragma

      2015-12-15 11:25:16,177  (default task-14) Authorization

      2015-12-15 11:25:16,177  (default task-14) Cache-Control

      2015-12-15 11:25:16,177  (default task-14) Upgrade-Insecure-Requests

      2015-12-15 11:25:16,177  (default task-14) X-Forwarded-For

      2015-12-15 11:25:16,177  (default task-14) Accept-Language

      2015-12-15 11:25:16,177  (default task-14) X-Forwarded-Server

       

      2015-12-15 11:25:16,177  (default task-14) Basic bWF0ZWo6aGVzbG8=

       

      there we can see, the Authorization flag is in the Request (also was wisible when I traced the packets in wireshark).

       

      Why am I still getting null when calling request.getRemoteUser()?

       

      Thanks in advance

       

      Best regards

      Matej