Class RemoteLogoCacheDownloader

java.lang.Object
pl.edu.icm.unity.engine.api.files.logo.RemoteLogoCacheDownloader
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean

@Component public class RemoteLogoCacheDownloader extends Object implements org.springframework.beans.factory.DisposableBean
Downloads and caches on local disk logo files referenced by a remote source (a SAML federation's IdPs, an OpenID federation's OPs, ...), so that they can later be served locally without a browser or per-request server side fetch to the (untrusted, remote-controlled) original URI. Downloads for a given cache group + namespace (e.g. a single federation) are coalesced: while a run is in progress, further requests don't start a parallel run - the latest one supersedes any not-yet-started request queued behind it, and runs as soon as the current run finishes. See CachedLogoFileLoader for the read side.
  • Constructor Details

  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • downloadLogoFilesAsync

      public CompletableFuture<Void> downloadLogoFilesAsync(String cacheGroup, String namespaceId, Map<? extends LogoCacheKey,Map<String,String>> logosByKeyAndLocale, String httpsTruststore)
      Parameters:
      cacheGroup - logical owner of the cache (e.g. "samlIdpLogos", "oauthFederationLogos") - keeps different modules' caches from colliding on disk.
      namespaceId - id of the remote source the logos come from (e.g. a federation id) - used to scope cleanup of no-longer-referenced logos to a single refresh run.
      logosByKeyAndLocale - for every cached entity, its logo URI(s) keyed by locale code (empty string for the default/unlocalized one).