Add the START_DATE_SUNRISE phase

The START_DATE_SUNRISE phase allows registration of domains only with a signed mark. In all other respects - it is identical to the GENERAL_AVAILABILITY phase.

Note that Anchor Tenants bypass all checks, and are hence able to register domains without a signed mark.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185534793
This commit is contained in:
guyben 2018-02-13 08:38:54 -08:00 committed by jianglai
parent bba975a991
commit b0cbc0f60d
17 changed files with 484 additions and 13 deletions

View file

@ -105,7 +105,8 @@ public final class DomainCheckFlow implements Flow {
* unavailable.
*/
private static final ImmutableSet<TldState> PENDING_ALLOCATION_TLD_STATES =
Sets.immutableEnumSet(TldState.GENERAL_AVAILABILITY, TldState.QUIET_PERIOD);
Sets.immutableEnumSet(
TldState.GENERAL_AVAILABILITY, TldState.START_DATE_SUNRISE, TldState.QUIET_PERIOD);
@Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager;

View file

@ -42,6 +42,8 @@ import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIB
import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.leapSafeAddYears;
@ -119,7 +121,9 @@ import org.joda.time.Duration;
* @error {@link google.registry.flows.EppException.UnimplementedExtensionException}
* @error {@link google.registry.flows.ExtensionManager.UndeclaredServiceExtensionException}
* @error {@link DomainCreateFlow.DomainHasOpenApplicationsException}
* @error {@link DomainCreateFlow.MustHaveSignedMarksInCurrentPhaseException}
* @error {@link DomainCreateFlow.NoGeneralRegistrationsInCurrentPhaseException}
* @error {@link DomainFlowTmchUtils.NoMarksFoundMatchingDomainException}
* @error {@link DomainFlowUtils.NotAuthorizedForTldException}
* @error {@link DomainFlowUtils.AcceptedTooLongAgoException}
* @error {@link DomainFlowUtils.BadDomainNameCharacterException}
@ -251,7 +255,7 @@ public class DomainCreateFlow implements TransactionalFlow {
}
verifyPremiumNameIsNotBlocked(targetId, now, clientId);
verifyNoOpenApplications(now);
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant);
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, hasSignedMarks);
if (hasSignedMarks) {
// If a signed mark was provided, then it must match the desired domain label. Get the mark
// at this point so that we can verify it before the "after validation" extension point.
@ -375,12 +379,38 @@ public class DomainCreateFlow implements TransactionalFlow {
}
}
/** Prohibit registrations for non-QLP and non-superuser outside of General Availability. **/
private void verifyIsGaOrIsSpecialCase(TldState tldState, boolean isAnchorTenant)
throws NoGeneralRegistrationsInCurrentPhaseException {
if (!isAnchorTenant && tldState != TldState.GENERAL_AVAILABILITY) {
throw new NoGeneralRegistrationsInCurrentPhaseException();
/**
* Prohibit registrations unless QLP, General Availability or Start Date Sunrise.
*
* <p>During Start-Date Sunrise, we need a signed mark for registrations.
*
* <p>Note that "superuser" status isn't tested here - this should only be called for
* non-superusers.
*/
private void verifyIsGaOrIsSpecialCase(
TldState tldState, boolean isAnchorTenant, boolean hasSignedMarks)
throws NoGeneralRegistrationsInCurrentPhaseException,
MustHaveSignedMarksInCurrentPhaseException {
// Anchor Tenant overrides any other consideration to allow registration.
if (isAnchorTenant) {
return;
}
// We allow general registration during GA.
if (GENERAL_AVAILABILITY.equals(tldState)) {
return;
}
// During START_DATE_SUNRISE, only allow registration with a signed marks.
if (START_DATE_SUNRISE.equals(tldState)) {
if (!hasSignedMarks) {
throw new MustHaveSignedMarksInCurrentPhaseException();
}
return;
}
// All other phases do not allow registration
throw new NoGeneralRegistrationsInCurrentPhaseException();
}
/** Verifies and returns the allocation token if one is specified, otherwise does nothing. */
@ -516,4 +546,11 @@ public class DomainCreateFlow implements TransactionalFlow {
super("The current registry phase does not allow for general registrations");
}
}
/** The current registry phase allows registrations only with signed marks. */
static class MustHaveSignedMarksInCurrentPhaseException extends CommandUseErrorException {
public MustHaveSignedMarksInCurrentPhaseException() {
super("The current registry phase requires a signed mark for registrations");
}
}
}

View file

@ -127,12 +127,14 @@ public class DomainFlowUtils {
/** Map from launch phases to the equivalent tld states. */
private static final ImmutableMap<LaunchPhase, TldState> LAUNCH_PHASE_TO_TLD_STATE =
ImmutableMap.of(
LaunchPhase.SUNRISE, TldState.SUNRISE,
LaunchPhase.SUNRUSH, TldState.SUNRUSH,
LaunchPhase.LANDRUSH, TldState.LANDRUSH,
LaunchPhase.CLAIMS, TldState.GENERAL_AVAILABILITY,
LaunchPhase.OPEN, TldState.GENERAL_AVAILABILITY);
new ImmutableMap.Builder<LaunchPhase, TldState>()
.put(LaunchPhase.SUNRISE, TldState.SUNRISE)
.put(LaunchPhase.SUNRUSH, TldState.SUNRUSH)
.put(LaunchPhase.LANDRUSH, TldState.LANDRUSH)
.put(LaunchPhase.CLAIMS, TldState.GENERAL_AVAILABILITY)
.put(LaunchPhase.START_DATE_SUNRISE, TldState.START_DATE_SUNRISE)
.put(LaunchPhase.OPEN, TldState.GENERAL_AVAILABILITY)
.build();
/** Reservation types that are allowed in sunrise by policy. */
public static final ImmutableSet<ReservationType> TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISE =
@ -146,6 +148,7 @@ public class DomainFlowUtils {
Sets.immutableEnumSet(
TldState.PREDELEGATION,
TldState.QUIET_PERIOD,
TldState.START_DATE_SUNRISE,
TldState.GENERAL_AVAILABILITY);
/** Strict validator for ascii lowercase letters, digits, and "-", allowing "." as a separator */

View file

@ -32,6 +32,25 @@ import javax.xml.bind.annotation.XmlValue;
*
* <p>The launch phase refers to the various stages that a TLD goes through before entering general
* availability. The various phases are described below (in order that they usually occur).
*
* <p>Each phase is connected to the TldState in which it can be used (see DomainFlowUtils). Sending
* an EPP with the wrong launch phase for the current TldState will result in an error. However, we
* don't actually check the launch phase *exists*.
*
* <p>We usually check for the information *inside* a launch phase (e.g. the signed mark for the
* domain) and return an error if that is missing - which would also check that the phase exists.
* But if we bypass the need for that information (e.g., an Anchor Tenant doesn't need a signed
* mark), then we never actually test the phase exists.
*
* <p>This means an Anchor Tenant has some weird peculiarities: It doesn't need to specify the
* phase. It *can* specify the phase, but not give any of the phase's information (e.g. - signed
* marks), in which case we accept even a wrong phase. But if it *does* give a signed mark as well -
* we will return an error if it's the wrong phase (or if the marks are invalid) even though we
* didn't require them.
*
* <p>This is OK (?) because the Anchor Tenants field is set internally and manually.. The person
* who sets it is the one that needs to make sure the domain isn't a trademark and that the fields
* are correct.
*/
@Embed
public class LaunchPhase extends ImmutableObject {
@ -57,6 +76,12 @@ public class LaunchPhase extends ImmutableObject {
*/
public static final LaunchPhase CLAIMS = create("claims", null);
/**
* An alternative launch phase which allows only trademark owners to create domains. It is used
* instead of the previous phases.
*/
public static final LaunchPhase START_DATE_SUNRISE = create("sunrise", "start-date");
/** A post-launch phase that is also referred to as "steady state". */
public static final LaunchPhase OPEN = create("open", null);

View file

@ -154,6 +154,12 @@ public class Registry extends ImmutableObject implements Buildable {
*/
LANDRUSH,
/**
* The state in which only trademark holders can submit a "create" request. It is identical to
* {@link #GENERAL_AVAILABILITY} in all other respects.
*/
START_DATE_SUNRISE,
/**
* A state in which no domain operations are permitted. Generally used after sunrise or landrush
* to allocate uncontended applications and send contended applications to auction. This state