An interceptor for AuthorizationInterceptor that uses a distributed cache with Redis to handle authorization headers. For more information on how to configure and use Authorization Interceptor, please check the main page of AuthorizationInterceptor.
Run the following command in package manager console:
PM> Install-Package AuthorizationInterceptor.Extensions.Redis
Or from the .NET CLI as:
dotnet add package AuthorizationInterceptor.Extensions.Redis
When adding Authorization Interceptor Handler, call the extension method UseStackExchangeRedisCacheInterceptor
to options passing the redis options:
services.AddHttpClient("TargetApi")
.AddAuthorizationInterceptorHandler<TargetApiAuthClass>(options =>
{
options.UseStackExchangeRedisCacheInterceptor(redisOptions =>
{
redisOptions.Configuration = "redisConnStr";
redisOptions.InstanceName = "target_api";
});
})