I think the same Bill implements with a Valve could be implemented with a
Filter with an HttpRequestWrapper for setting the principal. Am I right?

----- Original Message -----
From: "Bill Barker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 17, 2002 8:53 AM
Subject: Re: Programmatic login


> The following is a bare-bones implemetation.  Posted under the standard
> Apache Licence.
>
> import java.io.*;
> import java.security.Principal;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import org.apache.catalina.*;
>
> public class MyValve implements Valve {
>     public MyValve() {}
>
>     public void invoke(Request request, Response response, ValveContext
> context)
>          throws IOException, ServletException {
>          HttpSession session = ((HttpServletRequest)request.getRequest())
>                                                 .getSession(false);
>          if(session != null) {
>             Principal user =
> (Principal)session.getAttribute("my.login.principal");
>             if(user != null) {
>                 ((HttpRequest)request).setUserPrincipal(user);
>             }
>          }
>          context.invokeNext(request, response);
>   }
> }
>
>
> "Zsolt Koppany" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> it sounds very interesting. Could you provide some implementation details
> (source code)?
>
> Zsolt
>
> On Saturday 16 November 2002 08:26, Bill Barker wrote:
> > setUserPrincipal
>
>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to