John,

Can you open an enhancement request in our JIRA for this also (forgot to ask
you to do that the other day!).

Thanks
Scott


On Thu, Aug 27, 2009 at 11:42 PM, John Watson <[email protected]> wrote:

> Hi everyone,
> As in my very recent previous email, I have been trying to get CAS Client
> 3.1.7 to work with Atlassian Jira. I have completed my task but need to make
> a little modification to JiraCasAuthenticator.java
>
> I added support for the logout function that gets called by Seraph when a
> user logouts of Jira.
>
> Index:
> cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
> ===================================================================
> ---
> cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
> (revision 46469)
> +++
> cas-client-integration-atlassian/src/main/java/org/jasig/cas/client/integration/atlassian/JiraCasAuthenticator.java
> (working copy)
> @@ -6,6 +6,7 @@
>  package org.jasig.cas.client.integration.atlassian;
>
>  import com.atlassian.seraph.auth.DefaultAuthenticator;
> +import com.atlassian.seraph.auth.AuthenticatorException;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>  import org.jasig.cas.client.util.AbstractCasFilter;
> @@ -33,7 +34,7 @@
>
>          if (session != null) {
>          // user already exists
> -            if
> (session.getAttribute(ConfluenceCasAuthenticator.LOGGED_IN_KEY) != null) {
> +            if (session.getAttribute(LOGGED_IN_KEY) != null) {
>                  log.info("Session found; user already logged in.");
>                  return (Principal) session.getAttribute(LOGGED_IN_KEY);
>              }
> @@ -42,12 +43,27 @@
>
>              if (assertion != null) {
>                  final Principal p =
> getUser(assertion.getPrincipal().getName());
> -                request.getSession().setAttribute(LOGGED_IN_KEY, p);
> -                request.getSession().setAttribute(LOGGED_OUT_KEY, null);
> +                session.setAttribute(LOGGED_IN_KEY, p);
> +                session.setAttribute(LOGGED_OUT_KEY, null);
>                  return p;
>              }
>          }
>
>          return super.getUser(request, response);
>      }
> -}
> \ No newline at end of file
> +
> +    public boolean logout(final HttpServletRequest request, final
> HttpServletResponse response)
> +      throws AuthenticatorException {
> +        final HttpSession session = request.getSession();
> +
> +        if (session != null) {
> +            final Principal p = (Principal)
> session.getAttribute(LOGGED_IN_KEY);
> +            session.setAttribute(LOGGED_OUT_KEY,p);
> +            session.setAttribute(LOGGED_IN_KEY,null);
> +
>  session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION,null);
> +            return true;
> +        }
> +
> +        return super.logout(request, response);
> +    }
> +}
>
>
> John Watson
> Jr. Web Developer
> University of California, Merced
>
> --
> You are currently subscribed to [email protected] as: 
> [email protected]
>
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to