Package org.italiangrid.voms.util
Class CertificateValidatorBuilder
- java.lang.Object
-
- org.italiangrid.voms.util.CertificateValidatorBuilder
-
public class CertificateValidatorBuilder extends java.lang.Object
A utility class which provides convenient methods to build a certificate validator with defaults that are meaningful for VOMS usage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CertificateValidatorBuilder.OpensslHashFunction
This enum determine which hash function is configured for the canlOpensslCertChainValidator
to resolve CRLs and other trust anchors files.
-
Field Summary
Fields Modifier and Type Field Description private eu.emi.security.authn.x509.CrlCheckingMode
crlChecks
static eu.emi.security.authn.x509.CrlCheckingMode
DEFAULT_CRL_CHECKS
The default CRL checking policy.static eu.emi.security.authn.x509.NamespaceCheckingMode
DEFAULT_NS_CHECKS
The default namespace checking policy.static eu.emi.security.authn.x509.OCSPCheckingMode
DEFAULT_OCSP_CHECKS
The default OCSP checking policy.static CertificateValidatorBuilder.OpensslHashFunction
DEFAULT_OPENSSL_HASH_FUNCTION
The default Openssl hash function value.static java.lang.String
DEFAULT_TRUST_ANCHORS_DIR
The default trust anchors directory.static long
DEFAULT_TRUST_ANCHORS_UPDATE_INTERVAL
Default validator trust anchor update interval.static java.lang.Boolean
DEFAULT_VALIDATOR_IS_LAZY
By default this builder builds non-lazy validatorsprivate boolean
lazyAnchorsLoading
private eu.emi.security.authn.x509.NamespaceCheckingMode
namespaceChecks
private eu.emi.security.authn.x509.OCSPCheckingMode
ocspChecks
private CertificateValidatorBuilder.OpensslHashFunction
opensslHashFunction
private eu.emi.security.authn.x509.StoreUpdateListener
storeUpdateListener
private java.lang.String
trustAnchorsDir
private long
trustAnchorsUpdateInterval
private eu.emi.security.authn.x509.ValidationErrorListener
validationErrorListener
-
Constructor Summary
Constructors Constructor Description CertificateValidatorBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description eu.emi.security.authn.x509.X509CertChainValidatorExt
build()
Builds anOpensslCertChainValidator
according to the parameters set for this builderstatic eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator()
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir)
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener)
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval)
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval, boolean lazy)
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener)
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval)
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval, boolean lazy)
Deprecated.Create aCertificateValidatorBuilder
object instead.static eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks)
Builds an Openssl-style certificate validator configured as specified in the parametersstatic eu.emi.security.authn.x509.X509CertChainValidatorExt
buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks, boolean lazy)
Deprecated.Create aCertificateValidatorBuilder
object instead.CertificateValidatorBuilder
crlChecks(eu.emi.security.authn.x509.CrlCheckingMode crl)
Sets the crl checking mode for this builderCertificateValidatorBuilder
lazyAnchorsLoading(boolean lazyness)
Sets whether the created validator will be lazy in loading anchorsCertificateValidatorBuilder
namespaceChecks(eu.emi.security.authn.x509.NamespaceCheckingMode nsChecks)
Sets the namespace checking mode for this builderCertificateValidatorBuilder
ocspChecks(eu.emi.security.authn.x509.OCSPCheckingMode ocsp)
Sets the ocsp checking mode for this builderCertificateValidatorBuilder
opensslHashFunction(CertificateValidatorBuilder.OpensslHashFunction f)
Sets the openssl hash function for this builderCertificateValidatorBuilder
storeUpdateListener(eu.emi.security.authn.x509.StoreUpdateListener l)
Sets the store update listener for this builderCertificateValidatorBuilder
trustAnchorsDir(java.lang.String dir)
Sets the trust anchors dir for this builderCertificateValidatorBuilder
trustAnchorsUpdateInterval(long interval)
Sets the trust anchors update interval for this builderCertificateValidatorBuilder
validationErrorListener(eu.emi.security.authn.x509.ValidationErrorListener l)
Sets the validation error listener for this builder
-
-
-
Field Detail
-
DEFAULT_OPENSSL_HASH_FUNCTION
public static final CertificateValidatorBuilder.OpensslHashFunction DEFAULT_OPENSSL_HASH_FUNCTION
The default Openssl hash function value. MD5 is chosen to ensure compatibility with Openssl pre 1.0 deployments.
-
DEFAULT_CRL_CHECKS
public static final eu.emi.security.authn.x509.CrlCheckingMode DEFAULT_CRL_CHECKS
The default CRL checking policy.
-
DEFAULT_OCSP_CHECKS
public static final eu.emi.security.authn.x509.OCSPCheckingMode DEFAULT_OCSP_CHECKS
The default OCSP checking policy.
-
DEFAULT_NS_CHECKS
public static final eu.emi.security.authn.x509.NamespaceCheckingMode DEFAULT_NS_CHECKS
The default namespace checking policy.
-
DEFAULT_TRUST_ANCHORS_DIR
public static final java.lang.String DEFAULT_TRUST_ANCHORS_DIR
The default trust anchors directory.- See Also:
- Constant Field Values
-
DEFAULT_VALIDATOR_IS_LAZY
public static final java.lang.Boolean DEFAULT_VALIDATOR_IS_LAZY
By default this builder builds non-lazy validators
-
DEFAULT_TRUST_ANCHORS_UPDATE_INTERVAL
public static final long DEFAULT_TRUST_ANCHORS_UPDATE_INTERVAL
Default validator trust anchor update interval.- See Also:
- Constant Field Values
-
trustAnchorsDir
private java.lang.String trustAnchorsDir
-
validationErrorListener
private eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener
-
storeUpdateListener
private eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener
-
trustAnchorsUpdateInterval
private long trustAnchorsUpdateInterval
-
lazyAnchorsLoading
private boolean lazyAnchorsLoading
-
namespaceChecks
private eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks
-
crlChecks
private eu.emi.security.authn.x509.CrlCheckingMode crlChecks
-
ocspChecks
private eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks
-
opensslHashFunction
private CertificateValidatorBuilder.OpensslHashFunction opensslHashFunction
-
-
Method Detail
-
opensslHashFunction
public CertificateValidatorBuilder opensslHashFunction(CertificateValidatorBuilder.OpensslHashFunction f)
Sets the openssl hash function for this builder- Parameters:
f
- theCertificateValidatorBuilder.OpensslHashFunction
- Returns:
- the builder object
-
storeUpdateListener
public CertificateValidatorBuilder storeUpdateListener(eu.emi.security.authn.x509.StoreUpdateListener l)
Sets the store update listener for this builder- Parameters:
l
- theStoreUpdateListener
- Returns:
- the builder object
-
trustAnchorsDir
public CertificateValidatorBuilder trustAnchorsDir(java.lang.String dir)
Sets the trust anchors dir for this builder- Parameters:
dir
- the trust anchors directory- Returns:
- the builder object
-
validationErrorListener
public CertificateValidatorBuilder validationErrorListener(eu.emi.security.authn.x509.ValidationErrorListener l)
Sets the validation error listener for this builder- Parameters:
l
- theValidationErrorListener
- Returns:
- the builder object
-
trustAnchorsUpdateInterval
public CertificateValidatorBuilder trustAnchorsUpdateInterval(long interval)
Sets the trust anchors update interval for this builder- Parameters:
interval
- the update interval- Returns:
- the builder object
-
lazyAnchorsLoading
public CertificateValidatorBuilder lazyAnchorsLoading(boolean lazyness)
Sets whether the created validator will be lazy in loading anchors- Parameters:
lazyness
- the boolean flag that determines if the validator will be lazy in loading trust anchors- Returns:
- the builder object
-
namespaceChecks
public CertificateValidatorBuilder namespaceChecks(eu.emi.security.authn.x509.NamespaceCheckingMode nsChecks)
Sets the namespace checking mode for this builder- Parameters:
nsChecks
- theNamespaceCheckingMode
- Returns:
- the builder object
-
crlChecks
public CertificateValidatorBuilder crlChecks(eu.emi.security.authn.x509.CrlCheckingMode crl)
Sets the crl checking mode for this builder- Parameters:
crl
- theCrlCheckingMode
- Returns:
- the builder object
-
ocspChecks
public CertificateValidatorBuilder ocspChecks(eu.emi.security.authn.x509.OCSPCheckingMode ocsp)
Sets the ocsp checking mode for this builder- Parameters:
ocsp
- theOCSPCheckingMode
- Returns:
- the builder object
-
build
public eu.emi.security.authn.x509.X509CertChainValidatorExt build()
Builds anOpensslCertChainValidator
according to the parameters set for this builder- Returns:
- the
X509CertChainValidatorExt
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks)
Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreUpdateListener
- the listener that will receive notifications about trust store update eventsupdateInterval
- the trust anchor store update intervalnamespaceChecks
- the namespace checking policycrlChecks
- the crl checking policyocspChecks
- the ocsp checking policy- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeUpdateListener, long updateInterval, eu.emi.security.authn.x509.NamespaceCheckingMode namespaceChecks, eu.emi.security.authn.x509.CrlCheckingMode crlChecks, eu.emi.security.authn.x509.OCSPCheckingMode ocspChecks, boolean lazy)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreUpdateListener
- the listener that will receive notifications about trust store update eventsupdateInterval
- the trust anchor store update intervalnamespaceChecks
- the namespace checking policycrlChecks
- the crl checking policyocspChecks
- the ocsp checking policylazy
- whether the validator should be lazy in loading crls and certificates- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errors- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreListener
- the listener that will be informed of trust store load errors- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval, boolean lazy)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreListener
- the listener that will be informed of trust store load errorsupdateInterval
- the trust anchor store update intervallazy
- whether the certificate validator should be lazy in loading crls and CAs- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, eu.emi.security.authn.x509.StoreUpdateListener storeListener, long updateInterval)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsstoreListener
- the listener that will be informed of trust store load errorsupdateInterval
- the trust anchor store update interval- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval, boolean lazy)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsupdateInterval
- the trust anchor store update intervallazy
- whether the certificate validator should be lazy in loading crls and CAs- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir, eu.emi.security.authn.x509.ValidationErrorListener validationErrorListener, long updateInterval)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded fromvalidationErrorListener
- the listener that will receive notification about validation errorsupdateInterval
- the trust anchor store update interval- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator(java.lang.String trustAnchorsDir)
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator configured as specified in the parameters- Parameters:
trustAnchorsDir
- the directory where trust anchors are loaded from- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
buildCertificateValidator
public static eu.emi.security.authn.x509.X509CertChainValidatorExt buildCertificateValidator()
Deprecated.Create aCertificateValidatorBuilder
object instead.Builds an Openssl-style certificate validator.- Returns:
- an Openssl-style certificate validator configured as specified in the parameters
-
-