Class LotlFetchingProperties
-
Constructor Summary
ConstructorsConstructorDescriptionLotlFetchingProperties
(IOnFailingCountryLotlData countryFetchFailureStrategy) Creates an instance ofLotlFetchingProperties
. -
Method Summary
Modifier and TypeMethodDescriptionlong
Get the cache staleness threshold value in milliseconds.Gets the strategy to be used when fetching a country specific LOTL fails.Gets the calculation function for the cache refresh interval.setCacheStalenessInMilliseconds
(long stalenessInMillis) Sets the allowed staleness of cached EU trusted list entries in milliseconds.setCountryNames
(String... countryNames) Adds schema name (usually two letters) of a country which shall be used during LOTL fetching.setCountryNamesToIgnore
(String... countryNamesToIgnore) Adds schema name (usually two letters) of a country which shall be ignored during LOTL fetching.setRefreshIntervalCalculator
(LongUnaryOperator refreshIntervalCalculator) Sets a custom cache refresh timer function.setServiceTypes
(String... serviceType) Adds service type identifier which shall be used during country specific LOTL fetching.
-
Constructor Details
-
LotlFetchingProperties
Creates an instance ofLotlFetchingProperties
. SeeIOnFailingCountryLotlData
for more details.- Parameters:
-
countryFetchFailureStrategy
- strategy to be used when fetching of a country specific LOTL fails
-
-
Method Details
-
setCountryNames
Adds schema name (usually two letters) of a country which shall be used during LOTL fetching.This method cannot be used together with
setCountryNamesToIgnore(String...)
.If no schema names are added or ignored, all country specific LOTL files will be used.
Most of the country names are present in
LotlCountryCodeConstants
class.- Parameters:
-
countryNames
- schema names of countries to use - Returns:
-
this same
LotlFetchingProperties
instance
-
setCountryNamesToIgnore
Adds schema name (usually two letters) of a country which shall be ignored during LOTL fetching.This method cannot be used together with
setCountryNames(String...)
.If no schema names are added or ignored, all country specific LOTL files will be used.
Most of the country names are present in
LotlCountryCodeConstants
class.- Parameters:
-
countryNamesToIgnore
- countries to ignore - Returns:
-
this same
LotlFetchingProperties
instance
-
getCacheStalenessInMilliseconds
public long getCacheStalenessInMilliseconds()Get the cache staleness threshold value in milliseconds.- Returns:
- a set cache staleness in milliseconds.
-
setCacheStalenessInMilliseconds
Sets the allowed staleness of cached EU trusted list entries in milliseconds.This value determines how long the cached EU trusted lists certificates will be considered valid to be used in the signatures validation if they are not updated. The cached entries are attempted to be updated regularly according to
setRefreshIntervalCalculator(LongUnaryOperator)
configuration. If the update fails for some reason and the configured staleness threshold for the cached entry is eventually reached then theIOnFailingCountryLotlData
strategy instance provided in theLotlFetchingProperties(IOnFailingCountryLotlData)
will be invoked.The default value is 24 hours (24 * 60 * 60 * 1000 milliseconds).
You can set this property to positive infinity in order to never consider the certificates stale and to keep using them in validation even if they are not updated. Consider updating the
setRefreshIntervalCalculator(LongUnaryOperator)
to return static value in this case though.See
IOnFailingCountryLotlData
for more details.- Parameters:
-
stalenessInMillis
- the staleness time in milliseconds - Returns:
-
this same
LotlFetchingProperties
instance
-
getRefreshIntervalCalculator
Gets the calculation function for the cache refresh interval.This function will be used to determine the refresh interval based on the staleness time. By default, it takes 70% of the staleness time as the refresh interval.
- Returns:
- a function that takes the staleness time in milliseconds and returns the refresh interval in milliseconds.
-
setRefreshIntervalCalculator
public LotlFetchingProperties setRefreshIntervalCalculator(LongUnaryOperator refreshIntervalCalculator) Sets a custom cache refresh timer function. This function will be used to determine the refresh interval based on the staleness time.By default, it takes 23% of the staleness time as the refresh interval. So if the staleness time is 24 hours, the refresh interval will be set to 5.52 hours.
- Parameters:
-
refreshIntervalCalculator
- a function that takes the staleness time in milliseconds and returns the refresh interval in milliseconds. - Returns:
-
this same
LotlFetchingProperties
instance
-
getOnCountryFetchFailureStrategy
Gets the strategy to be used when fetching a country specific LOTL fails.- Returns:
- the strategy to be used when fetching a country specific LOTL fails
-
setServiceTypes
Adds service type identifier which shall be used during country specific LOTL fetching.If no service type identifiers are added, all service types from
ServiceTypeIdentifiersConstants
will be used.Only values supported by this logic are predefined in
ServiceTypeIdentifiersConstants
.- Parameters:
-
serviceType
- service type identifier as aString
- Returns:
-
this same
LotlFetchingProperties
instance
-