diff --git a/java/google/registry/flows/FlowMetadata.java b/java/google/registry/flows/FlowMetadata.java new file mode 100644 index 000000000..a4bcd13ae --- /dev/null +++ b/java/google/registry/flows/FlowMetadata.java @@ -0,0 +1,38 @@ +// Copyright 2016 The Nomulus Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package google.registry.flows; + +import com.google.auto.value.AutoValue; +import google.registry.model.ImmutableObject; + +/** Object to hold metadata specific to a particular execution of a flow. */ +@AutoValue +public abstract class FlowMetadata extends ImmutableObject { + + public abstract boolean isSuperuser(); + + public static Builder newBuilder() { + return new AutoValue_FlowMetadata.Builder(); + } + + /** Builder for {@link FlowMetadata} */ + @AutoValue.Builder + public abstract static class Builder { + + public abstract Builder setSuperuser(boolean isSuperuser); + + public abstract FlowMetadata build(); + } +} diff --git a/java/google/registry/flows/FlowModule.java b/java/google/registry/flows/FlowModule.java index 72b556e29..7cad6e83f 100644 --- a/java/google/registry/flows/FlowModule.java +++ b/java/google/registry/flows/FlowModule.java @@ -259,6 +259,11 @@ public class FlowModule { .setResultFromCode(Result.Code.SUCCESS); // Default to success. } + @Provides + static FlowMetadata provideFlowMetadata(@Superuser boolean isSuperuser) { + return FlowMetadata.newBuilder().setSuperuser(isSuperuser).build(); + } + /** Wrapper class to carry an {@link EppException} to the calling code. */ static class EppExceptionInProviderException extends RuntimeException { EppExceptionInProviderException(EppException exception) { diff --git a/java/google/registry/flows/custom/BaseFlowCustomLogic.java b/java/google/registry/flows/custom/BaseFlowCustomLogic.java index fcec87ab2..ca6764932 100644 --- a/java/google/registry/flows/custom/BaseFlowCustomLogic.java +++ b/java/google/registry/flows/custom/BaseFlowCustomLogic.java @@ -14,6 +14,7 @@ package google.registry.flows.custom; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.model.eppinput.EppInput; @@ -25,10 +26,13 @@ public abstract class BaseFlowCustomLogic { private final EppInput eppInput; private final SessionMetadata sessionMetadata; + private final FlowMetadata flowMetadata; - protected BaseFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { + protected BaseFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { this.eppInput = eppInput; this.sessionMetadata = sessionMetadata; + this.flowMetadata = flowMetadata; } protected EppInput getEppInput() { @@ -38,4 +42,8 @@ public abstract class BaseFlowCustomLogic { protected SessionMetadata getSessionMetadata() { return sessionMetadata; } + + protected FlowMetadata getFlowMetadata() { + return flowMetadata; + } } diff --git a/java/google/registry/flows/custom/CustomLogicFactory.java b/java/google/registry/flows/custom/CustomLogicFactory.java index 11a9a5f8a..f9bd1bc74 100644 --- a/java/google/registry/flows/custom/CustomLogicFactory.java +++ b/java/google/registry/flows/custom/CustomLogicFactory.java @@ -15,6 +15,7 @@ package google.registry.flows.custom; import google.registry.config.RegistryConfig.ConfigModule; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.model.eppinput.EppInput; @@ -32,42 +33,42 @@ import google.registry.model.eppinput.EppInput; public class CustomLogicFactory { public DomainApplicationCreateFlowCustomLogic forDomainApplicationCreateFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainApplicationCreateFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainApplicationCreateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } public DomainCreateFlowCustomLogic forDomainCreateFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainCreateFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainCreateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } public DomainCheckFlowCustomLogic forDomainCheckFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainCheckFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainCheckFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } public DomainInfoFlowCustomLogic forDomainInfoFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainInfoFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainInfoFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } public DomainUpdateFlowCustomLogic forDomainUpdateFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainUpdateFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainUpdateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } public DomainRenewFlowCustomLogic forDomainRenewFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainRenewFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainRenewFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } public DomainDeleteFlowCustomLogic forDomainDeleteFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainDeleteFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainDeleteFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } public DomainPricingCustomLogic forDomainPricing( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new DomainPricingCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new DomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata); } } diff --git a/java/google/registry/flows/custom/CustomLogicModule.java b/java/google/registry/flows/custom/CustomLogicModule.java index 003439e2b..391d3d0f6 100644 --- a/java/google/registry/flows/custom/CustomLogicModule.java +++ b/java/google/registry/flows/custom/CustomLogicModule.java @@ -16,6 +16,7 @@ package google.registry.flows.custom; import dagger.Module; import dagger.Provides; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.model.eppinput.EppInput; @@ -25,49 +26,73 @@ public class CustomLogicModule { @Provides static DomainApplicationCreateFlowCustomLogic provideDomainApplicationCreateFlowCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainApplicationCreateFlow(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainApplicationCreateFlow(eppInput, sessionMetadata, flowMetadata); } @Provides static DomainCreateFlowCustomLogic provideDomainCreateFlowCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainCreateFlow(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainCreateFlow(eppInput, sessionMetadata, flowMetadata); } @Provides static DomainCheckFlowCustomLogic provideDomainCheckFlowCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainCheckFlow(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainCheckFlow(eppInput, sessionMetadata, flowMetadata); } @Provides static DomainInfoFlowCustomLogic provideDomainInfoFlowCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainInfoFlow(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainInfoFlow(eppInput, sessionMetadata, flowMetadata); } @Provides static DomainUpdateFlowCustomLogic provideDomainUpdateFlowCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainUpdateFlow(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainUpdateFlow(eppInput, sessionMetadata, flowMetadata); } @Provides static DomainRenewFlowCustomLogic provideDomainRenewFlowCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainRenewFlow(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainRenewFlow(eppInput, sessionMetadata, flowMetadata); } @Provides static DomainDeleteFlowCustomLogic provideDomainDeleteFlowCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainDeleteFlow(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainDeleteFlow(eppInput, sessionMetadata, flowMetadata); } @Provides static DomainPricingCustomLogic provideDomainPricingCustomLogic( - CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) { - return factory.forDomainPricing(eppInput, sessionMetadata); + CustomLogicFactory factory, + EppInput eppInput, + SessionMetadata sessionMetadata, + FlowMetadata flowMetadata) { + return factory.forDomainPricing(eppInput, sessionMetadata, flowMetadata); } } diff --git a/java/google/registry/flows/custom/DomainApplicationCreateFlowCustomLogic.java b/java/google/registry/flows/custom/DomainApplicationCreateFlowCustomLogic.java index 652d1669b..2694c6335 100644 --- a/java/google/registry/flows/custom/DomainApplicationCreateFlowCustomLogic.java +++ b/java/google/registry/flows/custom/DomainApplicationCreateFlowCustomLogic.java @@ -18,6 +18,7 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainApplicationCreateFlow; import google.registry.model.ImmutableObject; @@ -35,8 +36,8 @@ import google.registry.model.reporting.HistoryEntry; public class DomainApplicationCreateFlowCustomLogic extends BaseFlowCustomLogic { protected DomainApplicationCreateFlowCustomLogic( - EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } /** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */ diff --git a/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java b/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java index 3a204c752..af32cf271 100644 --- a/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java +++ b/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java @@ -19,6 +19,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainCheckFlow; import google.registry.model.ImmutableObject; @@ -34,13 +35,12 @@ import org.joda.time.DateTime; */ public class DomainCheckFlowCustomLogic extends BaseFlowCustomLogic { - protected DomainCheckFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected DomainCheckFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } - /** - * A hook that runs before any validation. This is useful to e.g. add allowable extensions. - */ + /** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */ @SuppressWarnings("unused") public void beforeValidation() throws EppException { // Do nothing. diff --git a/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java b/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java index d547c84cf..cf466f3d9 100644 --- a/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java +++ b/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java @@ -19,6 +19,7 @@ import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainCreateFlow; import google.registry.model.ImmutableObject; @@ -35,8 +36,9 @@ import google.registry.model.reporting.HistoryEntry; */ public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic { - protected DomainCreateFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected DomainCreateFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } /** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */ diff --git a/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java b/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java index f9a45c22f..f269f02a5 100644 --- a/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java +++ b/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java @@ -17,6 +17,7 @@ package google.registry.flows.custom; import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainDeleteFlow; import google.registry.model.ImmutableObject; @@ -33,8 +34,9 @@ import google.registry.model.reporting.HistoryEntry; */ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { - protected DomainDeleteFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected DomainDeleteFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } /** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */ @@ -65,10 +67,9 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { /** * A hook that runs before the response is returned. * - *

This takes the {@link Result.Code} and {@link ResponseExtension}s as input and returns - * them, potentially with modifications. + *

This takes the {@link Result.Code} and {@link ResponseExtension}s as input and returns them, + * potentially with modifications. */ - @SuppressWarnings("unused") public BeforeResponseReturnData beforeResponse(BeforeResponseParameters parameters) throws EppException { @@ -114,7 +115,6 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { public abstract HistoryEntry historyEntry(); - public abstract EntityChanges entityChanges(); public static Builder newBuilder() { @@ -136,7 +136,7 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { public abstract BeforeSaveParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #beforeResponse}. */ + /** A class to encapsulate parameters for a call to {@link #beforeResponse}. */ @AutoValue public abstract static class BeforeResponseParameters extends ImmutableObject { diff --git a/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java b/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java index db95919dd..ce368bfea 100644 --- a/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java +++ b/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java @@ -17,6 +17,7 @@ package google.registry.flows.custom; import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainInfoFlow; import google.registry.model.ImmutableObject; @@ -31,8 +32,9 @@ import google.registry.model.eppoutput.EppResponse.ResponseExtension; */ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic { - protected DomainInfoFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected DomainInfoFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } /** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */ diff --git a/java/google/registry/flows/custom/DomainPricingCustomLogic.java b/java/google/registry/flows/custom/DomainPricingCustomLogic.java index 7955fd707..369ac82fa 100644 --- a/java/google/registry/flows/custom/DomainPricingCustomLogic.java +++ b/java/google/registry/flows/custom/DomainPricingCustomLogic.java @@ -17,6 +17,7 @@ package google.registry.flows.custom; import com.google.auto.value.AutoValue; import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainPricingLogic; import google.registry.flows.domain.FeesAndCredits; @@ -33,8 +34,9 @@ import org.joda.time.DateTime; */ public class DomainPricingCustomLogic extends BaseFlowCustomLogic { - protected DomainPricingCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected DomainPricingCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } /** A hook that customizes the application update price. */ diff --git a/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java b/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java index 18eaf1879..b06723371 100644 --- a/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java +++ b/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java @@ -17,6 +17,7 @@ package google.registry.flows.custom; import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainRenewFlow; import google.registry.model.ImmutableObject; @@ -34,8 +35,9 @@ import org.joda.time.DateTime; */ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { - protected DomainRenewFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected DomainRenewFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } /** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */ diff --git a/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java b/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java index 6964fd861..6ba4bf520 100644 --- a/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java +++ b/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java @@ -16,6 +16,7 @@ package google.registry.flows.custom; import com.google.auto.value.AutoValue; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainUpdateFlow; import google.registry.model.ImmutableObject; @@ -30,8 +31,9 @@ import google.registry.model.reporting.HistoryEntry; */ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic { - protected DomainUpdateFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected DomainUpdateFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } /** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */ @@ -95,7 +97,6 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic { public abstract HistoryEntry historyEntry(); - public abstract EntityChanges entityChanges(); public static Builder newBuilder() { diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java index 76680ce17..dd1811d38 100644 --- a/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/java/google/registry/flows/domain/DomainCreateFlow.java @@ -201,6 +201,7 @@ public class DomainCreateFlow implements TransactionalFlow { validateLaunchCreateNotice(launchCreate.getNotice(), domainLabel, isSuperuser, now); } boolean isSunriseCreate = hasSignedMarks && SUNRISE_STATES.contains(tldState); + String signedMarkId = null; // Superusers can create reserved domains, force creations on domains that require a claims // notice without specifying a claims key, ignore the registry phase, and override blocks on // registering premium domains. @@ -221,12 +222,12 @@ public class DomainCreateFlow implements TransactionalFlow { verifyPremiumNameIsNotBlocked(targetId, now, clientId); verifyNoOpenApplications(now); verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant); - } - String signedMarkId = hasSignedMarks + signedMarkId = 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. ? tmchUtils.verifySignedMarks(launchCreate.getSignedMarks(), domainLabel, now).getId() : null; + } customLogic.afterValidation( DomainCreateFlowCustomLogic.AfterValidationParameters.newBuilder() .setDomainName(domainName) diff --git a/javatests/google/registry/flows/FlowTestCase.java b/javatests/google/registry/flows/FlowTestCase.java index c23df7cc2..546be44f7 100644 --- a/javatests/google/registry/flows/FlowTestCase.java +++ b/javatests/google/registry/flows/FlowTestCase.java @@ -308,6 +308,11 @@ public abstract class FlowTestCase extends ShardableTestCase { return runFlow(CommitMode.LIVE, UserPrivileges.NORMAL); } + /** Shortcut to call {@link #runFlow(CommitMode, UserPrivileges)} as super user and live run. */ + public EppOutput runFlowAsSuperuser() throws Exception { + return runFlow(CommitMode.LIVE, UserPrivileges.SUPERUSER); + } + /** Run a flow, marshal the result to EPP, and assert that the output is as expected. */ public EppOutput runFlowAssertResponse( CommitMode commitMode, UserPrivileges userPrivileges, String xml, String... ignoredPaths) diff --git a/javatests/google/registry/flows/custom/TestCustomLogicFactory.java b/javatests/google/registry/flows/custom/TestCustomLogicFactory.java index f2fc55dd0..31285e80b 100644 --- a/javatests/google/registry/flows/custom/TestCustomLogicFactory.java +++ b/javatests/google/registry/flows/custom/TestCustomLogicFactory.java @@ -14,6 +14,7 @@ package google.registry.flows.custom; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.model.eppinput.EppInput; @@ -22,13 +23,13 @@ public class TestCustomLogicFactory extends CustomLogicFactory { @Override public DomainCreateFlowCustomLogic forDomainCreateFlow( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new TestDomainCreateFlowCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new TestDomainCreateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata); } @Override public DomainPricingCustomLogic forDomainPricing( - EppInput eppInput, SessionMetadata sessionMetadata) { - return new TestDomainPricingCustomLogic(eppInput, sessionMetadata); + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + return new TestDomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata); } } diff --git a/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java b/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java index 00cf5cf82..89b4e423b 100644 --- a/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java +++ b/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java @@ -17,6 +17,7 @@ package google.registry.flows.custom; import static google.registry.model.ofy.ObjectifyService.ofy; import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.model.eppinput.EppInput; import google.registry.model.poll.PollMessage; @@ -24,8 +25,9 @@ import google.registry.model.poll.PollMessage; /** A class to customize {@link DomainCreateFlowCustomLogic} for testing. */ public class TestDomainCreateFlowCustomLogic extends DomainCreateFlowCustomLogic { - protected TestDomainCreateFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected TestDomainCreateFlowCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } @Override diff --git a/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java b/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java index 828f7973c..19648c239 100644 --- a/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java +++ b/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java @@ -14,8 +14,8 @@ package google.registry.flows.custom; - import google.registry.flows.EppException; +import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainPricingLogic; import google.registry.flows.domain.FeesAndCredits; @@ -32,8 +32,9 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic { private static final BigDecimal ONE_HUNDRED_BUCKS = Money.of(CurrencyUnit.USD, 100).getAmount(); - protected TestDomainPricingCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) { - super(eppInput, sessionMetadata); + protected TestDomainPricingCustomLogic( + EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) { + super(eppInput, sessionMetadata, flowMetadata); } @Override diff --git a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java index 682abcd63..6dd8451a5 100644 --- a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java @@ -213,11 +213,6 @@ public class DomainAllocateFlowTest } } - private void runFlowAsSuperuser() throws Exception { - assertTransactionalFlow(true); - runFlow(CommitMode.LIVE, UserPrivileges.SUPERUSER); - } - @Test public void testSuccess() throws Exception { setupDomainApplication("tld", TldState.QUIET_PERIOD); diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index fa60e3436..a02281662 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -436,6 +436,18 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase + + + + + example.tld + 2 + + ns1.example.net + ns2.example.net + + jd1234 + sh8013 + sh8013 + + 2fooBAR + + + + + + open + +PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHNtZDpzaWduZWRNYXJrIHhtbG5zOnNtZD0idXJuOmlldGY6cGFyYW1zOnhtbDpuczpzaWduZWRNYXJrLTEuMCIgaWQ9Il8zOGFjNTg2ZC05OTg5LTQ4MTctYjcwOC1kOG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