Skip to content

An interceptor from AuthorizationInterceptor that uses a MemoryCache for handle authorization headers

License

Notifications You must be signed in to change notification settings

Adolfok3/AuthorizationInterceptor.Extensions.MemoryCache

Repository files navigation

AuthorizationInterceptor Icon

AuthorizationInterceptor.Extensions.MemoryCache

GithubActions License Coverage Status NuGet Version

An interceptor for AuthorizationInterceptor that uses a in Memory cache to handle authorization headers. For more information on how to configure and use Authorization Interceptor, please check the main page of AuthorizationInterceptor.

Installation

Run the following command in package manager console:

PM> Install-Package AuthorizationInterceptor.Extensions.MemoryCache

Or from the .NET CLI as:

dotnet add package AuthorizationInterceptor.Extensions.MemoryCache

Setup

When adding Authorization Interceptor Handler, call the extension method UseMemoryCacheInterceptor to options:

services.AddHttpClient("TargetApi")
        .AddAuthorizationInterceptorHandler<TargetApiAuthClass>(options =>
		{
			options.UseMemoryCacheInterceptor();
		})