@Override
    public Ticket buildTicketGrantingTicket(final AuthenticationResult authenticationResult,
                                            final Authentication authentication,
                                            final String ticketGrantingTicket) {
        try {
            return shouldIssueTicketGrantingTicket(authentication, ticketGrantingTicket)
                ? createTicketGrantingTicket(authenticationResult, ticketGrantingTicket)
                : updateTicketGrantingTicket(authentication, ticketGrantingTicket);
        } catch (final Throwable e) {
            LoggingUtils.error(LOGGER, e);
            if (e instanceof final PrincipalException pe) {
                throw pe;
            }
            throw new InvalidTicketException(ticketGrantingTicket);
        }
    }
This is {@link DefaultSingleSignOnBuildingStrategy}.

@author Misagh Moayyed
@since 7.1.0
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/DefaultSingleSignOnBuildingStrategy.java