CachingSecureHttpFetcherDecorator Class
A decorator for ISecureHttpFetcher that adds caching capabilities. Caches successful responses for the configured duration to reduce network calls and improve performance.
public class CachingSecureHttpFetcherDecorator : Abblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcherInheritance System.Object → CachingSecureHttpFetcherDecorator
Implements ISecureHttpFetcher
Constructors
CachingSecureHttpFetcherDecorator(ISecureHttpFetcher, IMemoryCache, TimeSpan) Constructor
A decorator for ISecureHttpFetcher that adds caching capabilities. Caches successful responses for the configured duration to reduce network calls and improve performance.
public CachingSecureHttpFetcherDecorator(Abblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher inner, Microsoft.Extensions.Caching.Memory.IMemoryCache cache, System.TimeSpan cacheDuration);Parameters
inner ISecureHttpFetcher
The inner fetcher to decorate.
cache Microsoft.Extensions.Caching.Memory.IMemoryCache
The memory cache to store responses.
cacheDuration System.TimeSpan
How long a successfully fetched document is held. Supplied per consumer at registration rather than read from a shared setting, so each one states the staleness it can live with: a key set backing token issuance and one backing an occasional signature check do not want the same lifetime, and the transport contract stays free of the caller's policy.
Methods
CachingSecureHttpFetcherDecorator.FetchAsync<T>(Uri) Method
Fetches content from a URI with SSRF protection. For JSON content, deserializes to the specified type. For raw content like JWT strings, use string as the type parameter.
public System.Threading.Tasks.Task<Abblix.Utils.Result<T,Abblix.Oidc.Server.Common.OidcError>> FetchAsync<T>(System.Uri uri);Type parameters
T
The type to deserialize the response to. Use string for raw text content.
Parameters
uri System.Uri
The URI to fetch content from.
Implements FetchAsync<T>(Uri)
Returns
System.Threading.Tasks.Task<Abblix.Utils.Result<T,OidcError>>
A Result containing either the deserialized content or an OidcError if the fetch operation fails.