-
1. Re: how to auto-login before redirecting to login page?
serkan Mar 30, 2012 5:49 AM (in response to java.n.linux)-Redirect to your authentication method from your welcome.xhtml (so the first thing that happens is authentication when the app startsup). Anyways, make sure that you're logged in when the app is up and running. You can even try to do this in a bean annotated with @Startup, which also gets executed when Seam starts up.
-If someone has bookmarked a page and tries to access that page without authentication, then listen to the NotLoggedIn event by making an observer and handle the authentication logic there.
And as always, read the manual for more info check the Security chapter for usefull info on this subject.
-
2. Re: how to auto-login before redirecting to login page?
java.n.linux Mar 30, 2012 1:26 PM (in response to serkan)Hi Serkan,
Actually I just want restricted pages require login. So I think doing auto-login at startup for non-restricted pages isn't the right way.
-----------------
Edit:
I think I did it.
in my login.page.xml, I added an action for executing login. The rest was generated by seam-gen
<action execute="#{identity.login}"/>
<navigation from-action="#{identity.login}">
<rule if="#{identity.loggedIn}">
<redirect view-id="/home.xhtml" />
</rule>
</navigation>
Thank you for supporting me
-
3. Re: how to auto-login before redirecting to login page?
serkan Apr 1, 2012 9:53 AM (in response to java.n.linux)- in your pages.xml set login-page=/autologin.xhtml, note that this page shouldn't exist !!
- then <page view-id='/autologin.xhtml' action='#{authentication.autoLogin}'/>, in autoLogin make sure you call Identity.quietLogin.