private static String getStringProperty(final Optional<RegisteredService> result,
                                            final RegisteredServiceProperties property) {
        if (result.isPresent()) {
            val registeredService = result.get();
            LOGGER.trace("Resolved registered service [{}] from request to enforce response headers", registeredService);
            val properties = registeredService.getProperties();
            if (!properties.containsKey(property.getPropertyName())) {
                LOGGER.trace("Resolved registered service [{}] from request does not contain a property definition for [{}]",
                    registeredService.getName(), property.getPropertyName());
                return null;
            }
            val prop = properties.get(property.getPropertyName());
            return prop.value();
        }
        LOGGER.trace("Resolved registered service from request can not be located");
        return null;
    }
This is {@link RegisteredServiceResponseHeadersEnforcementFilter}. A filter extension that looks at the properties of a
registered service to determine if headers should be injected into the response.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/support/RegisteredServiceResponseHeadersEnforcementFilter.java