users@jsf-extensions.java.net

Navigation after a ServletFilter

From: heizenberg <darthheizenberg+nabble_at_gmail.com>
Date: Fri, 8 Feb 2008 08:08:22 -0800 (PST)

Hi,
I'm trying to figure out how to approach this problem in JSF.

I have an application, guarded with a ServletFilter (using NTLM
authentication with jCIFS) that's checking for an authentication token in
the session. If the token is absent, the browser pops up a login box and
lets the user enter credentials.

At this point the filter allows the request to proceed to the requested URL
(/index.jsp) that forwards to the first jsf page in the application. The
trouble is that I can potentially have more than one 'first' or 'entry'
page... and this is decided by the user's role.

I want to be able to intercept the request after the Authentication Filter
and depending on the user's role (retrieved in their credentials) I want to
forward them to one of two jsf pages. For example, one page for admins, and
a different page for non-admins.

I doubt if I want to handle this with another filter... since filters should
really call the next chained filter on the stack. Additionally, I may want
to add more filters in the chain at some point in time.

As I write this, I can envision one way of doing this. Stuff an attribute in
the session and have the index.jsp page behave as the navigation
controller... i.e. instead of having the standard <jsp:forward
page="/pages/home.jsf" />, I could have something like <jsp:forward
page="/pages/${an_attribute_in_the_request}.jsf" />.

Is this doable with an Action/ActionListener mechanism(or any other event
mechanism) of some sort? Is there any other JSF construct that can help me
do this? It needs to be called before the JSF navigation handler has already
dispatched the request to the entry page specified in the web.xml.

Thanks,
Ananda
-- 
View this message in context: http://www.nabble.com/Navigation-after-a-ServletFilter-tp15358372p15358372.html
Sent from the jsf-extensions users mailing list archive at Nabble.com.