Session Login Check in JSF !!! Please Help.
843842Apr 1 2005 — edited Nov 9 2008Hi:
I'm new to JSFs and I have some problem with checking if a user had logged in or not.
As I ask before in this forum, I want to check if a user had logged in in every jsf page and if not the redirect him to the login page.
I got some answer but I didn't understand exactly how to do it. So I'm asking again. Please don't get angry... :-)
We have many jsf pages developed. We also have a jsf login page. But every user should log in before enter the site.
So we must include some king of control in every single jsf page to know if the user exists and is logged in. If don't, then redirect the navigation to the login page.
I tried many ideas and possibles solutions but I can't make it work as described before.
Any kind of help and comments would be appreciated !!!
Thanks a lot.
Felipe
PD: Perhaps, these questions can help to understand my problem.
1) How can I create an instance of a bean (the UserLoginBean with application or session scope) without referencing it from a jsf page. And do it when the user wants to access the site.
2) How can I check in every jsf page if the user had logged in ? I think that I must check first if the UserLoginBean exists and then if the user is logged in, in some Java method of a bean, perhaps the same UserLoginBean.
But how do I call that check from every JSF page ?
3) How I redirect a user to the login page if not logged in ?
4) How I terminate a user session ?
Thanks a lot !!!!