Class FileValidator
This class implements Validation for DcvMethod.BR_3_2_2_4_18
method. It is responsible for handling the preparation and validation
processes required for file-based domain control validation (DCV).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
Default filename for the file validationprivate final DomainNameUtils
Utility class for domain name operationsprivate static final String
File location based on the BR specificationsprivate final FileValidationHandler
Handler for File Validationprivate final RandomValueGenerator
Utility class for generating random valuesprivate final RandomValueVerifier
Utility class for random value verification -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) DomainValidationEvidence
createDomainValidationEvidence
(FileValidationRequest request, FileValidationResponse response) Create the Domain Validation Evidence from the File Validation Response(package private) String
getFileUrl
(String domainName, String fileName) Generate a URL for the where file will be placed on the serverprepare
(FilePreparationRequest preparationRequest) Prepare for file validation.validate
(FileValidationRequest validationRequest) Perform File Validationprivate void
verifyFilePreparation
(FilePreparationRequest filePreparationRequest) Verify the File Preparation Request(package private) void
verifyFileValidationRequest
(FileValidationRequest fileValidationRequest) Performs validation on the values inFileValidationRequest
.
-
Field Details
-
randomValueGenerator
Utility class for generating random valuesThis utility class is used to generate random values that are required during the file-based domain validation process.
-
randomValueVerifier
Utility class for random value verificationThis utility class is responsible for verifying the random values generated during the preparation phase. It ensures that the random values meet the required entropy levels and have not expired.
-
domainNameUtils
Utility class for domain name operationsThis utility class provides various operations related to domain names, such as validation and manipulation.
-
fileValidationHandler
Handler for File ValidationThis handler is responsible for executing the file-based domain validation process.
-
FILE_LOCATION
File location based on the BR specificationsThis string is combined with the submitted domain name and file location to create the URL where the file will be placed.
- See Also:
-
defaultFilename
Default filename for the file validationIf no filename is specified in the request, the default filename specified in the dcvConfiguration will be used.
-
-
Constructor Details
-
FileValidator
Constructor for FileValidatorInitializes the FileValidator with the necessary dependencies and configurations provided by the
DcvContext
.- Parameters:
dcvContext
- context where we can find the needed dependencies / configuration
-
-
Method Details
-
prepare
public FilePreparationResponse prepare(FilePreparationRequest preparationRequest) throws DcvException Prepare for file validation.This method prepares for file domain validation by generating a random value if the challenge type is
ChallengeType.RANDOM_VALUE
. It verifies the preparation request and constructs a response containing the necessary information for the validation process.- Parameters:
preparationRequest
-FilePreparationRequest
object containing the domain and challenge type- Returns:
FilePreparationResponse
object containing the random value and domain- Throws:
DcvException
- if the request is invalid.InputException
when missing required fields.
-
validate
public DomainValidationEvidence validate(FileValidationRequest validationRequest) throws DcvException Perform File ValidationThis method performs the file-based domain validation by verifying the provided validation request. It checks the validity of the domain, challenge type, random value or request token data, and validation state. If the validation is successful, it returns a
DomainValidationEvidence
object containing the validation evidence. If the validation fails, it throws aValidationException
with the encountered errors.- Parameters:
validationRequest
-FileValidationRequest
object containing the domain, challenge type, random value or request token data, and validation state- Returns:
DomainValidationEvidence
object containing the domain validation evidence- Throws:
ValidationException
- if the File Validation fails.InputException
- if the input parameters are invalid. SeeverifyFileValidationRequest(com.digicert.validation.methods.file.validate.FileValidationRequest)
DcvException
-
createDomainValidationEvidence
DomainValidationEvidence createDomainValidationEvidence(FileValidationRequest request, FileValidationResponse response) Create the Domain Validation Evidence from the File Validation ResponseThis method creates a
DomainValidationEvidence
object from the providedFileValidationRequest
andFileValidationResponse
. It extracts the necessary information from the response and constructs the validation evidence, including the domain, DCV method, validation date, file URL, random value, and found token.- Parameters:
request
- The File Validation Requestresponse
- The File Validation Response- Returns:
- The Domain Validation Evidence
-
verifyFileValidationRequest
Performs validation on the values inFileValidationRequest
.This method validates the values in the provided
FileValidationRequest
. It checks the domain, validation state, and challenge type, ensuring that all required fields are present and valid. For random values, it verifies the entropy and expiration. For request tokens, it checks the presence of the request token data.- Parameters:
fileValidationRequest
- The validation verification request- Throws:
DcvException
- If entropy level is insufficient, the random value has expired, or the request token data is missing.
-
verifyFilePreparation
private void verifyFilePreparation(FilePreparationRequest filePreparationRequest) throws DcvException, IllegalArgumentException Verify the File Preparation RequestThis method verifies the provided
FilePreparationRequest
to ensure that all required fields are present and valid. It checks the domain name and challenge type, ensuring that the domain name is correctly formatted and does not contain wildcards.- Parameters:
filePreparationRequest
- The File Preparation Request- Throws:
DcvException
- if the request is invalid.InputException
when missing required fields.IllegalArgumentException
-
getFileUrl
Generate a URL for the where file will be placed on the serverThis method updates the required URL with the appropriate domain name and filename.
- Parameters:
domainName
- The domain name for which the file validation is being preparedfileName
- The name of the file to be used in the URL- Returns:
- The URL where the file will be placed
-