Class InMemoryCRLCache
java.lang.Object
se.swedenconnect.sigval.cert.validity.crl.impl.InMemoryCRLCache
- All Implemented Interfaces:
CRLCache
CRL cache implementation. Two main functions allows retrieval of a CRL from this cache which adds the CRL to the
cache if not present.
This implementation of CRL cache store all cached data in memory and stores nothing on disk. The cache is destroyed
on application restart.
IMPORTANT NOTE: Do not use this implementation unless this application has the resources to store all CRL data in memory
for all cached CRL:s. If this is not the case, the file backed
CRLCacheImpl
implementation should be used instead.-
Field Summary
Fields inherited from interface se.swedenconnect.sigval.cert.validity.crl.CRLCache
DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT, LDAP_CONNECT_TIMEOUT, LDAP_CONTEXT_FACTORY, LDAP_READ_TIMEOUT
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the in memory CRL cache.InMemoryCRLCache
(long recacheGracePeriod, CRLDataLoader crlDataLoader) Constructor for the CRL cache. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a CRL from the CRL cache.getCRL
(org.bouncycastle.asn1.x509.CRLDistPoint crlDistributionPointExt) This function is a more practical use of the cache rather than asking for a particular cached URL.Returns the current list of cached CRL recordsvoid
recache()
Performs a re-cache of all cached CRL records.
-
Constructor Details
-
InMemoryCRLCache
public InMemoryCRLCache()Constructor for the in memory CRL cache. -
InMemoryCRLCache
Constructor for the CRL cache.- Parameters:
recacheGracePeriod
- time in milliseconds for the time after last cache instance when first re-cache will be attemptedcrlDataLoader
- data loader for downloading CRL data or null to use default CRL data loader
-
-
Method Details
-
getCrlCacheMap
Returns the current list of cached CRL records- Returns:
- list of cached CRLs
-
getCRL
public CRLInfo getCRL(org.bouncycastle.asn1.x509.CRLDistPoint crlDistributionPointExt) throws IOException This function is a more practical use of the cache rather than asking for a particular cached URL. This function is however limited to the following specific usage policy:- Only distribution points with absent reason settings are accepted (Not limited to a subset of reasons)
- Only distribution points with absent crlIssuer are accepted (CRL must be issued by cert issuer)
- Both LDAP(S) and HTTP(S) sources are accepted
- If both LDAP and HTTP sources are present, HTTP is attempted first. LDAP will only be attempted if HTTP fails
- If several sources are present, only the first successful source will be cached
- Specified by:
getCRL
in interfaceCRLCache
- Parameters:
crlDistributionPointExt
- CRL distribution point extension- Returns:
- CRL
- Throws:
IOException
- on error to obtain the CRL from this extension
-
getCRL
Retrieves a CRL from the CRL cache. If the CRL is not in the cache or if the cached CRL is expired, then an attempt to download and cache the CRL is made.- Specified by:
getCRL
in interfaceCRLCache
- Parameters:
url
- the location of the CRL- Returns:
- cached or downloaded CRL
- Throws:
IOException
- if it is not possible to obtain a CRL from this location
-
recache
public void recache()Performs a re-cache of all cached CRL records. This method should be called by a daemon process periodically -
getCrlCacheRecords
- Specified by:
getCrlCacheRecords
in interfaceCRLCache
-