protected Principal getActivePrincipal(final List<Credential> credential,
                                           final WebApplicationService service,
                                           final Authentication authentication) throws Throwable {
        if (credential != null && !credential.isEmpty()) {
            LOGGER.trace("Finalizing authentication transaction for [{}]", credential);
            val authenticationResult = getConfigurationContext().getAuthenticationSystemSupport()
                .finalizeAuthenticationTransaction(service, credential);
            return authenticationResult.getAuthentication().getPrincipal();
        }
        return Objects.requireNonNull(authentication).getPrincipal();
    }
Grant service ticket for the given credential based on the service and tgt
that are found in the request context.

@param context the context
@return the resulting event. Warning, authentication failure or error.
@since 4.1.0
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/resolver/impl/ServiceTicketRequestWebflowEventResolver.java