-
1. Re: Autologin support
mteichmann.mark.teichmann.info-ag.de Sep 4, 2008 3:05 PM (in response to bashan)If you are using Windows than this page will show you the solution:
Windows SSO with JBOSS Seam -
2. Re: Autologin support
bashan Sep 4, 2008 3:34 PM (in response to bashan)Thanks, but this is not what I meant.
I meant autologin like in facebook/gmail or any other pupular internet website existing today...
-
3. Re: Autologin support
andre.eugenio Sep 4, 2008 4:04 PM (in response to bashan)First you should read http://blog.hibernate.org/3266.lace
Then you should know that Seam 2.1 will support autologin.
To implement this now i stored custom cookie when the user log in, and my secured pages try to restore the cookie if he is not logged in.
Look the code below in my pages.xml
<page view-id="/auth/*"> #0 <navigation from-action="#{identity.logout}"> <raise-event type="removeLogonCookie" /> <redirect view-id="/logon.xhtml" /> </navigation> #1 <action execute="#{autoLogon.checkLogonCookie}" if="#{!identity.loggedIn}" /> <navigation> #2 <rule if-outcome="noSessionAvailable"> <redirect view-id="/logon.xhtml" /> </rule> </navigation> </page>
#0 If he logged out i have to remove the cookie
#1 If he is not logged in i try to check the cookie and restore the session
#2 If no cookie available i redirect to logon page.
public String checkLogonCookie() { try { FacesContext context = FacesContext.getCurrentInstance(); log.info("Check Cookie from view #0", context.getViewRoot().getViewId()); Cookie []cookies = ((HttpServletRequest)context.getExternalContext().getRequest()).getCookies(); if(cookies != null) { for (Cookie cookie : cookies) { if(cookie.getName().equals("myUserCookie") && cookie.getValue() != null && !cookie.getValue().equals("null") && cookie.getValue().length() > 0) { String values = CipherUtil.decrypt(cookie.getValue()); log.info("User reconnect by cookie - value: #0", values); Identity.instance().login(); return "sessionRestored"; } } } } catch (Exception msg) { log.error("Error trying to restore Cookie Credentials, msg: #0, trace #1", msg.getMessage(), StringUtil.printTrace(msg.getStackTrace())); } Redirect.instance().captureCurrentView(); return "noSessionAvailable"; }
Hope this help.
Cheers, Andre.
-
4. Re: Autologin support
bashan Sep 5, 2008 3:38 PM (in response to bashan)Thanks!
Is there already a preview of Seam 2.1?