wood burning stoves 2.0
The moose likes Servlets and the fly likes j_security_check and user info Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "j_security_check and user info" Watch "j_security_check and user info" New topic

j_security_check and user info

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

If I am using an App Servers authentication mechanism with j_security_check what would be a good way to get additional user information stored in a Bean for use in the web app?
Is there anyway to say "Once the user is logged in do this..." immediatly after you authenticate to the server?
Or am I stuck with getting this information from the database, worst case, the first time it is needed. Of course then I add another "Does this exist yet" check in my code. Ugh!

GenRocket - Experts at Building Test Data
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
I don't think I understand your question thoroughly. form-based authentication is just that, the container just checks against your roles, users, realm, etc; but that's about it.
if you need to fetch additional information from that user, I guess you'll have to go an look it up in the database.
maybe I'm the only one not fully understanding your question...
[ January 06, 2004: Message edited by: Andres Gonzalez ]

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

j_security_check implied he is using FORM based authentication, not BASIC. (I'm not sure why they always capitalise these).
One method that sometimes works is to submit to your own servlet then forward to the j_security_check servlet. Another is to have a base servlet that all servlets extend, then have that look at each request, find any that have the Remote User set, but hasn't been loaded, and then load the user. You could do this with a filter too.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
you're right, I was editing my posts while you were posting
I agree. Here's the link: http://aspose.com/file-tools
subject: j_security_check and user info
It's not a secret anymore!