title: Accessing username with getRemoteUser() when using custom authentication filter
body: <p>Short version:  How do I get <code>HttpServletRequest.getRemoteUser()</code> to return the username when I am using a custom authentication filter?</p>
  
  <p>Long version:  </p>
  
  <p>I am modifying a Tomcat application that currently uses declarative security (web.xml &amp; tomcat-users.xml) to instead use a custom (written by me) authentication filter (derived from javax.servlet.Filter).  There is a lot of information out there on how to do this and it looks very straightforward.</p>
  
  <p>However, the existing application makes calls to <code>HttpServletRequest.getRemoteUser()</code>, and I assume that unless I do something to set this property in my filter, it will return null.  I cannot find any information on how to populate the <code>getRemoteUser()</code> property in a filter (there is no <code>setRemoteUser()</code>).  I found a <a href="http://struts.1045723.n5.nabble.com/how-to-set-remoteuser-td3483472.html" rel="nofollow">post out there</a> that recommends wrapping the request object in the filter.  I will do this if I have to, but I am hoping there is a less invasive way to accomplish this.</p>
  
  <p>Can anyone help?</p>