Package com.digicert.validation
Class DcvContext
java.lang.Object
com.digicert.validation.DcvContext
The DcvContext provides dependency injection, allowing for easier testing of the various pieces
of the library. It initializes and holds references to various classes used throughout the application.
It is possible to have multiple contexts side by side with different configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DcvConfiguration
The DCV Configuration used by the context.A map of instances that have been created by the context.This map is used for basic implementations of interfaces to only load if no custom implementation is provided. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor that initializes the context with a default DCV Configuration.DcvContext
(DcvConfiguration dcvConfiguration) Constructor that initializes the context with the provided DCV Configuration. -
Method Summary
-
Field Details
-
dcvConfiguration
The DCV Configuration used by the context. -
instances
A map of instances that have been created by the context. -
lazyLoadImplementations
This map is used for basic implementations of interfaces to only load if no custom implementation is provided.When the BasicRequestTokenValidator class is instantiated, it also instantiates a BasicRequestTokenUtils instance. That utils class requires a BouncyCastleProvider to be added as a security provider. By lazily loading the validator, users of this library can avoid adding the BouncyCastleProvider as a security provider if they provide their own implementation of the RequestTokenValidator interface.
-
-
Constructor Details
-
DcvContext
public DcvContext()Default constructor that initializes the context with a default DCV Configuration. -
DcvContext
Constructor that initializes the context with the provided DCV Configuration.- Parameters:
dcvConfiguration
- the DCV Configuration to use
-
-
Method Details
-
get
Retrieves an instance of the specified class. If an instance already exists, it returns the cached instance. If the class is found in the DCV Configuration, it caches and returns it. Otherwise, it instantiates the class, caches it, and returns it.- Type Parameters:
T
- the type of the class- Parameters:
classType
- the class to retrieve or instantiate- Returns:
- an instance of the specified class
- Throws:
RuntimeException
- if the class cannot be instantiated
-