mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Update create logic to ignore signed marks unless in sunrise
This addresses an issue where the existing logic assumed that the presence of a signed mark means the current flow is a sunrise/sunrush request, when this isn't necessarily true. It's safe to ignore signed marks in other circumstances. This is a combination of work by Justin Graham <justin.af.graham@gmail.com>, Nick Felt, and me (Ben). It is based on the original PR located at: https://github.com/google/nomulus/pull/41 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=140784461
This commit is contained in:
parent
59f4984083
commit
3740171bbf
7 changed files with 79 additions and 43 deletions
|
@ -106,7 +106,6 @@ import org.joda.time.DateTime;
|
|||
* @error {@link google.registry.flows.EppException.UnimplementedExtensionException}
|
||||
* @error {@link google.registry.flows.ExtensionManager.UndeclaredServiceExtensionException}
|
||||
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link DomainCreateFlow.SignedMarksNotAcceptedInCurrentPhaseException}
|
||||
* @error {@link DomainFlowUtils.AcceptedTooLongAgoException}
|
||||
* @error {@link DomainFlowUtils.BadDomainNameCharacterException}
|
||||
* @error {@link DomainFlowUtils.BadDomainNamePartsCountException}
|
||||
|
@ -154,7 +153,7 @@ import org.joda.time.DateTime;
|
|||
|
||||
public class DomainCreateFlow implements TransactionalFlow {
|
||||
|
||||
private static final Set<TldState> QLP_SMD_ALLOWED_STATES =
|
||||
private static final Set<TldState> SUNRISE_STATES =
|
||||
Sets.immutableEnumSet(TldState.SUNRISE, TldState.SUNRUSH);
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
|
@ -202,9 +201,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
verifyNoCodeMarks(launchCreate);
|
||||
validateLaunchCreateNotice(launchCreate.getNotice(), domainLabel, isSuperuser, now);
|
||||
}
|
||||
if (hasSignedMarks) {
|
||||
verifySignedMarksAllowed(tldState, isAnchorTenant);
|
||||
}
|
||||
boolean isSunriseCreate = hasSignedMarks && SUNRISE_STATES.contains(tldState);
|
||||
customLogic.afterValidation(
|
||||
DomainCreateFlowCustomLogic.AfterValidationParameters.newBuilder()
|
||||
.setDomainName(domainName)
|
||||
|
@ -226,7 +223,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
verifyLaunchPhaseMatchesRegistryPhase(registry, launchCreate, now);
|
||||
}
|
||||
if (!isAnchorTenant) {
|
||||
verifyNotReserved(domainName, hasSignedMarks);
|
||||
verifyNotReserved(domainName, isSunriseCreate);
|
||||
}
|
||||
if (hasClaimsNotice) {
|
||||
verifyClaimsPeriodNotEnded(registry, now);
|
||||
|
@ -293,7 +290,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
entitiesToSave.add(
|
||||
prepareMarkedLrpTokenEntity(authInfo.getPw().getValue(), domainName, historyEntry));
|
||||
}
|
||||
enqueueTasks(hasSignedMarks, hasClaimsNotice, newDomain);
|
||||
enqueueTasks(isSunriseCreate, hasClaimsNotice, newDomain);
|
||||
|
||||
EntityChanges entityChanges =
|
||||
customLogic.beforeSave(
|
||||
|
@ -324,14 +321,6 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
|| (metadataExtension != null && metadataExtension.getIsAnchorTenant());
|
||||
}
|
||||
|
||||
/** Only QLP domains can have a signed mark on a domain create, and only in sunrise or sunrush. */
|
||||
private void verifySignedMarksAllowed(TldState tldState, boolean isAnchorTenant)
|
||||
throws SignedMarksNotAcceptedInCurrentPhaseException {
|
||||
if (!isAnchorTenant || !QLP_SMD_ALLOWED_STATES.contains(tldState)) {
|
||||
throw new SignedMarksNotAcceptedInCurrentPhaseException();
|
||||
}
|
||||
}
|
||||
|
||||
/** Prohibit creating a domain if there is an open application for the same name. */
|
||||
private void verifyNoOpenApplications(DateTime now) throws DomainHasOpenApplicationsException {
|
||||
for (DomainApplication application : loadActiveApplicationsByDomainName(targetId, now)) {
|
||||
|
@ -425,11 +414,11 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
}
|
||||
|
||||
private void enqueueTasks(
|
||||
boolean hasSignedMarks, boolean hasClaimsNotice, DomainResource newDomain) {
|
||||
boolean isSunriseCreate, boolean hasClaimsNotice, DomainResource newDomain) {
|
||||
if (newDomain.shouldPublishToDns()) {
|
||||
DnsQueue.create().addDomainRefreshTask(newDomain.getFullyQualifiedDomainName());
|
||||
}
|
||||
if (hasClaimsNotice || hasSignedMarks) {
|
||||
if (hasClaimsNotice || isSunriseCreate) {
|
||||
LordnTask.enqueueDomainResourceTask(newDomain);
|
||||
}
|
||||
}
|
||||
|
@ -448,13 +437,6 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
}
|
||||
}
|
||||
|
||||
/** Signed marks are not accepted in the current registry phase. */
|
||||
static class SignedMarksNotAcceptedInCurrentPhaseException extends CommandUseErrorException {
|
||||
public SignedMarksNotAcceptedInCurrentPhaseException() {
|
||||
super("Signed marks are not accepted in the current registry phase");
|
||||
}
|
||||
}
|
||||
|
||||
/** The current registry phase does not allow for general registrations. */
|
||||
static class NoGeneralRegistrationsInCurrentPhaseException extends CommandUseErrorException {
|
||||
public NoGeneralRegistrationsInCurrentPhaseException() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue