AnsweredAssumed Answered

URL redirection after an external login with CAS

Question asked by iblanco on Oct 31, 2008
Latest reply on Dec 17, 2008 by ericc
Hi,

I have Alfresco ( 2.1 ) authenticating against a JA-SIG CAS SSO system and it works right it authenticates me and it takes me to my home folder.

If after having logged in CAS i click in a URL that points to a content in my Alfresco repository it just opens it, as I expected. But, if I've not already logged in CAS when I click the URL it takes me to CAS login page and after login does not take me directly to the content but to the starting Alfresco page. It seems like it forgets where I was pretending to go.

I've checked how Alfresco's original login.jsp manages that and it seems that there is a session variable called "_alfRedirect" that "remembers" where I wanted to go. So I suppose the problem is that the CASAuthenticationFilter I use does only set the username value in the session and not the value corresponding to _alfRedirect.

Is it possible to change the filter code in order for it to manage _alfRedirect right ? Should something like this work:

                // Store the original URL
                httpSess.setAttribute(LoginBean.LOGIN_REDIRECT_KEY, ??????);

The username is taken from the session:

      String userName = null;
      Object o = httpSess.getAttribute(CASFilter.CAS_FILTER_USER);
      if (o == null) {
         logger.error("CAS : CASFilter.CAS_FILTER_USER == NULL");
      } else {
         userName = o.toString();
      }

Could I also recober the _alfRedirect in the same way ?

Does all of this make any sense to someone?

Thanks.

Outcomes