Ticket Granting Ticket ID Null in Logout Flow

86 views
Skip to first unread message

Robert

unread,
Apr 12, 2016, 8:06:05 AM4/12/16
to CAS Community
Hi,

I'm trying to get the CAS Principal (the authenticated user) from the TGT in the logout web flow.  So, I tried to get the authenticated user's TGT at the beginning of the logout web flow (i.e. stateEntering of terminateSessionAction) using a web flow listener.  I have tried getting the TGT ID using WebUtils.getTicketGrantingTicketId(context) and ticketGrantingTicketCookieGenerator.retrieveCookieValue(request), but both method calls return null.  I looked at the cookies with request.getCookies() and it returns just the JSESSIONID cookie, so it appears that the TGT cookie has been destroyed.  But, when I get the tickets using centralAuthenticationService.getTickets(TruePredicate.truePredicate()), I see that the TGT is still in the DefaultTicketRegistry and ticketGrantingTicket.isExpired() returns false.  Is there another way to get the TGT and CAS Principal when the user logs out?

Thanks!

Robert

unread,
Apr 12, 2016, 9:50:38 AM4/12/16
to CAS Community
I'm using CAS 4.1.6.

Misagh Moayyed

unread,
Apr 12, 2016, 11:30:03 AM4/12/16
to CAS Community

Don’t do a listener. Write your own action or peek into the flowScope. See TerminateSessionAction.java for an example.  

 

--
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/e4788330-8777-446c-8853-89a8773881ae%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.

robert.p...@gdit.com

unread,
Apr 13, 2016, 7:59:42 AM4/13/16
to jasig-cas-user, cas-...@apereo.org
I tried moving my code from the web flow listener to my own action, which I made the first action to execute before terminateSessionAction,  I got the same result as with the listener:  the ticket granting ticket ID is null in my Eclipse debugger.  Here is what my action does:

    public Event init(final RequestContext context) {
        String tgtId = WebUtils.getTicketGrantingTicketId(context);
        if (tgtId == null) {
            final HttpServletRequest request = WebUtils.getHttpServletRequest(context);
            tgtId = this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request);
        }
        if (tgtId != null) {
            // Do stuff with the tgtId

In cas-servlet.xml, I just passed in the ticket granting ticket cookie generator as a constructor argument.

Here is my action in logout-webflow.xml:

  <action-state id="myAction">
    <evaluate expression="myAction.init(flowRequestContext)" />
    <transition to="terminateSession" />
  </action-state>

robert.p...@gdit.com

unread,
Apr 13, 2016, 8:09:42 AM4/13/16
to jasig-cas-user, cas-...@apereo.org
I also debugged TerminateSessionAction and the ticket granting ticket it retrieves is also null.
--
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.

Robert

unread,
Apr 13, 2016, 8:53:27 AM4/13/16
to CAS Community
I found the problem.  We changed the context path of CAS and didn't change the cookiePath of the ticket granting ticket cookie generator.  Thanks.


On Tuesday, April 12, 2016 at 8:06:05 AM UTC-4, Robert wrote:
Reply all
Reply to author
Forward
0 new messages