Class FidoMetadataDownloader.FidoMetadataDownloaderBuilder.Step5

java.lang.Object
com.yubico.fido.metadata.FidoMetadataDownloader.FidoMetadataDownloaderBuilder.Step5
Enclosing class:
FidoMetadataDownloader.FidoMetadataDownloaderBuilder

public static class FidoMetadataDownloader.FidoMetadataDownloaderBuilder.Step5 extends Object
Step 5: Configure how to cache the metadata BLOB.

This step offers two mutually exclusive options:

  1. Cache the metadata BLOB in a File. See useBlobCacheFile(File).
  2. Cache the metadata BLOB using a Supplier to read the cache and a Consumer to write the cache. See useBlobCache(Supplier, Consumer).
  • Method Details

    • useBlobCacheFile

      public FidoMetadataDownloader.FidoMetadataDownloaderBuilder useBlobCacheFile(@NonNull @NonNull File cacheFile)
      Cache metadata BLOB in the file cacheFile.

      If cacheFile exists, is a normal file, is readable, and is not out of date, then it will be used as the FIDO Metadata Service BLOB.

      Otherwise, the metadata BLOB will be downloaded and written to this file.

      Parameters:
      cacheFile - a File which may or may not exist. If it exists, it MUST contain the metadata BLOB in JWS compact serialization format [RFC7515].
    • useBlobCache

      public FidoMetadataDownloader.FidoMetadataDownloaderBuilder useBlobCache(@NonNull @NonNull Supplier<Optional<ByteArray>> getCachedBlob, @NonNull @NonNull Consumer<ByteArray> writeCachedBlob)
      Cache the metadata BLOB using a Supplier to read the cache, and using a Consumer to write the cache.

      If getCachedBlob returns non-empty and the content is not out of date, then it will be used as the FIDO Metadata Service BLOB.

      Otherwise, the metadata BLOB will be downloaded and written to writeCachedBlob .

      Parameters:
      getCachedBlob - a Supplier that fetches the cached metadata BLOB if it exists. MUST NOT return null. The returned value, if present, MUST be in JWS compact serialization format [RFC7515].
      writeCachedBlob - a Consumer that accepts the metadata BLOB in JWS compact serialization format [RFC7515] and writes it to the cache. Its argument will never be null.