public static TicketGrantingTicket getTicketGrantingTicketFromRequest(final CasCookieBuilder ticketGrantingTicketCookieGenerator,
                                                                          final TicketRegistry ticketRegistry,
                                                                          final HttpServletRequest request) {
        val cookieValue = ticketGrantingTicketCookieGenerator.retrieveCookieValue(request);
        if (StringUtils.isNotBlank(cookieValue)) {
            return FunctionUtils.doAndHandle(() -> {
                val state = ticketRegistry.getTicket(cookieValue, TicketGrantingTicket.class);
                return state == null || state.isExpired() ? null : state;
            });
        }
        return null;
    }
Gets ticket granting ticket from request.

@param ticketGrantingTicketCookieGenerator the ticket granting ticket cookie generator
@param ticketRegistry                      the ticket registry
@param request                             the request
@return the ticket granting ticket from request
core/cas-server-core-cookie-api/src/main/java/org/apereo/cas/web/support/CookieUtils.java