Skip to content

Commit e65fa8a

Browse files
Revert "dns validation"
This reverts commit dbf9b25.
1 parent dbf9b25 commit e65fa8a

14 files changed

Lines changed: 0 additions & 623 deletions

HydrantCAProxy.Tests/RequestManagerTests.cs

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -282,80 +282,6 @@ public void GetSansRequest_AllTypes_Populated()
282282
Assert.Single(result.Upn);
283283
}
284284

285-
// ---------------------------------------------------------------------
286-
// GetDomainsToValidate
287-
// ---------------------------------------------------------------------
288-
289-
[Fact]
290-
public void GetDomainsToValidate_CnOnly_ReturnsSingleDomain()
291-
{
292-
var result = _sut.GetDomainsToValidate(SampleCsr, null);
293-
294-
Assert.Single(result);
295-
Assert.Equal("unit.test.hydrantid.local", result[0]);
296-
}
297-
298-
[Fact]
299-
public void GetDomainsToValidate_CnPlusDnsSans_ReturnsDeduped()
300-
{
301-
var sans = new Dictionary<string, string[]>
302-
{
303-
["dnsname"] = new[] { "unit.test.hydrantid.local", "www.example.com" }
304-
};
305-
306-
var result = _sut.GetDomainsToValidate(SampleCsr, sans);
307-
308-
Assert.Equal(2, result.Count);
309-
Assert.Contains("unit.test.hydrantid.local", result);
310-
Assert.Contains("www.example.com", result);
311-
}
312-
313-
[Fact]
314-
public void GetDomainsToValidate_SansCaseVariant_DedupedAgainstCn()
315-
{
316-
var sans = new Dictionary<string, string[]>
317-
{
318-
["dnsname"] = new[] { "UNIT.TEST.HYDRANTID.LOCAL" }
319-
};
320-
321-
var result = _sut.GetDomainsToValidate(SampleCsr, sans);
322-
323-
Assert.Single(result);
324-
}
325-
326-
[Fact]
327-
public void GetDomainsToValidate_NullCsr_ThrowsArgumentNullException()
328-
{
329-
Assert.Throws<ArgumentNullException>(() => _sut.GetDomainsToValidate(null, null));
330-
}
331-
332-
// ---------------------------------------------------------------------
333-
// GetCreateDomainValidationRequest
334-
// ---------------------------------------------------------------------
335-
336-
[Fact]
337-
public void GetCreateDomainValidationRequest_Valid_SetsDnsMethodAndOmitsAccountId()
338-
{
339-
var result = _sut.GetCreateDomainValidationRequest("example.com", "validator-1");
340-
341-
Assert.Equal("example.com", result.DomainName);
342-
Assert.Equal("validator-1", result.Validator);
343-
Assert.Equal(ValidationMethod.Dns, result.Method);
344-
Assert.Null(result.AccountId);
345-
}
346-
347-
[Fact]
348-
public void GetCreateDomainValidationRequest_NullDomain_ThrowsArgumentNullException()
349-
{
350-
Assert.Throws<ArgumentNullException>(() => _sut.GetCreateDomainValidationRequest(null, "validator-1"));
351-
}
352-
353-
[Fact]
354-
public void GetCreateDomainValidationRequest_NullValidatorId_ThrowsArgumentNullException()
355-
{
356-
Assert.Throws<ArgumentNullException>(() => _sut.GetCreateDomainValidationRequest("example.com", null));
357-
}
358-
359285
// ---------------------------------------------------------------------
360286
// GetCertificatesListRequest
361287
// ---------------------------------------------------------------------

HydrantCAProxy/Client/HydrantIdClient.cs

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -238,137 +238,6 @@ public async Task<List<Policy>> GetPolicyList()
238238

239239

240240

241-
public async Task<List<Domain>> GetDomainListAsync()
242-
{
243-
Log.MethodEntry();
244-
var apiEndpoint = "/api/v2/domains/";
245-
var fullUrl = BaseUrl + apiEndpoint;
246-
Log.LogTrace("GetDomainListAsync: API Url={Url}", fullUrl);
247-
248-
var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
249-
250-
try
251-
{
252-
var restClient = ConfigureRestClient("get", fullUrl);
253-
using var resp = await restClient.GetAsync(apiEndpoint);
254-
var responseContent = await resp.Content.ReadAsStringAsync();
255-
256-
Log.LogTrace("GetDomainListAsync: HTTP status={StatusCode}, response length={Len}",
257-
resp.StatusCode, responseContent?.Length ?? 0);
258-
259-
if (!resp.IsSuccessStatusCode)
260-
{
261-
Log.LogError("GetDomainListAsync: request failed with status {StatusCode}: {Response}", resp.StatusCode, responseContent);
262-
throw new HttpRequestException($"GetDomainListAsync failed with HTTP {resp.StatusCode}: {responseContent}");
263-
}
264-
265-
var domains = JsonConvert.DeserializeObject<List<Domain>>(responseContent, settings);
266-
267-
if (domains == null)
268-
{
269-
Log.LogWarning("GetDomainListAsync: deserialized domain list is null");
270-
return new List<Domain>();
271-
}
272-
273-
Log.LogTrace("GetDomainListAsync: returned {Count} domains", domains.Count);
274-
return domains;
275-
}
276-
catch (Exception e)
277-
{
278-
Log.LogError(e, "GetDomainListAsync: exception: {Message}", e.Message);
279-
throw;
280-
}
281-
}
282-
283-
284-
285-
public async Task<Domain> GetSubmitCreateDomainValidationAsync(CreateDomainValidationPayload payload)
286-
{
287-
Log.MethodEntry();
288-
Log.LogTrace("GetSubmitCreateDomainValidationAsync: payload is {Null}", payload == null ? "NULL" : "present");
289-
290-
if (payload == null)
291-
throw new ArgumentNullException(nameof(payload), "payload cannot be null.");
292-
293-
var apiEndpoint = "/api/v2/domains/";
294-
var fullUrl = BaseUrl + apiEndpoint;
295-
Log.LogTrace("GetSubmitCreateDomainValidationAsync: API Url={Url}", fullUrl);
296-
297-
var json = JsonConvert.SerializeObject(payload);
298-
Log.LogTrace("GetSubmitCreateDomainValidationAsync: request JSON: {Json}", json);
299-
300-
var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
301-
302-
try
303-
{
304-
var restClient = ConfigureRestClient("post", fullUrl);
305-
using var resp = await restClient.PostAsync(apiEndpoint, new StringContent(json, Encoding.UTF8, "application/json"));
306-
var responseContent = await resp.Content.ReadAsStringAsync();
307-
308-
Log.LogTrace("GetSubmitCreateDomainValidationAsync: HTTP status={StatusCode}, response length={Len}",
309-
resp.StatusCode, responseContent?.Length ?? 0);
310-
311-
if (!resp.IsSuccessStatusCode)
312-
{
313-
Log.LogError("GetSubmitCreateDomainValidationAsync: request failed with status {StatusCode}: {Response}", resp.StatusCode, responseContent);
314-
throw new HttpRequestException($"GetSubmitCreateDomainValidationAsync failed with HTTP {resp.StatusCode}: {responseContent}");
315-
}
316-
317-
var domain = JsonConvert.DeserializeObject<Domain>(responseContent, settings);
318-
Log.LogTrace("GetSubmitCreateDomainValidationAsync: response JSON: {Json}", JsonConvert.SerializeObject(domain));
319-
return domain;
320-
}
321-
catch (Exception e)
322-
{
323-
Log.LogError(e, "GetSubmitCreateDomainValidationAsync: exception: {Message}", e.Message);
324-
throw;
325-
}
326-
}
327-
328-
329-
330-
public async Task<Domain> GetSubmitCheckDomainValidationAsync(string domainId)
331-
{
332-
Log.MethodEntry();
333-
Log.LogTrace("GetSubmitCheckDomainValidationAsync: domainId='{DomainId}'", domainId ?? "(null)");
334-
335-
if (string.IsNullOrEmpty(domainId))
336-
throw new ArgumentNullException(nameof(domainId), "domainId cannot be null or empty.");
337-
338-
var apiEndpoint = $"/api/v2/domains/{domainId}/validate";
339-
var fullUrl = BaseUrl + apiEndpoint;
340-
Log.LogTrace("GetSubmitCheckDomainValidationAsync: API Url={Url}", fullUrl);
341-
342-
var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
343-
344-
try
345-
{
346-
var restClient = ConfigureRestClient("get", fullUrl);
347-
using var resp = await restClient.GetAsync(apiEndpoint);
348-
var responseContent = await resp.Content.ReadAsStringAsync();
349-
350-
Log.LogTrace("GetSubmitCheckDomainValidationAsync: HTTP status={StatusCode}, response length={Len}",
351-
resp.StatusCode, responseContent?.Length ?? 0);
352-
353-
if (!resp.IsSuccessStatusCode)
354-
{
355-
Log.LogError("GetSubmitCheckDomainValidationAsync: request failed with status {StatusCode}: {Response}", resp.StatusCode, responseContent);
356-
throw new HttpRequestException($"GetSubmitCheckDomainValidationAsync failed with HTTP {resp.StatusCode}: {responseContent}");
357-
}
358-
359-
var domain = JsonConvert.DeserializeObject<Domain>(responseContent, settings);
360-
Log.LogTrace("GetSubmitCheckDomainValidationAsync: response JSON: {Json}", JsonConvert.SerializeObject(domain));
361-
return domain;
362-
}
363-
catch (Exception e)
364-
{
365-
Log.LogError(e, "GetSubmitCheckDomainValidationAsync: exception: {Message}", e.Message);
366-
throw;
367-
}
368-
}
369-
370-
371-
372241
public async Task<Certificate> GetSubmitGetCertificateAsync(string certificateId)
373242
{
374243
Log.MethodEntry();

HydrantCAProxy/Client/Models/CreateDomainValidationPayload.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

HydrantCAProxy/Client/Models/Domain.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

HydrantCAProxy/Client/Models/Enums/DomainStatusEnum.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

HydrantCAProxy/Client/Models/Enums/ValidationMethod.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

HydrantCAProxy/Client/Models/PolicyDetails.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,5 @@ public class PolicyDetails : IPolicyDetails
3333
[JsonProperty("customExtensions", NullValueHandling = NullValueHandling.Ignore)]
3434
public List<PolicyDetailsCustomExtensions> CustomExtensions { get;set; }
3535

36-
[JsonProperty("validator", NullValueHandling = NullValueHandling.Ignore)]
37-
public string Validator { get;set; }
38-
3936
}
4037
}

0 commit comments

Comments
 (0)