public class DnsUserBlacklistService: IDnsUserBlacklistServiceIUserBlacklistService
{
private readonly IDnsService _dnsService;
private readonly String _domain;
public DnsUserBlacklistService(IDnsService dnservice, String domain)
{
_dnsService = dnsService;
_domain = domain;
}
public Boolean IsUserBlacklisted(IsUserBlacklistedRequest request)
{
var subDomainToQuery = GetSubDomainToQuery(request);
var fullDomainToQuery = String.Format("{0}.{1}", subDomainToQuery, _domain);
var dnsRecords = _dnsService.GetRecords(fullDomainToQuery);
if (dnsRecords != null && dnsRecords.Any())
{
// Match between records and user information
// Note: I know I shouldn't write pseudo-code, but this part
// is really unrelevant to the question
}
// If no DNS records, assume the user is not blacklisted
return false;
}
private String GetSubDomainToQuery(IsUserBlacklistedRequest request)
{
return String.Concat(
request.FirstName,
request.LastName,
request.BirthDate.ToString("yyyyMMdd")
);
}
}
changed IDnsUserBlacklistService to IUserBlacklistService, that was a mistake as I refer above to IUserBlacklistService
Mickaël Derriey
- 123
- 3
Post Closed as "Not suitable for this site" by RubberDuck, Vogel612, Kid Diamond, Mathieu Guindon, amon