@Override
    public String encode(final String data, final Optional<RegisteredService> service) {
        if (service.isPresent()) {
            val registeredService = service.get();
            if (supports(registeredService)) {
                LOGGER.debug("Found signing and/or encryption keys for [{}] in service registry to encode", registeredService.getServiceId());
                val cipher = getTokenTicketCipherExecutorForService(registeredService);
                if (cipher.isEnabled()) {
                    return cipher.encode(data);
                }
            }
        }
        return encode(data, ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY);
    }
This is {@link RegisteredServiceJwtTicketCipherExecutor}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-token-core-api/src/main/java/org/apereo/cas/token/cipher/RegisteredServiceJwtTicketCipherExecutor.java