DgcReader.BlacklistProviders.Italy 2.6.0-CI-20230402-140522

This is a prerelease version of DgcReader.BlacklistProviders.Italy.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DgcReader.BlacklistProviders.Italy --version 2.6.0-CI-20230402-140522                
NuGet\Install-Package DgcReader.BlacklistProviders.Italy -Version 2.6.0-CI-20230402-140522                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DgcReader.BlacklistProviders.Italy" Version="2.6.0-CI-20230402-140522" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DgcReader.BlacklistProviders.Italy --version 2.6.0-CI-20230402-140522                
#r "nuget: DgcReader.BlacklistProviders.Italy, 2.6.0-CI-20230402-140522"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DgcReader.BlacklistProviders.Italy as a Cake Addin
#addin nuget:?package=DgcReader.BlacklistProviders.Italy&version=2.6.0-CI-20230402-140522&prerelease

// Install DgcReader.BlacklistProviders.Italy as a Cake Tool
#tool nuget:?package=DgcReader.BlacklistProviders.Italy&version=2.6.0-CI-20230402-140522&prerelease                

Italian Drl Blacklist Provider

DgcReader.BlacklistProviders.Italy

NuGet version (DgcReader.BlacklistProviders.Italy) Nuget

Implementation of IBlacklistProvider for verify revoked certificates.
You can find more details about the DRL specification in the official documentation

Starting from version 1.3.0, the library has been included in the list of verified SDKs by Italian authorities (Ministero della salute).
The approval only refers to the main module DgcReader in combination with the Italian providers included in the project (DgcReader.RuleValidators.Italy, DgcReader.BlacklistProviders.Italy and DgcReader.TrustListProviders.Italy )
Please refer to this guide in order to correctly configure the required services.

Usage

In order to use the provider, you can register it as a service or you can instantiate it directly, depending on how your application is designed:

a) Registering as a service:
public void ConfigureServices(IServiceCollection services)
{
   ...
   services.AddDgcReader()
       .AddItalianTrustListProvider()
       .AddItalianDrlBlacklistProvider(o =>      // <-- Register the ItalianDrlBlacklistProvider service
       {
           // Optionally, configure the validator with custom options
           o.RefreshInterval = TimeSpan.FromSeconds(5);
           o.MinRefreshInterval = TimeSpan.Zero;
           ...
       })
       .AddItalianRulesValidator();
}
b) Instantiate it directly
...
// You can use the constructor
var blacklistProvider = new ItalianDrlBlacklistProvider(httpClient);
...

// Or you can use the ItalianDrlBlacklistProvider.Create facory method
// This will help you to unwrap the IOptions interface when you specify 
// custom options for the provider:
var drlBlacklistProvider = ItalianDrlBlacklistProvider.Create(httpClient, 
   new ItalianDrlBlacklistProviderOptions {
       RefreshInterval = TimeSpan.FromHours(24),
       MinRefreshInterval = TimeSpan.FromHours(1),
       SaveCertificate = true
   });


// Then you should pass it as a parameter to the DgcReaderService constructor:
var dgcReader = DgcReaderService.Create(
   trustListProviders: new ITrustListProvider[] { trustListProvider },
   blackListProviders: new IBlacklistProvider[] { rulesValidator, drlBlacklistProvider },  // Note: both services must be registered as IBlacklistProvider!!
   rulesValidators: new IRulesValidator[] { rulesValidator });

Available options

  • RefreshInterval: interval for checking for updates from the server. Default value is 1 hour.
  • MinRefreshInterval: if specified, prevents that every validation request causes a refresh attempt when the current rules are expired.
    For example, if the parameter is set to 5 minutes and the remote server is unavailable when the RefreshInterval is expired, subsequent validation requests won't try to download updates for 5 minutes before making a new attempt. Default value is 5 minutes.
  • UseAvailableValuesWhileRefreshing: if true, allows the validator to use the expired values already stored in the local db, while downloading the updated values on a background Task.
    This prevents the application to wait that the new values are downloaded.
    As result, the response time of the application will be nearly instantanious, except for the first download or if the rules have reached the MaxFileAge value.
    Otherwise, if the rules are expired, every validation request will wait untill the refresh task completes.
  • BasePath: base folder where the blacklist database will be created. The default value is Directory.GetCurrentDirectory()
  • MaxFileAge: maximum duration of the database before a refresh of the rules is enforced.
    If a refresh is not possible when the refresh interval expires, the current file can be used until it passes the specified period.
    This allows the application to continue to operate even if the backend is temporary unavailable for any reason. Default value is 15 days.
  • DbContext: configures the options for the DbContext. Allows to specify all the options supported by EF Core, including specifying a different database from the default Sqllite
// Example of configuration using Microsoft Sql Server
services.AddDgcReader()
   .AddItalianDrlBlacklistProvider(o =>
   {
       o.DbContext.UseSqlServer("Data Source=localhost;Initial Catalog=DgcReader_ItalianBlacklist;persist security info=True;Integrated Security=True;MultipleActiveResultSets=True");
   });

Forcing the update of the values

If the application needs to update the values at a specific time (i.e. by a scheduled task, or when a user press a "Refresh" button), you can simply call the RefreshBlacklist function of the provider. This will casue the immediate refresh of the values from the remote server, regardless of the options specified.


Copyright © 2021 Davide Trevisan
Licensed under the Apache License, Version 2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net452 is compatible.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.6.1 279 4/3/2023
2.6.0-CI-20230402-140522 135 4/2/2023
2.5.5 453 6/14/2022
2.5.5-rc1 215 6/14/2022
2.5.5-CI-20230402-112357 122 4/2/2023
2.5.5-CI-20230402-101020 95 4/2/2023
2.5.4 419 5/4/2022
2.5.4-rc2 178 5/4/2022
2.5.4-rc1 170 5/4/2022
2.5.3 1,051 3/5/2022
2.5.3-rc1 172 3/5/2022
2.5.1 469 2/16/2022
2.5.1-rc1 163 2/15/2022
2.5.0 455 2/14/2022
2.5.0-rc3 166 2/14/2022
2.5.0-rc2 182 2/11/2022
2.5.0-rc1 166 2/11/2022
2.4.0 442 2/6/2022
2.3.0 455 1/28/2022
2.2.1 429 1/21/2022
2.2.0 279 1/16/2022
2.1.0 270 1/6/2022
2.0.0 264 12/27/2021