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 java.lang.Object implements NamespacesStore
Policy store common code.This class it thread safe.
- Author:
- K. Benedyczak
-
-
Field Summary
Fields Modifier and Type Field Description protected ObserversHandler
observers
protected boolean
openssl1Mode
-
Constructor Summary
Constructors Constructor Description AbstractNamespacesStore(ObserversHandler observers, boolean openssl1Mode)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addPolicy(NamespacePolicy policy, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<NamespacePolicy>>> policies)
Adds a given policy to a given map.protected void
addPolicyToMap(NamespacePolicy policy, java.util.Map<java.lang.String,java.util.List<NamespacePolicy>> map)
Adds policy to a map indexed by a policy issuer.protected java.util.List<NamespacePolicy>
getCachedPolicies(java.util.Map<java.lang.String,CachedElement<java.util.Map<java.lang.String,java.util.List<NamespacePolicy>>>> policies, java.lang.String definedForHash, java.lang.String issuer, java.lang.String path, long maxTTL)
Utility method useful for lazy stores.protected abstract java.lang.String
getFileSuffix()
protected abstract java.lang.String
getNotificationType()
protected abstract NamespacesParser
getParser(java.lang.String path)
java.util.List<NamespacePolicy>
getPolicies(java.security.cert.X509Certificate[] chain, int position)
Gets namespace policies applicable for the CA.protected void
tryLoadNsLocation(java.lang.String location, java.util.List<NamespacePolicy> policies)
protected java.util.List<NamespacePolicy>
tryLoadNsPath(java.lang.String path)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface eu.emi.security.authn.x509.helpers.ns.NamespacesStore
getPolicies, setPolicies
-
-
-
-
Field Detail
-
observers
protected final ObserversHandler observers
-
openssl1Mode
protected boolean openssl1Mode
-
-
Constructor Detail
-
AbstractNamespacesStore
public AbstractNamespacesStore(ObserversHandler observers, boolean openssl1Mode)
-
-
Method Detail
-
getNotificationType
protected abstract java.lang.String getNotificationType()
-
getParser
protected abstract NamespacesParser getParser(java.lang.String path)
-
getFileSuffix
protected abstract java.lang.String getFileSuffix()
-
tryLoadNsPath
protected java.util.List<NamespacePolicy> tryLoadNsPath(java.lang.String path)
-
tryLoadNsLocation
protected void tryLoadNsLocation(java.lang.String location, java.util.List<NamespacePolicy> policies)
-
addPolicy
protected void addPolicy(NamespacePolicy policy, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.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 addpolicies
- policy map to add to
-
addPolicyToMap
protected void addPolicyToMap(NamespacePolicy policy, java.util.Map<java.lang.String,java.util.List<NamespacePolicy>> map)
Adds policy to a map indexed by a policy issuer.- Parameters:
policy
- policy to addmap
- policy map to add to
-
getPolicies
public java.util.List<NamespacePolicy> getPolicies(java.security.cert.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 interfaceNamespacesStore
- Parameters:
chain
- chainposition
- position- Returns:
- policies
-
getCachedPolicies
protected java.util.List<NamespacePolicy> getCachedPolicies(java.util.Map<java.lang.String,CachedElement<java.util.Map<java.lang.String,java.util.List<NamespacePolicy>>>> policies, java.lang.String definedForHash, java.lang.String issuer, java.lang.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
- policiesdefinedForHash
- defined for hashissuer
- issuerpath
- pathmaxTTL
- max TTL- Returns:
- cached policies
-
-