private ExpirationPolicy determineExpirationPolicyForService(final Service service) {
        val registeredService = servicesManager.findServiceBy(service, CasModelRegisteredService.class);
        if (registeredService != null && registeredService.getServiceTicketExpirationPolicy() != null) {
            val policy = registeredService.getServiceTicketExpirationPolicy();
            val count = policy.getNumberOfUses();
            val ttl = policy.getTimeToLive();
            if (count > 0 && StringUtils.isNotBlank(ttl)) {
                return new MultiTimeUseOrTimeoutExpirationPolicy.ServiceTicketExpirationPolicy(
                    count, Beans.newDuration(ttl).toSeconds());
            }
        }
        return expirationPolicyBuilder.buildTicketExpirationPolicy();
    }
The {@link DefaultServiceTicketFactory} is responsible for
creating {@link ServiceTicket} objects.

@author Misagh Moayyed
@since 4.2
core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/factory/DefaultServiceTicketFactory.java