public static ExpirationPolicy determineExpirationPolicyForService(final ServicesManager servicesManager,
                                                                       final ExpirationPolicyBuilder expirationPolicy,
                                                                       final Service service) {
        val registeredService = servicesManager.findServiceBy(service);
        if (!(registeredService instanceof final OAuthRegisteredService oauthService)) {
            return expirationPolicy.buildTicketExpirationPolicy();
        }
        if (oauthService.getDeviceTokenExpirationPolicy() != null) {
            val policy = oauthService.getDeviceTokenExpirationPolicy();
            val ttl = policy.getTimeToKill();
            if (StringUtils.isNotBlank(ttl)) {
                return new OAuth20DeviceTokenExpirationPolicy(Beans.newDuration(ttl).toSeconds());
            }
        }
        return expirationPolicy.buildTicketExpirationPolicy();
    }
Determine expiration policy for service expiration policy.

@param servicesManager  the services manager
@param expirationPolicy the expiration policy
@param service          the service
@return the expiration policy
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/ticket/device/OAuth20DeviceTokenUtils.java