-
1. Re: jaas behaviour for unchecked URIs
stueccles Jun 30, 2004 6:46 AM (in response to snavjot)yes by default Tomcat (dont know about Resin) stores the principals in the session (strangely using Session.setNote() so actually its not available through HttpSession ) but JBoss instead doesnt store the principals and instead stores the credentials in the session it then delegates to the JbossSecurityMgrRealm which delegates to the JBoss security manager which uses the credentials to authenticate and stores the principals in its own cache.
Subsequent checked requests are always sent to the JBoss security manager which looks it up in its own cache. hence the principals are only available when it bothers to reauthenticate in a checked URI. And those are only ever stored in the request not in the session.
So if you want to track a user on unchecked pages you have to do it yourself
the way i see it you could
1) Have a filter that takes the sees if you have a request.getUserPrincipal() and if so stores it in the session too. if a request does not have a request.getUserPrincipal() looks in the session and gets the principal and then does a request.setUserPrincipal() (Note this wont help you if the user calls EJB methods that have security.. you would also have to set the security association)
2) Write a custom tomcat authenticator.
3) Make all pages checked pages in the web.xml but have public accessable pages accessible to a "guest" role -
2. Re: jaas behaviour for unchecked URIs
snavjot Jul 1, 2004 4:15 AM (in response to snavjot)thx for a detailed reply that's not readily available at jboss forums.
Yes, I wrote a filter that will save the authenticated principal in session for me.
As i am moving away from existing app, that relies on some jey in session. So, i got to save the principal in session. I found it better than digging the code of entire app.
I know i should have planned properly but never mind. Will refactor when i get some time.
thanks again.
Navjot Singh