@Override
    protected Event doExecuteInternal(final RequestContext context) throws Throwable {
        val ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
        val ticketGrantingTicketValueFromCookie = WebUtils.getTicketGrantingTicketIdFrom(context.getFlowScope());

        if (StringUtils.isBlank(ticketGrantingTicketId)) {
            LOGGER.debug("No ticket-granting ticket is found in the context.");
            return success();
        }

        var finalEvent = success();
        val ssoRequest = SingleSignOnParticipationRequest.builder()
            .requestContext(context)
            .build();
        if (WebUtils.isAuthenticatingAtPublicWorkstation(context)) {
            LOGGER.info("Authentication is at a public workstation. SSO cookie will not be generated");
        } else if (singleSignOnParticipationStrategy.supports(ssoRequest)) {
            val createCookie = shouldCreateSingleSignOnCookie(ssoRequest, ticketGrantingTicketId);
            if (createCookie) {
                LOGGER.debug("Setting ticket-granting cookie for current session linked to [{}].", ticketGrantingTicketId);
                finalEvent = createSingleSignOnCookie(context, ticketGrantingTicketId);
            } else {
                LOGGER.info("Authentication session is renewed but CAS is not configured to create the SSO session. "
                    + "SSO cookie will not be generated. Subsequent requests will be challenged for credentials.");
            }
        }

        if (ticketGrantingTicketValueFromCookie != null && !ticketGrantingTicketId.equals(ticketGrantingTicketValueFromCookie)) {
            LOGGER.debug("Ticket-granting ticket from ticket-granting cookie does not match the ticket-granting ticket from context");
            ticketRegistry.deleteTicket(ticketGrantingTicketValueFromCookie);
        }
        return finalEvent;
    }
Action that handles the TicketGrantingTicket creation and destruction. If the
action is given a TicketGrantingTicket and one also already exists, the old
one is destroyed and replaced with the new one. This action always returns
"success".

@author Scott Battaglia
@since 3.0.0
support/cas-server-support-actions-core/src/main/java/org/apereo/cas/web/flow/login/SendTicketGrantingTicketAction.java