On Fri, 4 Jan 2002, Sergei Batiuk wrote:
> Date: Fri, 4 Jan 2002 14:10:03 +0200
> From: Sergei Batiuk <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Programmatic login with Tomcat 4.0.1
>
> Hello people,
>
> I need to programmatically login my session into Tomcat 4.0.1 servlet
> container. However, I could not find the API in JavaDocs that accomplishes
> this goal.
>
> How do I programmatically login into TC 4.0.1?
>
Tomcat doesn't have any direct APIs for that.
One approach (which would actually be portable to other containers as
well) would be to write a Filter which wrapped the incoming request, and
overrode the getRemoteUser(), getUserPrincipal(), and isUserInRole()
methods. It's really the *effect* of logging in that you're after, and
this is how an application finds out.
This wouldn't work in a J2EE environment (because the fake "Principal" you
return wouldn't be a real one that allowed EJB access), but it should work
fine for a servlet-only environment.
> Sincirely,
> Sergei Batiuk.
>
Craig McClanahan
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>