DgcReader.RuleValidators.Italy
1.3.0
See the version list below for details.
dotnet add package DgcReader.RuleValidators.Italy --version 1.3.0
NuGet\Install-Package DgcReader.RuleValidators.Italy -Version 1.3.0
<PackageReference Include="DgcReader.RuleValidators.Italy" Version="1.3.0" />
paket add DgcReader.RuleValidators.Italy --version 1.3.0
#r "nuget: DgcReader.RuleValidators.Italy, 1.3.0"
// Install DgcReader.RuleValidators.Italy as a Cake Addin #addin nuget:?package=DgcReader.RuleValidators.Italy&version=1.3.0 // Install DgcReader.RuleValidators.Italy as a Cake Tool #tool nuget:?package=DgcReader.RuleValidators.Italy&version=1.3.0
Italian Rules Validator
DgcReader.RuleValidators.Italy
Implementation of IRulesValidator
for validating Digital Green Certificates against the Italian rules.
The DgcItalianRulesValidator
implements also the IBlacklistProvider
interface, and can be used for both purposes.
Usage
In order to use the validator, 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()
.AddItalianRulesValidator(o => // <-- Register the DgcItalianRulesValidator service
{
// Optionally, configure the validator with custom options
o.RefreshInterval = TimeSpan.FromSeconds(5);
o.MinRefreshInterval = TimeSpan.Zero;
...
});
}
b) Instantiate it directly
...
// You can use the constructor
var rulesValidator = new DgcItalianRulesValidator(httpClient);
...
// Or you can use the DgcItalianRulesValidator.Create facory method
// This will help you to unwrap the IOptions interface when you specify
// custom options for the provider:
var rulesValidator = DgcItalianRulesValidator.Create(httpClient,
new DgcItalianRulesValidatorOptions {
RefreshInterval = TimeSpan.FromHours(24),
MinRefreshInterval = TimeSpan.FromHours(1),
SaveCertificate = true
});
// Then you should pass it as a parameter to the DgcReaderService constructor:
var dgcReader = new DgcReaderService(
trustListProvider,
rulesValidator, // <-- Note: the DgcItalianRulesValidator is both a Blacklist provider and a rules validator
rulesValidator // <-- The rules validator service
);
Available options
- RefreshInterval: interval for checking for rules updates from the server. Default value is 24 hours.
- 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 theRefreshInterval
is expired, subsequent validation requests won't try to download the updated rules for 5 minutes before making a new attempt. Default value is 1 hour. - UseAvailableListWhileRefreshing: if true, allows the validator to use the expired rules already loaded in memory, while downloading the updated rules on a background Task.
This prevents the application to wait that the new rules are downloaded, extending by the time needed for the download the effective validitiy of the rules already loaded.
As result, the response time of the application will be nearly instantanious, except for the first download or if the rules have reached theMaxFileAge
value.
Otherwise, if the rules are expired, every validation request will wait untill the refresh task completes. - BasePath: base folder where the rules list will be saved.
The default value isDirectory.GetCurrentDirectory()
- TrustListFileName: the file name used for the rules list file name. Default is
dgc-rules-it.json
- MaxFileAge: maximum duration of the configuration file before is discarded.
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. - IgnoreMinimumSdkVersion: if true, validates the rules even if the reference SDK version is obsolete.
Forcing the update of the rules
If the application needs to update the rules at a specific time (i.e. by a scheduled task, or when a user press a "Refresh" button), you can simply call the RefreshRulesList
function of the validator.
This will casue the immediate refresh of the rules from the remote server, regardless of the options specified.
The IBlacklistProvider implementation
As already mentioned, the DgcItalianRulesValidator implementation implements both the IBlacklistProvider
and the IRulesValidator
interface.
When registering the provider as a service, it is automatically registered as a IBlacklistProvider
, using the same instance for both roles.
If this is not desired, you can prevent this behavior by specifying it during registration:
public void ConfigureServices(IServiceCollection services)
{
...
services.AddDgcReader()
.AddItalianTrustListProvider()
.AddItalianRulesValidator(cfg =>
{
cfg.UseAsBlacklistProvider(false) // <-- This will prevent to use the validator as an IBlacklistProvider
.Configure(o =>
{
// Eventually continue to configure options...
o.RefreshInterval = TimeSpan.FromSeconds(5);
o.MinRefreshInterval = TimeSpan.Zero;
...
});
});
}
Or you can use it as an IBlacklistProvider
only (i.e. in combination with a rule validator for a different country that has no blacklist providers available):
public void ConfigureServices(IServiceCollection services)
{
...
services.AddDgcReader()
.AddItalianTrustListProvider()
.AddItalianBlacklistProvider();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. |
.NET Framework | net452 is compatible. net46 was computed. net461 was computed. 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. |
-
.NETFramework 4.5.2
- DgcReader (>= 1.3.0)
- Newtonsoft.Json (>= 13.0.1)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.7
- DgcReader (>= 1.3.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
- Newtonsoft.Json (>= 13.0.1)
- System.Net.Http (>= 4.3.4)
-
.NETStandard 2.0
- DgcReader (>= 1.3.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
- Newtonsoft.Json (>= 13.0.1)
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 | 281 | 4/3/2023 |
2.6.0 | 229 | 4/2/2023 |
2.6.0-CI-20230402-140522 | 123 | 4/2/2023 |
2.5.5 | 452 | 6/14/2022 |
2.5.5-rc1 | 177 | 6/14/2022 |
2.5.5-CI-20230402-112357 | 136 | 4/2/2023 |
2.5.5-CI-20230402-101020 | 151 | 4/2/2023 |
2.5.4 | 423 | 5/4/2022 |
2.5.4-rc2 | 180 | 5/4/2022 |
2.5.4-rc1 | 196 | 5/4/2022 |
2.5.3 | 620 | 3/5/2022 |
2.5.3-rc1 | 192 | 3/5/2022 |
2.5.1 | 499 | 2/16/2022 |
2.5.1-rc1 | 168 | 2/15/2022 |
2.5.0 | 468 | 2/14/2022 |
2.5.0-rc3 | 181 | 2/14/2022 |
2.5.0-rc2 | 183 | 2/11/2022 |
2.5.0-rc1 | 169 | 2/11/2022 |
2.4.0 | 496 | 2/6/2022 |
2.3.0 | 501 | 1/28/2022 |
2.2.1 | 471 | 1/21/2022 |
2.2.0 | 475 | 1/16/2022 |
2.1.1 | 457 | 1/11/2022 |
2.1.0 | 298 | 1/6/2022 |
2.0.0 | 307 | 12/27/2021 |
1.3.2 | 354 | 12/13/2021 |
1.3.1 | 307 | 12/11/2021 |
1.3.0 | 259 | 12/6/2021 |
1.2.1 | 398 | 11/5/2021 |
1.2.0 | 317 | 11/4/2021 |
1.1.2 | 340 | 11/2/2021 |
1.0.0-CI-20211102-130745 | 206 | 11/2/2021 |
1.0.0-CI-20211102-124304 | 205 | 11/2/2021 |
1.0.0-CI-20211102-120059 | 240 | 11/2/2021 |
Implemented the italian "Super Greenpass" rules