mirror of
https://github.com/google/nomulus.git
synced 2025-05-22 04:09:46 +02:00
Allow reserved domains to be created during quiet periods
We'll use this for LRP. This is safe because we must specifically reserve a domain by including it in a reserved list, create an associated allocation token, and distribute that token, before a create would succeed. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=250901144
This commit is contained in:
parent
79bcb227be
commit
ff6d327183
2 changed files with 39 additions and 3 deletions
|
@ -44,6 +44,7 @@ import static google.registry.model.EppResourceUtils.createDomainRepoId;
|
||||||
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
|
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
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.GENERAL_AVAILABILITY;
|
||||||
|
import static google.registry.model.registry.Registry.TldState.QUIET_PERIOD;
|
||||||
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
|
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
|
||||||
import static google.registry.model.registry.label.ReservationType.NAME_COLLISION;
|
import static google.registry.model.registry.label.ReservationType.NAME_COLLISION;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
|
@ -254,11 +255,12 @@ public class DomainCreateFlow implements TransactionalFlow {
|
||||||
// registering premium domains.
|
// registering premium domains.
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
checkAllowedAccessToTld(clientId, registry.getTldStr());
|
checkAllowedAccessToTld(clientId, registry.getTldStr());
|
||||||
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, hasSignedMarks);
|
boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken);
|
||||||
|
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, isValidReservedCreate, hasSignedMarks);
|
||||||
if (launchCreate.isPresent()) {
|
if (launchCreate.isPresent()) {
|
||||||
verifyLaunchPhaseMatchesRegistryPhase(registry, launchCreate.get(), now);
|
verifyLaunchPhaseMatchesRegistryPhase(registry, launchCreate.get(), now);
|
||||||
}
|
}
|
||||||
if (!isAnchorTenant && !isValidReservedCreate(domainName, allocationToken)) {
|
if (!isAnchorTenant && !isValidReservedCreate) {
|
||||||
verifyNotReserved(domainName, isSunriseCreate);
|
verifyNotReserved(domainName, isSunriseCreate);
|
||||||
}
|
}
|
||||||
if (hasClaimsNotice) {
|
if (hasClaimsNotice) {
|
||||||
|
@ -423,7 +425,10 @@ public class DomainCreateFlow implements TransactionalFlow {
|
||||||
* non-superusers.
|
* non-superusers.
|
||||||
*/
|
*/
|
||||||
private void verifyIsGaOrIsSpecialCase(
|
private void verifyIsGaOrIsSpecialCase(
|
||||||
TldState tldState, boolean isAnchorTenant, boolean hasSignedMarks)
|
TldState tldState,
|
||||||
|
boolean isAnchorTenant,
|
||||||
|
boolean isValidReservedCreate,
|
||||||
|
boolean hasSignedMarks)
|
||||||
throws NoGeneralRegistrationsInCurrentPhaseException,
|
throws NoGeneralRegistrationsInCurrentPhaseException,
|
||||||
MustHaveSignedMarksInCurrentPhaseException {
|
MustHaveSignedMarksInCurrentPhaseException {
|
||||||
// Anchor Tenant overrides any other consideration to allow registration.
|
// Anchor Tenant overrides any other consideration to allow registration.
|
||||||
|
@ -444,6 +449,13 @@ public class DomainCreateFlow implements TransactionalFlow {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We allow creates of specifically reserved domain names during quiet periods.
|
||||||
|
if (QUIET_PERIOD.equals(tldState)) {
|
||||||
|
if (isValidReservedCreate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// All other phases do not allow registration
|
// All other phases do not allow registration
|
||||||
throw new NoGeneralRegistrationsInCurrentPhaseException();
|
throw new NoGeneralRegistrationsInCurrentPhaseException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1149,6 +1149,30 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
assertAllocationTokenWasRedeemed("abc123");
|
assertAllocationTokenWasRedeemed("abc123");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuccess_reservedDomain_viaAllocationTokenExtension_inQuietPeriod()
|
||||||
|
throws Exception {
|
||||||
|
persistResource(
|
||||||
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
|
.setTldStateTransitions(ImmutableSortedMap.of(START_OF_TIME, QUIET_PERIOD))
|
||||||
|
.build());
|
||||||
|
allocationToken =
|
||||||
|
persistResource(
|
||||||
|
new AllocationToken.Builder()
|
||||||
|
.setToken("abc123")
|
||||||
|
.setTokenType(SINGLE_USE)
|
||||||
|
.setDomainName("resdom.tld")
|
||||||
|
.build());
|
||||||
|
setEppInput("domain_create_allocationtoken.xml", ImmutableMap.of("DOMAIN", "resdom.tld"));
|
||||||
|
persistContactsAndHosts();
|
||||||
|
runFlowAssertResponse(
|
||||||
|
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "resdom.tld")));
|
||||||
|
assertSuccessfulCreate("tld", ImmutableSet.of(RESERVED), allocationToken);
|
||||||
|
assertNoLordn();
|
||||||
|
assertAllocationTokenWasRedeemed("abc123");
|
||||||
|
}
|
||||||
|
|
||||||
private void assertAllocationTokenWasRedeemed(String token) throws Exception {
|
private void assertAllocationTokenWasRedeemed(String token) throws Exception {
|
||||||
AllocationToken reloadedToken =
|
AllocationToken reloadedToken =
|
||||||
ofy().load().key(Key.create(AllocationToken.class, token)).now();
|
ofy().load().key(Key.create(AllocationToken.class, token)).now();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue