Package org.italiangrid.voms.store.impl
Class DefaultVOMSTrustStore
java.lang.Object
org.italiangrid.voms.store.impl.DefaultVOMSTrustStore
- All Implemented Interfaces:
VOMSTrustStore
- Direct Known Subclasses:
DefaultUpdatingVOMSTrustStore
The default implementation for the VOMS trust store. This implementation
does not refresh the trust information on a periodic basis. For an
updating trust store see
DefaultUpdatingVOMSTrustStore.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe filename suffix used to match certificates in the VOMS local trust directoriesstatic final StringThe default directory where local VOMS trust information is rooted: "/etc/grid-security/vomsdir"private VOMSTrustStoreStatusListenerThe trust store status listener that will be notified of changes in this trust storeprotected final ObjectA lock to guard the setting of the status listenerprivate Map<String, X509Certificate> Map of local parsed AA certificates keyed by certificate subject hashThe set of local parsed LSC information keyed by VOThe list of local trusted directories that is searched for trust information (certs or LSC files)static final StringThe filename suffix used to match LSC files in the VOMS local trust directoriesprotected final LockA reference to the read lockprotected final ReadWriteLockThe read/write lock that implements thread safety for this storeprotected final LockA reference to the write lock -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DefaultVOMSTrustStore(List<String> localTrustDirs) DefaultVOMSTrustStore(List<String> localTrustDirs, VOMSTrustStoreStatusListener listener) -
Method Summary
Modifier and TypeMethodDescriptionBuilds a list of trusted directories containing onlyDEFAULT_VOMS_DIR.private voidcertificateFileSanityChecks(File certFile) Performs basic sanity checks performed on a file supposed to hold a VOMS AA certificate.private voidprivate voiddirectorySanityChecks(File directory) Performs basic sanity checks on a directory that is supposed to contain VOMS AA certificates and LSC files.getAACertificateBySubject(X500Principal aaCertSubject) Returns the VOMS Attribute Authority certificate held in thisVOMSTrustStorewhose subject matches the subject passed as argument.Returns all the LSC information held in thisVOMSTrustStore.Returns the list of VOMS Attribute Authority certificates held in thisVOMSTrustStore.Returns the locally trusted directories where VOMS trust information (being VOMS server certificates or LSC files) are searched for.Returns the LSC information held in thisVOMSTrustStorefor the vo and hostname passed as arguments.private StringgetOpensslCAHash(X500Principal principal) private voidloadCertificateFromFile(File file) Loads a VOMS AA certificate from a given file and stores this certificate in the local map of trusted VOMS AA certificate.private voidloadCertificatesFromDirectory(File directory) Loads all the certificates in the local directory.private voidloadLSCFromDirectory(File directory) voidLoads trust information from the sources configured for this trust store.voidsetStatusListener(VOMSTrustStoreStatusListener statusListener) Sets aVOMSTrustStoreStatusListenerthat is notified of events related to this VOMS trust store
-
Field Details
-
DEFAULT_VOMS_DIR
The default directory where local VOMS trust information is rooted: "/etc/grid-security/vomsdir"- See Also:
-
CERTIFICATE_FILENAME_SUFFIX
The filename suffix used to match certificates in the VOMS local trust directories- See Also:
-
LSC_FILENAME_SUFFIX
The filename suffix used to match LSC files in the VOMS local trust directories- See Also:
-
localTrustedDirs
The list of local trusted directories that is searched for trust information (certs or LSC files) -
localAACertificatesByHash
Map of local parsed AA certificates keyed by certificate subject hash -
localLSCInfo
The set of local parsed LSC information keyed by VO -
listener
The trust store status listener that will be notified of changes in this trust store -
rwLock
The read/write lock that implements thread safety for this store -
read
A reference to the read lock -
write
A reference to the write lock -
listenerLock
A lock to guard the setting of the status listener
-
-
Constructor Details
-
DefaultVOMSTrustStore
- Parameters:
localTrustDirs- a non-null list of local trust directorieslistener- theVOMSTrustStoreStatusListenerto use for this trust store- Throws:
IllegalArgumentException- when the list passed as argument is null
-
DefaultVOMSTrustStore
-
DefaultVOMSTrustStore
-
DefaultVOMSTrustStore
public DefaultVOMSTrustStore()Default constructor. Sets the local trusted directories to the default of "/etc/grid-security/vomsdir".
-
-
Method Details
-
buildDefaultTrustedDirs
Builds a list of trusted directories containing onlyDEFAULT_VOMS_DIR.- Returns:
- a list of default trusted directory containing the
DEFAULT_VOMS_DIR
-
getLocalTrustedDirectories
Description copied from interface:VOMSTrustStoreReturns the locally trusted directories where VOMS trust information (being VOMS server certificates or LSC files) are searched for.- Specified by:
getLocalTrustedDirectoriesin interfaceVOMSTrustStore- Returns:
- a
Listof local paths
-
getLocalAACertificates
Description copied from interface:VOMSTrustStoreReturns the list of VOMS Attribute Authority certificates held in thisVOMSTrustStore.- Specified by:
getLocalAACertificatesin interfaceVOMSTrustStore- Returns:
- the collection of VOMS Attribute Authority certificates held in
this
VOMSTrustStore, an empty list if no certificate was found.
-
getLSC
Description copied from interface:VOMSTrustStoreReturns the LSC information held in thisVOMSTrustStorefor the vo and hostname passed as arguments.- Specified by:
getLSCin interfaceVOMSTrustStore- Parameters:
voName- the name of the VO for which the LSC applieshostname- the name of the host for which the LSC applies- Returns:
- a
LSCInfoobject, or null if no LSC matching the arguments was found
-
loadCertificatesFromDirectory
Loads all the certificates in the local directory. Only files with the extension matching theare considered.invalid reference
#CERTIFICATE_FILENAME_PATTERN- Parameters:
directory-
-
loadCertificateFromFile
Loads a VOMS AA certificate from a given file and stores this certificate in the local map of trusted VOMS AA certificate.- Parameters:
file-
-
loadLSCFromDirectory
- Parameters:
directory-
-
certificateFileSanityChecks
Performs basic sanity checks performed on a file supposed to hold a VOMS AA certificate.- Parameters:
certFile-
-
directorySanityChecks
Performs basic sanity checks on a directory that is supposed to contain VOMS AA certificates and LSC files.- Parameters:
directory-
-
cleanupStores
private void cleanupStores() -
loadTrustInformation
public void loadTrustInformation()Description copied from interface:VOMSTrustStoreLoads trust information from the sources configured for this trust store.- Specified by:
loadTrustInformationin interfaceVOMSTrustStore
-
getOpensslCAHash
-
getAACertificateBySubject
Description copied from interface:VOMSTrustStoreReturns the VOMS Attribute Authority certificate held in thisVOMSTrustStorewhose subject matches the subject passed as argument.- Specified by:
getAACertificateBySubjectin interfaceVOMSTrustStore- Parameters:
aaCertSubject- a certificate subject- Returns:
- the VOMS AA
X509Certificatethat matches the subject passed as argument or null if no matching certificate is found in this store
-
getAllLSCInfo
Description copied from interface:VOMSTrustStoreReturns all the LSC information held in thisVOMSTrustStore. The returnedMapis keyed by VO name.- Specified by:
getAllLSCInfoin interfaceVOMSTrustStore- Returns:
- a possibly empty map
LSCInfoobjects
-
setStatusListener
Description copied from interface:VOMSTrustStoreSets aVOMSTrustStoreStatusListenerthat is notified of events related to this VOMS trust store- Specified by:
setStatusListenerin interfaceVOMSTrustStore- Parameters:
statusListener- the status listener that will be notified
-