Add nameserver validation in domain update related flows

When updating domains, make sure that if the domains are nameserver restricted, the updated nameservers set on the domains are still consistent with the restriction.

When updating domains of a domain created restricted TLD, validate if the domain is still on the reserved list with nameserver restricted reservation. If it is not, there's likely some conflicting states of the domain that needs to be reconciled (e. g.the domain is removed from the reserved list after being created). Throws an exception in this case.

Also added missing tests for TLDs with nameserver whitelist.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150781935
This commit is contained in:
jianglai 2017-03-21 11:50:13 -07:00 committed by Ben McIlwain
parent a958d0a6c3
commit 37440d6b29
7 changed files with 517 additions and 8 deletions

View file

@ -375,7 +375,8 @@ public class DomainFlowUtils {
}
/** Validates if the requested domain can be reated on a domain create restricted TLD. */
static void validateDomainCreateAllowed(InternetDomainName domainName) throws EppException {
static void validateDomainAllowedOnCreateRestrictedTld(InternetDomainName domainName)
throws EppException {
ImmutableSet<ReservationType> reservationTypes = getReservationTypes(domainName);
if (!reservationTypes.contains(NAMESERVER_RESTRICTED)) {
throw new DomainNotAllowedForTldWithCreateRestrictionException(domainName.toString());
@ -782,7 +783,7 @@ public class DomainFlowUtils {
validateNameserversCountForTld(tld, domainName, fullyQualifiedHostNames.size());
validateNameserversAllowedOnTld(tld, fullyQualifiedHostNames);
if (registry.getDomainCreateRestricted()) {
validateDomainCreateAllowed(domainName);
validateDomainAllowedOnCreateRestrictedTld(domainName);
}
validateNameserversAllowedOnDomain(domainName, fullyQualifiedHostNames);
}