private ExpirationPolicy determineExpirationPolicyForService(final String clientId) {
        val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(this.servicesManager, clientId);
        if (registeredService != null && registeredService.getCodeExpirationPolicy() != null) {
            val policy = registeredService.getCodeExpirationPolicy();
            val count = policy.getNumberOfUses();
            val ttl = policy.getTimeToLive();
            if (count > 0 && StringUtils.isNotBlank(ttl)) {
                return new OAuth20CodeExpirationPolicy(count, Beans.newDuration(ttl).toSeconds());
            }
        }
        return this.expirationPolicyBuilder.buildTicketExpirationPolicy();
    }
Cipher to sign/encrypt codes, if enabled.
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/ticket/code/OAuth20DefaultOAuthCodeFactory.java