Add validation during domain creation for locked down TLDs

During domain create/applicationcreate/allocate, domains that are on the reserved list(s) with nameserver restricted reservation type must set nameservers that are part of the allowed nameservers for that domain in the reserved list(s) applied to that TLD.

Additionally a boolean is added to Registry to indicate if a TLD is restricting domain create. If it is, only domains that are nameserver restricted can be registered.

For consistency with a similar feature that validates a TLD-wide nameserver whitelist, the per-domain nameserver validation is performed even when the operation is in super-user mode. Similarly, if a domain is nameserver restricted, nameservers must be supplied (i. e. the nameservers set cannot be empty) when registering the domain.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150641269
This commit is contained in:
jianglai 2017-03-20 10:20:12 -07:00 committed by Ben McIlwain
parent 582469e052
commit 620d698479
15 changed files with 735 additions and 49 deletions

View file

@ -63,6 +63,7 @@ import google.registry.model.common.TimedTransitionProperty.TimedTransition;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee;
import google.registry.model.registry.label.PremiumList;
import google.registry.model.registry.label.ReservationType;
import google.registry.model.registry.label.ReservedList;
import google.registry.model.registry.label.ReservedList.ReservedListEntry;
import google.registry.util.Idn;
@ -318,6 +319,12 @@ public class Registry extends ImmutableObject implements Buildable {
/** Whether the price must be acknowledged to register premiun names on this TLD. */
boolean premiumPriceAckRequired = true;
/**
* Whether only domains with {@link ReservationType#NAMESERVER_RESTRICTED} reservation type in a
* reserved list can be registered on this TLD.
*/
boolean domainCreateRestricted;
/** The length of the add grace period for this TLD. */
Duration addGracePeriodLength = DEFAULT_ADD_GRACE_PERIOD;
@ -454,6 +461,13 @@ public class Registry extends ImmutableObject implements Buildable {
return premiumPriceAckRequired;
}
/**
* Returns true if only domains with nameserver restricted reservation on this TLD can be created.
*/
public boolean getDomainCreateRestricted() {
return domainCreateRestricted;
}
public Duration getAddGracePeriodLength() {
return addGracePeriodLength;
}
@ -647,6 +661,11 @@ public class Registry extends ImmutableObject implements Buildable {
return this;
}
public Builder setDomainCreateRestricted(boolean domainCreateRestricted) {
getInstance().domainCreateRestricted = domainCreateRestricted;
return this;
}
public Builder setPremiumPricingEngine(String pricingEngineClass) {
getInstance().pricingEngineClassName = checkArgumentNotNull(pricingEngineClass);
return this;