Class CatalogVendorAwareCacheKeyEnhancer

    • Constructor Detail

    • Method Detail

      • addPropertiesToCacheKey

        protected void addPropertiesToCacheKey​(Set<String> currentRequiredPolicyRoots,
                                               AuthenticationVendorPrivilegesSummary vendorPrivilegesSummary,
                                               String requestedCatalogVendorRef,
                                               com.fasterxml.jackson.databind.node.ObjectNode cacheKey)
      • getRestrictedAuthoritiesGrantedToRequestedVendor

        protected Set<String> getRestrictedAuthoritiesGrantedToRequestedVendor​(Set<String> currentRequiredPolicyRoots,
                                                                               AuthenticationVendorPrivilegesSummary vendorPrivilegesSummary,
                                                                               String requestedVendor)
        Caching will pretty much only ever be used on read operations, but we can't just filter to vendor restrictions matching the current policy requirements since the ContextStateBuilder's mutability check to set ContextState.getMutable() will perform policy validation against _updates_ as well. Thus, to be safe, we will include all restricted authorities sharing the same _root_ as the current policy requirements.

        Furthermore, since requestedVendor is known, we can further optimize to only return the authorities which the authentication has been granted for that vendor. This means even authentications with different sets of vendors for each authority will still ultimately produce the same cache key as long as the authorities for the requested vendor match.

        This should eliminate irrelevant roots from the cache key (preventing unnecessarily unique keys) while protecting against a situation where an authentication with READ_* sees the same mutability as an authentication with READ_* and UPDATE_*.

        Parameters:
        currentRequiredPolicyRoots - the permission roots required by the current policy requirements. Authorities will be filtered to only include those matching these roots.
        vendorPrivilegesSummary - the summary of vendor privileges granted to the current authentication
        requestedVendor - the vendorRef of the vendor in which which data is being requested
        Returns:
        a set containing all of the relevant restricted authorities matching the required policy roots which have been granted for the requested vendor