Class DnsValidator
This class implements Validation for the following methods:
The DnsValidator class is responsible for handling the preparation and validation of DNS records as part of the domain control validation process. It utilizes various utility classes and handlers to generate random values, verify domain names, and validate DNS records. The class ensures that the DNS records are correctly prepared and validated according to the specified DNS type and challenge type.
-
Field Summary
FieldsModifier and TypeFieldDescriptionList of allowed DNS Types for DNS Validationprivate final DnsValidationHandler
Handler for DNS Validationprivate final DomainNameUtils
Utility class for domain name operationsprivate final RandomValueGenerator
Utility class for generating random valuesprivate final RandomValueVerifier
Utility class for random value verification -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate DomainValidationEvidence
createDomainValidationEvidence
(DnsValidationRequest dnsValidationRequest, DnsValidationResponse dnsValidationResponse) Creates a DomainValidationEvidence object from the DnsValidationRequest and DnsValidationResponseprepare
(DnsPreparation dnsPreparation) Prepare the DNS record for validationvalidate
(DnsValidationRequest dnsValidationRequest) Validate the DNS record for domain validationprivate void
verifyDnsPreparation
(DnsPreparation dnsPreparation) Performs Validation onDnsPreparation
Fields.private void
Performs Validation onDnsValidationRequest
Fields.
-
Field Details
-
randomValueGenerator
Utility class for generating random values -
dnsValidationHandler
Handler for DNS Validation -
randomValueVerifier
Utility class for random value verification -
domainNameUtils
Utility class for domain name operations -
allowedDnsTypes
List of allowed DNS Types for DNS Validation
-
-
Constructor Details
-
DnsValidator
Constructor for DnsValidatorThis constructor initializes the DnsValidator class with the necessary dependencies and configuration. It retrieves the required instances from the provided DcvContext and sets up the utility classes and handlers for DNS validation.
- Parameters:
dcvContext
- context where we can find the needed dependencies / configuration
-
-
Method Details
-
prepare
Prepare the DNS record for validationThis method prepares the DNS record for validation by generating the necessary random values and setting up the validation state. It verifies the DNS preparation parameters and constructs a DnsPreparationResponse object containing the random value and allowed FQDNs.
- Parameters:
dnsPreparation
-DnsPreparation
object containing the domain, DNS Type and Challenge Type- Returns:
DnsPreparationResponse
object containing the random value and allowed FQDNs- Throws:
DcvException
- if the DNS Preparation fails.
-
validate
public DomainValidationEvidence validate(DnsValidationRequest dnsValidationRequest) throws DcvException Validate the DNS record for domain validationThis method validates the DNS record for domain validation by interacting with the DNS server and verifying the DNS records. It checks the validity of the DNS validation request and constructs a DomainValidationEvidence object if the validation is successful.
- Parameters:
dnsValidationRequest
-DnsValidationRequest
object containing the domain, DNS Type, Challenge Type and Validation State- Returns:
DomainValidationEvidence
object containing the domain validation evidence- Throws:
ValidationException
- if the DNS Validation fails.InputException
- if the input parameters are invalid.See @
ValidationException
for more detailsDcvException
-
createDomainValidationEvidence
private DomainValidationEvidence createDomainValidationEvidence(DnsValidationRequest dnsValidationRequest, DnsValidationResponse dnsValidationResponse) Creates a DomainValidationEvidence object from the DnsValidationRequest and DnsValidationResponse- Parameters:
dnsValidationRequest
- The DnsValidationRequest object containing the domain, DNS Type, challenge type, and Validation State useddnsValidationResponse
- The DnsValidationResponse object containing the server, domain, and random value or request token used- Returns:
- DomainValidationEvidence object containing the domain validation evidence
-
verifyDnsValidationRequest
Performs Validation onDnsValidationRequest
Fields.- Parameters:
request
-DnsValidationRequest
object to validate- Throws:
InputException
- if the input parameters are invalid. See @InputException
for more detailsDcvException
-
verifyDnsPreparation
Performs Validation onDnsPreparation
Fields.- Parameters:
dnsPreparation
-DnsPreparation
object to validate- Throws:
InputException
- if the DNS Preparation fails. See @InputException
for more details
-