Flatten the domain info flows

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133955573
This commit is contained in:
cgoldfeder 2016-09-22 08:20:06 -07:00 committed by Ben McIlwain
parent 1b34f1e326
commit a69fc769af
6 changed files with 157 additions and 66 deletions

View file

@ -56,6 +56,7 @@ import google.registry.model.billing.BillingEvent.Reason;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.domain.DesignatedContact.Type;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand.CreateOrUpdate;
import google.registry.model.domain.DomainCommand.InvalidReferencesException;
@ -71,9 +72,11 @@ import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.launch.LaunchExtension;
import google.registry.model.domain.launch.LaunchPhase;
import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.domain.secdns.SecDnsInfoExtension;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppinput.ResourceCommand.SingleResourceCommand;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import google.registry.model.host.HostResource;
import google.registry.model.mark.Mark;
import google.registry.model.mark.ProtectedMark;
@ -385,6 +388,14 @@ public class DomainFlowUtils {
}
}
/** Verifies that an application's domain name matches the target id (from a command). */
static void verifyApplicationDomainMatchesTargetId(
DomainApplication application, String targetId) throws EppException {
if (!application.getFullyQualifiedDomainName().equals(targetId)) {
throw new ApplicationDomainNameMismatchException();
}
}
/**
* Verifies that a domain name is allowed to be delegated to the given client id. The only case
* where it would not be allowed is if domain name is premium, and premium names are blocked by
@ -738,6 +749,21 @@ public class DomainFlowUtils {
.build();
}
/**
* Adds a secDns extension to a list if the given set of dsData is non-empty.
*
* <p>According to RFC 5910 section 2, we should only return this if the client specified the
* "urn:ietf:params:xml:ns:secDNS-1.1" when logging in. However, this is a "SHOULD" not a "MUST"
* and we are going to ignore it; clients who don't care about secDNS can just ignore it.
*/
static void addSecDnsExtensionIfPresent(
ImmutableList.Builder<ResponseExtension> extensions,
ImmutableSet<DelegationSignerData> dsData) {
if (!dsData.isEmpty()) {
extensions.add(SecDnsInfoExtension.create(dsData));
}
}
/** Encoded signed marks must use base64 encoding. */
static class Base64RequiredForEncodedSignedMarksException
extends ParameterValuePolicyErrorException {