Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Src/Fido2.AspNet/DistributedCacheMetadataService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Text.Json;

using Fido2NetLib.Serialization;

using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Internal;
Expand Down Expand Up @@ -103,7 +105,7 @@ protected virtual async Task StoreDistributedCachedBlob(IMetadataRepository repo
{
await _distributedCache.SetStringAsync(
GetBlobCacheKey(repository),
JsonSerializer.Serialize(payload),
JsonSerializer.Serialize(payload, FidoModelSerializerContext.Default.MetadataBLOBPayload),
new DistributedCacheEntryOptions()
{
AbsoluteExpiration = GetDistributedCacheAbsoluteExpiryTime(GetNextUpdateTimeFromPayload(payload))
Expand All @@ -120,7 +122,7 @@ protected virtual async Task<MetadataBLOBPayload> GetDistributedCachedBlob(IMeta
{
try
{
var cachedBlob = JsonSerializer.Deserialize<MetadataBLOBPayload>(distributedCacheEntry);
var cachedBlob = JsonSerializer.Deserialize(distributedCacheEntry, FidoModelSerializerContext.Default.MetadataBLOBPayload);
var nextUpdateTime = GetNextUpdateTimeFromPayload(cachedBlob);

//If the cache until time is in the past then update and return new data, otherwise return the cached value
Expand Down