public TicketGrantingTicket fetchTicketGrantingTicketFrom(final JEEContext context) {
        val ticketGrantingTicket = CookieUtils.getTicketGrantingTicketFromRequest(
            getTicketGrantingTicketCookieGenerator(),
            getTicketRegistry(), context.getNativeRequest());
        if (!ticketGrantingTicketCookieGenerator.containsCookie(context.getNativeRequest())) {
            return Optional.ofNullable(ticketGrantingTicket)
                .orElseGet(() -> {
                    val manager = new ProfileManager(context, getSessionStore());
                    return manager.getProfile()
                        .map(profile -> profile.getAttribute(TicketGrantingTicket.class.getName()))
                        .map(ticketId -> ticketRegistry.getTicket(ticketId.toString(), TicketGrantingTicket.class))
                        .orElse(null);
                });
        }
        return ticketGrantingTicket;
    }
Gets ticket granting ticket.

@param context the context
@return the ticket granting ticket
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20ConfigurationContext.java