Class CustomDnsResolver
java.lang.Object
org.apache.hc.client5.http.SystemDefaultDnsResolver
com.digicert.validation.client.file.CustomDnsResolver
- All Implemented Interfaces:
org.apache.hc.client5.http.DnsResolver
public class CustomDnsResolver
extends org.apache.hc.client5.http.SystemDefaultDnsResolver
CustomDnsResolver is an implementation of the DnsResolver interface that utilizes a DnsClient
to perform DNS queries. It specifically processes A records and converts them into InetAddress objects.
According to the BR's, DNS resolution must be conducted by DNS servers managed by the CA. This library facilitates this requirement by using the DNS servers specified in the DCV configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DnsClient
The DnsClient used to resolve DNS queries.Fields inherited from class org.apache.hc.client5.http.SystemDefaultDnsResolver
INSTANCE
-
Constructor Summary
ConstructorsConstructorDescriptionCustomDnsResolver
(DcvContext dcvContext) Constructs a CustomDnsResolver with the specified DcvContext. -
Method Summary
Modifier and TypeMethodDescriptionResolves the given host name to an array of InetAddress objects using the DnsClient.Methods inherited from class org.apache.hc.client5.http.SystemDefaultDnsResolver
resolveCanonicalHostname
-
Field Details
-
dnsClient
The DnsClient used to resolve DNS queries.
-
-
Constructor Details
-
CustomDnsResolver
Constructs a CustomDnsResolver with the specified DcvContext. The Context is used to retrieve the DnsClient dependency needed to perform DNS queries.- Parameters:
dcvContext
- context where we can find the needed dependencies / configuration
-
-
Method Details
-
resolve
Resolves the given host name to an array of InetAddress objects using the DnsClient.This method overrides the resolve method of the SystemDefaultDnsResolver to provide custom DNS resolution logic. It uses the DnsClient to perform the A record DNS lookup. The A records are then converted to InetAddress objects, which are returned as the result. If the DNS lookup fails or an error occurs, an UnknownHostException is thrown with a detailed error message.
- Specified by:
resolve
in interfaceorg.apache.hc.client5.http.DnsResolver
- Overrides:
resolve
in classorg.apache.hc.client5.http.SystemDefaultDnsResolver
- Parameters:
host
- The host name to resolve.- Returns:
- An array of InetAddress objects for the given host name.
- Throws:
UnknownHostException
- If the host name cannot be resolved.
-