2 Replies Latest reply on Apr 26, 2011 10:48 AM by mposolda

    "Sign In" link disappears after successful login

    mkalkowski

      Hi All,

       

      I wrote a JAAS login module based on [1] . We are utilizing CAS as a Single Sign-On mechanism. There are many users that are able to log in via CAS but do not have the account in GateIn yet. I have customized the login module to detect this condition (user not present in GateIn's identity store) and programmaticly create the user account for them in the Login Module. Sample algorithm:

       

      SSOLoginModule.java: login():

       

      ...
      user = service.getUserHandler().findUserByName(username);
      if (user != null) {
              service.getUserHandler().removeUser(username, true);
      }
      User user = service.getUserHandler().createUserInstance(username);
      HttpServletRequest req = HttpUtil.getHttpRequest();
      @SuppressWarnings("unchecked")
      Map<String, ?> attributes = (Map<String, ?>) req.getSession().getAttribute(SecurityConstants.SESSION_CAS_ATTRIBUTES);
      fillUserAttributes(user, attributes, isAdmin(attributes));
      service.getUserHandler().createUser(user, true);
      ...
      

       

       

       

      The problem is that when user logs in to portal (via CAS) for the first time, the Sign In , Register and Change Language links disappear and there is no banner portlet on top of the page. I can't therefore log out of the system and have to delete a cookie and try again. Second, third and further attempts to login work properly - the banner portlet displays properly.

       

       

      This has happened to someone else in the forum too: [2].

       

       

      My question is: what could be wrong with the algorithm above ?

       

      This is a typical situation and I think it would be nice to have a module that does that in GateIn. Liferay Portal already offers that kind of functionality.

       

       

      Thanks,

      Michal.

       

       

      [1] http://anonsvn.jboss.org/repos/gatein/components/sso/trunk/agent

      [2] http://community.jboss.org/message/570070#570070