Class DefaultVOMSTrustStore

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CERTIFICATE_FILENAME_SUFFIX
      The filename suffix used to match certificates in the VOMS local trust directories
      static java.lang.String DEFAULT_VOMS_DIR
      The default directory where local VOMS trust information is rooted: "/etc/grid-security/vomsdir"
      private VOMSTrustStoreStatusListener listener
      The trust store status listener that will be notified of changes in this trust store
      protected java.lang.Object listenerLock
      A lock to guard the setting of the status listener
      private java.util.Map<java.lang.String,​java.security.cert.X509Certificate> localAACertificatesByHash
      Map of local parsed AA certificates keyed by certificate subject hash
      private java.util.Map<java.lang.String,​java.util.Set<LSCInfo>> localLSCInfo
      The set of local parsed LSC information keyed by VO
      private java.util.List<java.lang.String> localTrustedDirs
      The list of local trusted directories that is searched for trust information (certs or LSC files)
      static java.lang.String LSC_FILENAME_SUFFIX
      The filename suffix used to match LSC files in the VOMS local trust directories
      protected java.util.concurrent.locks.Lock read
      A reference to the read lock
      protected java.util.concurrent.locks.ReadWriteLock rwLock
      The read/write lock that implements thread safety for this store
      protected java.util.concurrent.locks.Lock write
      A reference to the write lock
    • Field Detail

      • DEFAULT_VOMS_DIR

        public static final java.lang.String DEFAULT_VOMS_DIR
        The default directory where local VOMS trust information is rooted: "/etc/grid-security/vomsdir"
        See Also:
        Constant Field Values
      • CERTIFICATE_FILENAME_SUFFIX

        public static final java.lang.String CERTIFICATE_FILENAME_SUFFIX
        The filename suffix used to match certificates in the VOMS local trust directories
        See Also:
        Constant Field Values
      • LSC_FILENAME_SUFFIX

        public static final java.lang.String LSC_FILENAME_SUFFIX
        The filename suffix used to match LSC files in the VOMS local trust directories
        See Also:
        Constant Field Values
      • localTrustedDirs

        private final java.util.List<java.lang.String> localTrustedDirs
        The list of local trusted directories that is searched for trust information (certs or LSC files)
      • localAACertificatesByHash

        private java.util.Map<java.lang.String,​java.security.cert.X509Certificate> localAACertificatesByHash
        Map of local parsed AA certificates keyed by certificate subject hash
      • localLSCInfo

        private java.util.Map<java.lang.String,​java.util.Set<LSCInfo>> localLSCInfo
        The set of local parsed LSC information keyed by VO
      • listener

        private VOMSTrustStoreStatusListener listener
        The trust store status listener that will be notified of changes in this trust store
      • rwLock

        protected final java.util.concurrent.locks.ReadWriteLock rwLock
        The read/write lock that implements thread safety for this store
      • read

        protected final java.util.concurrent.locks.Lock read
        A reference to the read lock
      • write

        protected final java.util.concurrent.locks.Lock write
        A reference to the write lock
      • listenerLock

        protected final java.lang.Object listenerLock
        A lock to guard the setting of the status listener
    • Constructor Detail

      • DefaultVOMSTrustStore

        public DefaultVOMSTrustStore​(java.util.List<java.lang.String> localTrustDirs,
                                     VOMSTrustStoreStatusListener listener)
        Parameters:
        localTrustDirs - a non-null list of local trust directories
        listener - the VOMSTrustStoreStatusListener to use for this trust store
        Throws:
        java.lang.IllegalArgumentException - when the list passed as argument is null
      • DefaultVOMSTrustStore

        public DefaultVOMSTrustStore​(java.util.List<java.lang.String> localTrustDirs)
      • DefaultVOMSTrustStore

        public DefaultVOMSTrustStore()
        Default constructor. Sets the local trusted directories to the default of "/etc/grid-security/vomsdir".
    • Method Detail

      • buildDefaultTrustedDirs

        protected static java.util.List<java.lang.String> buildDefaultTrustedDirs()
        Builds a list of trusted directories containing only DEFAULT_VOMS_DIR.
        Returns:
        a list of default trusted directory containing the DEFAULT_VOMS_DIR
      • getLocalTrustedDirectories

        public java.util.List<java.lang.String> getLocalTrustedDirectories()
        Description copied from interface: VOMSTrustStore
        Returns the locally trusted directories where VOMS trust information (being VOMS server certificates or LSC files) are searched for.
        Specified by:
        getLocalTrustedDirectories in interface VOMSTrustStore
        Returns:
        a List of local paths
      • getLocalAACertificates

        public java.util.List<java.security.cert.X509Certificate> getLocalAACertificates()
        Description copied from interface: VOMSTrustStore
        Returns the list of VOMS Attribute Authority certificates held in this VOMSTrustStore.
        Specified by:
        getLocalAACertificates in interface VOMSTrustStore
        Returns:
        the collection of VOMS Attribute Authority certificates held in this VOMSTrustStore, an empty list if no certificate was found.
      • getLSC

        public LSCInfo getLSC​(java.lang.String voName,
                              java.lang.String hostname)
        Description copied from interface: VOMSTrustStore
        Returns the LSC information held in this VOMSTrustStore for the vo and hostname passed as arguments.
        Specified by:
        getLSC in interface VOMSTrustStore
        Parameters:
        voName - the name of the VO for which the LSC applies
        hostname - the name of the host for which the LSC applies
        Returns:
        a LSCInfo object, or null if no LSC matching the arguments was found
      • loadCertificatesFromDirectory

        private void loadCertificatesFromDirectory​(java.io.File directory)
        Loads all the certificates in the local directory. Only files with the extension matching the #CERTIFICATE_FILENAME_PATTERN are considered.
        Parameters:
        directory -
      • loadCertificateFromFile

        private void loadCertificateFromFile​(java.io.File file)
        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

        private void loadLSCFromDirectory​(java.io.File directory)
        Parameters:
        directory -
      • certificateFileSanityChecks

        private void certificateFileSanityChecks​(java.io.File certFile)
        Performs basic sanity checks performed on a file supposed to hold a VOMS AA certificate.
        Parameters:
        certFile -
      • directorySanityChecks

        private void directorySanityChecks​(java.io.File directory)
        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: VOMSTrustStore
        Loads trust information from the sources configured for this trust store.
        Specified by:
        loadTrustInformation in interface VOMSTrustStore
      • getOpensslCAHash

        private java.lang.String getOpensslCAHash​(javax.security.auth.x500.X500Principal principal)
      • getAACertificateBySubject

        public java.security.cert.X509Certificate getAACertificateBySubject​(javax.security.auth.x500.X500Principal aaCertSubject)
        Description copied from interface: VOMSTrustStore
        Returns the VOMS Attribute Authority certificate held in this VOMSTrustStore whose subject matches the subject passed as argument.
        Specified by:
        getAACertificateBySubject in interface VOMSTrustStore
        Parameters:
        aaCertSubject - a certificate subject
        Returns:
        the VOMS AA X509Certificate that matches the subject passed as argument or null if no matching certificate is found in this store
      • getAllLSCInfo

        public java.util.Map<java.lang.String,​java.util.Set<LSCInfo>> getAllLSCInfo()
        Description copied from interface: VOMSTrustStore
        Returns all the LSC information held in this VOMSTrustStore. The returned Map is keyed by VO name.
        Specified by:
        getAllLSCInfo in interface VOMSTrustStore
        Returns:
        a possibly empty map LSCInfo objects