DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12428>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12428

request.getUserPrincipal(): Misinterpretation of specification?





------- Additional Comments From [EMAIL PROTECTED]  2003-09-29 02:30 -------
I don't see anything in the 2.3 spec that precludes the way that Tomcat handles 
this.  The 2.4 spec is a bit more ambiguous, so I'm going to have to try to get 
a clarification from the expert-group before marking this as INVALID.

As a work-around, try using a simple Filter something like:
   public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
      throws IOException, ServletException {
      HttpServletRequest request = (HttpServletRequest)req;
      Principal userPrin = request.getUserPrincipal();
      if(userPrin == null) {
          HttpSession session = request.getSession(true);
          Principal myPrin = (Principal)session.getAttribute
("com.myfirm.MyPrincipal");
          if(myPrin != null) {
            req = new MyAuthRequest(myPrin);
          }
      } else {
          HttpSession session = request.getSession(true);
          session.setAttribute("com.myfirm.MyPrincipal", userPrin);
      }
      chain.doFilter(req, res);
   }
   static class MyAuthRequest extends HttpServletRequestWrapper {
      Principal myPrin;
      MyAuthRequest(Principal prin) {
      myPrin = prin;
      }
      public Principal getUserPrincipal() {
         return myPrin;
      }
   }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to