Class AbstractNamespacesStore

java.lang.Object
eu.emi.security.authn.x509.helpers.ns.AbstractNamespacesStore
All Implemented Interfaces:
NamespacesStore
Direct Known Subclasses:
AbstractEuGridPmaNamespacesStore, AbstractGlobusNamespacesStore

public abstract class AbstractNamespacesStore extends Object implements NamespacesStore
Policy store common code.

This class it thread safe.

Author:
K. Benedyczak
  • Field Details

    • observers

      protected final ObserversHandler observers
    • openssl1Mode

      protected boolean openssl1Mode
  • Constructor Details

    • AbstractNamespacesStore

      public AbstractNamespacesStore(ObserversHandler observers, boolean openssl1Mode)
  • Method Details

    • getNotificationType

      protected abstract String getNotificationType()
    • getParser

      protected abstract NamespacesParser getParser(String path)
    • getFileSuffix

      protected abstract String getFileSuffix()
    • tryLoadNsPath

      protected List<NamespacePolicy> tryLoadNsPath(String path)
    • tryLoadNsLocation

      protected void tryLoadNsLocation(String location, List<NamespacePolicy> policies)
    • addPolicy

      protected void addPolicy(NamespacePolicy policy, Map<String,Map<String,List<NamespacePolicy>>> policies)
      Adds a given policy to a given map. It is assumed that the map is indexed by issuer hash and the value maps are indexed by issuer id. This method is useful only for stores which keep all their namespaces in memory.
      Parameters:
      policy - policy to add
      policies - policy map to add to
    • addPolicyToMap

      protected void addPolicyToMap(NamespacePolicy policy, Map<String,List<NamespacePolicy>> map)
      Adds policy to a map indexed by a policy issuer.
      Parameters:
      policy - policy to add
      map - policy map to add to
    • getPolicies

      public List<NamespacePolicy> getPolicies(X509Certificate[] chain, int position)
      Description copied from interface: NamespacesStore
      Gets namespace policies applicable for the CA. The CA must be present in the cert chain, at the position given. The subsequent chain elements might be used if there is no explicit policy defined for the CA itself: then it is checked if any of the parent CAs defined policy for this CA.
      Specified by:
      getPolicies in interface NamespacesStore
      Parameters:
      chain - chain
      position - position
      Returns:
      policies
    • getCachedPolicies

      protected List<NamespacePolicy> getCachedPolicies(Map<String,CachedElement<Map<String,List<NamespacePolicy>>>> policies, String definedForHash, String issuer, String path, long maxTTL)
      Utility method useful for lazy stores. Retrieves a cached policies for the given ca hash and issuer. If there is no policy in the cache then it is tried to load one from disk. The loaded policy is cached before being returned.
      Parameters:
      policies - policies
      definedForHash - defined for hash
      issuer - issuer
      path - path
      maxTTL - max TTL
      Returns:
      cached policies