public static Principal getPrincipalFromRequestContext(final RequestContext requestContext,
                                                           final TicketRegistrySupport ticketRegistrySupport) {
        val tgt = WebUtils.getTicketGrantingTicketId(requestContext);
        if (StringUtils.isBlank(tgt)) {
            throw new IllegalArgumentException("No ticket-granting ticket could be found in the context");
        }

        return ticketRegistrySupport.getAuthenticatedPrincipalFrom(tgt);
    }
Gets the authenticated principal.

@param requestContext        the request context
@param ticketRegistrySupport the ticket registry support
@return the principal
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java