tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Programmatic login with Tomcat 4.0.1
Date Fri, 04 Jan 2002 18:25:49 GMT


On Fri, 4 Jan 2002, Sergei Batiuk wrote:

> Date: Fri, 4 Jan 2002 14:10:03 +0200
> From: Sergei Batiuk <Sergei.Batiuk@Damen-Okean.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> 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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message