I suggest using an MVC (aka "Model 2") approach, separating your view
from your controller.  One of the controller's responsibilities can be
to check for authentication and provide to the user either the requested
page or the login page.

If you use a dispatcher-servlet-action framework for your controller,
you typically will only need to put the authentication checking code in
a base action class from which all protected action classes derive.  If
you use JSPs as controllers you'll need some sort of code in every one
(you can use @include for this).

You will be much happer if you use an MVC appraoch, trust me.  The J2EE
automatic form-based authentication is very crude and fails to
accomodate simple use cases like automatically logging in new users.

You might want to look at WebWork:
http://www.sourceforge.net/projects/webwork.

BTW, if you use the Orion UserManager (and RoleManager), you should not
do your own database lookup.  Calling RoleManager.login() causes methods
to be called on the UserManager, which can either be your class or one
of the UserManagers that ship with Orion.  DataSourceUserManager looks
up password and group information in a table.

Jeff

>-----Original Message-----
>From: Alex Paransky [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 13, 2001 3:20 PM
>To: Orion-Interest
>Subject: RE: How to enable UserManager support for arbitrary user...
>
>
>Tim, this IS what I am looking for, but does it mean that I 
>need to put this
>into every .JSP page that I have?  Then, somehow (according to 
>J2EE spec)
>Orion will forward this information to all EJB calls and 
>properly make use
>of the deployment descriptor stuff?  So every .JSP page will check the
>session, find the User object which I stored in there, and 
>execute this call
>with the user.login and user.password?
>
>Thanks.
>-AP_
>
>-----Original Message-----
>From: Tim Endres [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 13, 2001 3:04 PM
>To: Orion-Interest
>Cc: Alex Paransky
>Subject: Re: How to enable UserManager support for arbitrary user...
>
>
>Is this what you are looking for?
>
>   RoleManager roleMgr = (RoleManager)
>      (new InitialContext()).lookup( "java:comp/RoleManager" );
>   roleMgr.login( "user", "pass" );
>
>Unfortunately, I think that can only run in the container. To 
>accomodate
>multiple logins under a servlet, we used to use a new InitialContext on
>every servlet request and set the appropriate JNDI properties for each
>InitialContext construction.
>
>tim.
>
>> We have developed a web application with our own user/group schema.
>> Creating a UserManager to map our schema seems pretty 
>trivial.  What we
>are
>> NOT clear on is how to tell Orion that a particular user has 
>logged in.
>>
>> For example, we start our application with a LOGIN.JSP page, 
>which accepts
>> user name/password, and proceeds to find the user in the 
>database.  After
>> the user is found/authenticated, we create an HTTP session, 
>and store a
>> certain User object in the session to tell us who the user 
>is on the next
>> http request.
>>
>> How do we introduce J2EE security into this picture.  In 
>other words, how
>do
>> we tell Orion which user is logged on so that it starts 
>using the security
>> attributes/group/rights of the deployment descriptors?  Do 
>we need to put
>a
>> special attribute into the HTTPSession so that Orion knows 
>on behalf of
>what
>> user the request is running?
>>
>> Thanks.
>> -AP_
>>
>>
>
>
>

Reply via email to