mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Add FlowMetadata (containing isSuperuser) to custom flow logic
This also bypasses signed mark validation during domain creation if the flow is being executed as superuser. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145435268
This commit is contained in:
parent
d5160213e5
commit
f3388326d6
21 changed files with 213 additions and 74 deletions
38
java/google/registry/flows/FlowMetadata.java
Normal file
38
java/google/registry/flows/FlowMetadata.java
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -259,6 +259,11 @@ public class FlowModule {
|
||||||
.setResultFromCode(Result.Code.SUCCESS); // Default to success.
|
.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. */
|
/** Wrapper class to carry an {@link EppException} to the calling code. */
|
||||||
static class EppExceptionInProviderException extends RuntimeException {
|
static class EppExceptionInProviderException extends RuntimeException {
|
||||||
EppExceptionInProviderException(EppException exception) {
|
EppExceptionInProviderException(EppException exception) {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
package google.registry.flows.custom;
|
package google.registry.flows.custom;
|
||||||
|
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
|
|
||||||
|
@ -25,10 +26,13 @@ public abstract class BaseFlowCustomLogic {
|
||||||
|
|
||||||
private final EppInput eppInput;
|
private final EppInput eppInput;
|
||||||
private final SessionMetadata sessionMetadata;
|
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.eppInput = eppInput;
|
||||||
this.sessionMetadata = sessionMetadata;
|
this.sessionMetadata = sessionMetadata;
|
||||||
|
this.flowMetadata = flowMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EppInput getEppInput() {
|
protected EppInput getEppInput() {
|
||||||
|
@ -38,4 +42,8 @@ public abstract class BaseFlowCustomLogic {
|
||||||
protected SessionMetadata getSessionMetadata() {
|
protected SessionMetadata getSessionMetadata() {
|
||||||
return sessionMetadata;
|
return sessionMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected FlowMetadata getFlowMetadata() {
|
||||||
|
return flowMetadata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
package google.registry.flows.custom;
|
package google.registry.flows.custom;
|
||||||
|
|
||||||
import google.registry.config.RegistryConfig.ConfigModule;
|
import google.registry.config.RegistryConfig.ConfigModule;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
|
|
||||||
|
@ -32,42 +33,42 @@ import google.registry.model.eppinput.EppInput;
|
||||||
public class CustomLogicFactory {
|
public class CustomLogicFactory {
|
||||||
|
|
||||||
public DomainApplicationCreateFlowCustomLogic forDomainApplicationCreateFlow(
|
public DomainApplicationCreateFlowCustomLogic forDomainApplicationCreateFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainApplicationCreateFlowCustomLogic(eppInput, sessionMetadata);
|
return new DomainApplicationCreateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainCreateFlowCustomLogic forDomainCreateFlow(
|
public DomainCreateFlowCustomLogic forDomainCreateFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainCreateFlowCustomLogic(eppInput, sessionMetadata);
|
return new DomainCreateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainCheckFlowCustomLogic forDomainCheckFlow(
|
public DomainCheckFlowCustomLogic forDomainCheckFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainCheckFlowCustomLogic(eppInput, sessionMetadata);
|
return new DomainCheckFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainInfoFlowCustomLogic forDomainInfoFlow(
|
public DomainInfoFlowCustomLogic forDomainInfoFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainInfoFlowCustomLogic(eppInput, sessionMetadata);
|
return new DomainInfoFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainUpdateFlowCustomLogic forDomainUpdateFlow(
|
public DomainUpdateFlowCustomLogic forDomainUpdateFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainUpdateFlowCustomLogic(eppInput, sessionMetadata);
|
return new DomainUpdateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainRenewFlowCustomLogic forDomainRenewFlow(
|
public DomainRenewFlowCustomLogic forDomainRenewFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainRenewFlowCustomLogic(eppInput, sessionMetadata);
|
return new DomainRenewFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainDeleteFlowCustomLogic forDomainDeleteFlow(
|
public DomainDeleteFlowCustomLogic forDomainDeleteFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainDeleteFlowCustomLogic(eppInput, sessionMetadata);
|
return new DomainDeleteFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DomainPricingCustomLogic forDomainPricing(
|
public DomainPricingCustomLogic forDomainPricing(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new DomainPricingCustomLogic(eppInput, sessionMetadata);
|
return new DomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ package google.registry.flows.custom;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
|
|
||||||
|
@ -25,49 +26,73 @@ public class CustomLogicModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainApplicationCreateFlowCustomLogic provideDomainApplicationCreateFlowCustomLogic(
|
static DomainApplicationCreateFlowCustomLogic provideDomainApplicationCreateFlowCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainApplicationCreateFlow(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainApplicationCreateFlow(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainCreateFlowCustomLogic provideDomainCreateFlowCustomLogic(
|
static DomainCreateFlowCustomLogic provideDomainCreateFlowCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainCreateFlow(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainCreateFlow(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainCheckFlowCustomLogic provideDomainCheckFlowCustomLogic(
|
static DomainCheckFlowCustomLogic provideDomainCheckFlowCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainCheckFlow(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainCheckFlow(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainInfoFlowCustomLogic provideDomainInfoFlowCustomLogic(
|
static DomainInfoFlowCustomLogic provideDomainInfoFlowCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainInfoFlow(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainInfoFlow(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainUpdateFlowCustomLogic provideDomainUpdateFlowCustomLogic(
|
static DomainUpdateFlowCustomLogic provideDomainUpdateFlowCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainUpdateFlow(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainUpdateFlow(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainRenewFlowCustomLogic provideDomainRenewFlowCustomLogic(
|
static DomainRenewFlowCustomLogic provideDomainRenewFlowCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainRenewFlow(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainRenewFlow(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainDeleteFlowCustomLogic provideDomainDeleteFlowCustomLogic(
|
static DomainDeleteFlowCustomLogic provideDomainDeleteFlowCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainDeleteFlow(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainDeleteFlow(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
static DomainPricingCustomLogic provideDomainPricingCustomLogic(
|
static DomainPricingCustomLogic provideDomainPricingCustomLogic(
|
||||||
CustomLogicFactory factory, EppInput eppInput, SessionMetadata sessionMetadata) {
|
CustomLogicFactory factory,
|
||||||
return factory.forDomainPricing(eppInput, sessionMetadata);
|
EppInput eppInput,
|
||||||
|
SessionMetadata sessionMetadata,
|
||||||
|
FlowMetadata flowMetadata) {
|
||||||
|
return factory.forDomainPricing(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.google.auto.value.AutoValue;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainApplicationCreateFlow;
|
import google.registry.flows.domain.DomainApplicationCreateFlow;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
|
@ -35,8 +36,8 @@ import google.registry.model.reporting.HistoryEntry;
|
||||||
public class DomainApplicationCreateFlowCustomLogic extends BaseFlowCustomLogic {
|
public class DomainApplicationCreateFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainApplicationCreateFlowCustomLogic(
|
protected DomainApplicationCreateFlowCustomLogic(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
super(eppInput, sessionMetadata);
|
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. */
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainCheckFlow;
|
import google.registry.flows.domain.DomainCheckFlow;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
|
@ -34,13 +35,12 @@ import org.joda.time.DateTime;
|
||||||
*/
|
*/
|
||||||
public class DomainCheckFlowCustomLogic extends BaseFlowCustomLogic {
|
public class DomainCheckFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainCheckFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected DomainCheckFlowCustomLogic(
|
||||||
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. */
|
||||||
* A hook that runs before any validation. This is useful to e.g. add allowable extensions.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void beforeValidation() throws EppException {
|
public void beforeValidation() throws EppException {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainCreateFlow;
|
import google.registry.flows.domain.DomainCreateFlow;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
|
@ -35,8 +36,9 @@ import google.registry.model.reporting.HistoryEntry;
|
||||||
*/
|
*/
|
||||||
public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic {
|
public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainCreateFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected DomainCreateFlowCustomLogic(
|
||||||
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. */
|
/** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.flows.custom;
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainDeleteFlow;
|
import google.registry.flows.domain.DomainDeleteFlow;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
|
@ -33,8 +34,9 @@ import google.registry.model.reporting.HistoryEntry;
|
||||||
*/
|
*/
|
||||||
public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
|
public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainDeleteFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected DomainDeleteFlowCustomLogic(
|
||||||
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. */
|
/** 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.
|
* A hook that runs before the response is returned.
|
||||||
*
|
*
|
||||||
* <p>This takes the {@link Result.Code} and {@link ResponseExtension}s as input and returns
|
* <p>This takes the {@link Result.Code} and {@link ResponseExtension}s as input and returns them,
|
||||||
* them, potentially with modifications.
|
* potentially with modifications.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public BeforeResponseReturnData beforeResponse(BeforeResponseParameters parameters)
|
public BeforeResponseReturnData beforeResponse(BeforeResponseParameters parameters)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
|
@ -114,7 +115,6 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
public abstract HistoryEntry historyEntry();
|
public abstract HistoryEntry historyEntry();
|
||||||
|
|
||||||
|
|
||||||
public abstract EntityChanges entityChanges();
|
public abstract EntityChanges entityChanges();
|
||||||
|
|
||||||
public static Builder newBuilder() {
|
public static Builder newBuilder() {
|
||||||
|
@ -136,7 +136,7 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
public abstract BeforeSaveParameters build();
|
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
|
@AutoValue
|
||||||
public abstract static class BeforeResponseParameters extends ImmutableObject {
|
public abstract static class BeforeResponseParameters extends ImmutableObject {
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.flows.custom;
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainInfoFlow;
|
import google.registry.flows.domain.DomainInfoFlow;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
|
@ -31,8 +32,9 @@ import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||||
*/
|
*/
|
||||||
public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
|
public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainInfoFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected DomainInfoFlowCustomLogic(
|
||||||
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. */
|
/** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.flows.custom;
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
import com.google.common.net.InternetDomainName;
|
import com.google.common.net.InternetDomainName;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainPricingLogic;
|
import google.registry.flows.domain.DomainPricingLogic;
|
||||||
import google.registry.flows.domain.FeesAndCredits;
|
import google.registry.flows.domain.FeesAndCredits;
|
||||||
|
@ -33,8 +34,9 @@ import org.joda.time.DateTime;
|
||||||
*/
|
*/
|
||||||
public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainPricingCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected DomainPricingCustomLogic(
|
||||||
super(eppInput, sessionMetadata);
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
|
super(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A hook that customizes the application update price. */
|
/** A hook that customizes the application update price. */
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.flows.custom;
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainRenewFlow;
|
import google.registry.flows.domain.DomainRenewFlow;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
|
@ -34,8 +35,9 @@ import org.joda.time.DateTime;
|
||||||
*/
|
*/
|
||||||
public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
|
public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainRenewFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected DomainRenewFlowCustomLogic(
|
||||||
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. */
|
/** A hook that runs before any validation. This is useful to e.g. add allowable extensions. */
|
||||||
|
|
|
@ -16,6 +16,7 @@ package google.registry.flows.custom;
|
||||||
|
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainUpdateFlow;
|
import google.registry.flows.domain.DomainUpdateFlow;
|
||||||
import google.registry.model.ImmutableObject;
|
import google.registry.model.ImmutableObject;
|
||||||
|
@ -30,8 +31,9 @@ import google.registry.model.reporting.HistoryEntry;
|
||||||
*/
|
*/
|
||||||
public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic {
|
public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic {
|
||||||
|
|
||||||
protected DomainUpdateFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected DomainUpdateFlowCustomLogic(
|
||||||
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. */
|
/** 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 HistoryEntry historyEntry();
|
||||||
|
|
||||||
|
|
||||||
public abstract EntityChanges entityChanges();
|
public abstract EntityChanges entityChanges();
|
||||||
|
|
||||||
public static Builder newBuilder() {
|
public static Builder newBuilder() {
|
||||||
|
|
|
@ -201,6 +201,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
||||||
validateLaunchCreateNotice(launchCreate.getNotice(), domainLabel, isSuperuser, now);
|
validateLaunchCreateNotice(launchCreate.getNotice(), domainLabel, isSuperuser, now);
|
||||||
}
|
}
|
||||||
boolean isSunriseCreate = hasSignedMarks && SUNRISE_STATES.contains(tldState);
|
boolean isSunriseCreate = hasSignedMarks && SUNRISE_STATES.contains(tldState);
|
||||||
|
String signedMarkId = null;
|
||||||
// Superusers can create reserved domains, force creations on domains that require a claims
|
// 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
|
// notice without specifying a claims key, ignore the registry phase, and override blocks on
|
||||||
// registering premium domains.
|
// registering premium domains.
|
||||||
|
@ -221,12 +222,12 @@ public class DomainCreateFlow implements TransactionalFlow {
|
||||||
verifyPremiumNameIsNotBlocked(targetId, now, clientId);
|
verifyPremiumNameIsNotBlocked(targetId, now, clientId);
|
||||||
verifyNoOpenApplications(now);
|
verifyNoOpenApplications(now);
|
||||||
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant);
|
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant);
|
||||||
}
|
signedMarkId = hasSignedMarks
|
||||||
String signedMarkId = hasSignedMarks
|
|
||||||
// If a signed mark was provided, then it must match the desired domain label. Get the mark
|
// 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.
|
// at this point so that we can verify it before the "after validation" extension point.
|
||||||
? tmchUtils.verifySignedMarks(launchCreate.getSignedMarks(), domainLabel, now).getId()
|
? tmchUtils.verifySignedMarks(launchCreate.getSignedMarks(), domainLabel, now).getId()
|
||||||
: null;
|
: null;
|
||||||
|
}
|
||||||
customLogic.afterValidation(
|
customLogic.afterValidation(
|
||||||
DomainCreateFlowCustomLogic.AfterValidationParameters.newBuilder()
|
DomainCreateFlowCustomLogic.AfterValidationParameters.newBuilder()
|
||||||
.setDomainName(domainName)
|
.setDomainName(domainName)
|
||||||
|
|
|
@ -308,6 +308,11 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
||||||
return runFlow(CommitMode.LIVE, UserPrivileges.NORMAL);
|
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. */
|
/** Run a flow, marshal the result to EPP, and assert that the output is as expected. */
|
||||||
public EppOutput runFlowAssertResponse(
|
public EppOutput runFlowAssertResponse(
|
||||||
CommitMode commitMode, UserPrivileges userPrivileges, String xml, String... ignoredPaths)
|
CommitMode commitMode, UserPrivileges userPrivileges, String xml, String... ignoredPaths)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
package google.registry.flows.custom;
|
package google.registry.flows.custom;
|
||||||
|
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
|
|
||||||
|
@ -22,13 +23,13 @@ public class TestCustomLogicFactory extends CustomLogicFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainCreateFlowCustomLogic forDomainCreateFlow(
|
public DomainCreateFlowCustomLogic forDomainCreateFlow(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new TestDomainCreateFlowCustomLogic(eppInput, sessionMetadata);
|
return new TestDomainCreateFlowCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainPricingCustomLogic forDomainPricing(
|
public DomainPricingCustomLogic forDomainPricing(
|
||||||
EppInput eppInput, SessionMetadata sessionMetadata) {
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
return new TestDomainPricingCustomLogic(eppInput, sessionMetadata);
|
return new TestDomainPricingCustomLogic(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.flows.custom;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
|
@ -24,8 +25,9 @@ import google.registry.model.poll.PollMessage;
|
||||||
/** A class to customize {@link DomainCreateFlowCustomLogic} for testing. */
|
/** A class to customize {@link DomainCreateFlowCustomLogic} for testing. */
|
||||||
public class TestDomainCreateFlowCustomLogic extends DomainCreateFlowCustomLogic {
|
public class TestDomainCreateFlowCustomLogic extends DomainCreateFlowCustomLogic {
|
||||||
|
|
||||||
protected TestDomainCreateFlowCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected TestDomainCreateFlowCustomLogic(
|
||||||
super(eppInput, sessionMetadata);
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
|
super(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
package google.registry.flows.custom;
|
package google.registry.flows.custom;
|
||||||
|
|
||||||
|
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowMetadata;
|
||||||
import google.registry.flows.SessionMetadata;
|
import google.registry.flows.SessionMetadata;
|
||||||
import google.registry.flows.domain.DomainPricingLogic;
|
import google.registry.flows.domain.DomainPricingLogic;
|
||||||
import google.registry.flows.domain.FeesAndCredits;
|
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();
|
private static final BigDecimal ONE_HUNDRED_BUCKS = Money.of(CurrencyUnit.USD, 100).getAmount();
|
||||||
|
|
||||||
protected TestDomainPricingCustomLogic(EppInput eppInput, SessionMetadata sessionMetadata) {
|
protected TestDomainPricingCustomLogic(
|
||||||
super(eppInput, sessionMetadata);
|
EppInput eppInput, SessionMetadata sessionMetadata, FlowMetadata flowMetadata) {
|
||||||
|
super(eppInput, sessionMetadata, flowMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -213,11 +213,6 @@ public class DomainAllocateFlowTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runFlowAsSuperuser() throws Exception {
|
|
||||||
assertTransactionalFlow(true);
|
|
||||||
runFlow(CommitMode.LIVE, UserPrivileges.SUPERUSER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess() throws Exception {
|
public void testSuccess() throws Exception {
|
||||||
setupDomainApplication("tld", TldState.QUIET_PERIOD);
|
setupDomainApplication("tld", TldState.QUIET_PERIOD);
|
||||||
|
|
|
@ -436,6 +436,18 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
assertNoLordn("0000001761376042759136-65535", null);
|
assertNoLordn("0000001761376042759136-65535", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuccess_generalAvailability_ignoresEncodedSignedMarkMismatch() throws Exception {
|
||||||
|
createTld("tld", TldState.GENERAL_AVAILABILITY);
|
||||||
|
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
|
||||||
|
setEppInput("domain_create_registration_encoded_signed_mark_mismatched_label.xml");
|
||||||
|
eppRequestSource = EppRequestSource.TOOL; // Only tools can pass in metadata.
|
||||||
|
persistContactsAndHosts();
|
||||||
|
runFlowAsSuperuser();
|
||||||
|
assertSuccessfulCreate("tld", true);
|
||||||
|
assertNoLordn();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_fee_v06() throws Exception {
|
public void testSuccess_fee_v06() throws Exception {
|
||||||
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
|
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue