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:
mcilwain 2016-12-01 15:14:55 -08:00 committed by Ben McIlwain
parent 59f4984083
commit 3740171bbf
7 changed files with 79 additions and 43 deletions

View file

@ -366,18 +366,18 @@ public class DomainFlowUtils {
}
}
static void verifyNotReserved(
InternetDomainName domainName, boolean isSunriseApplication) throws EppException {
if (isReserved(domainName, isSunriseApplication)) {
static void verifyNotReserved(InternetDomainName domainName, boolean isSunrise)
throws EppException {
if (isReserved(domainName, isSunrise)) {
throw new DomainReservedException(domainName.toString());
}
}
private static boolean isReserved(InternetDomainName domainName, boolean inSunrise) {
private static boolean isReserved(InternetDomainName domainName, boolean isSunrise) {
ReservationType type = getReservationType(domainName);
return type == ReservationType.FULLY_BLOCKED
|| type == ReservationType.RESERVED_FOR_ANCHOR_TENANT
|| (TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISE.contains(type) && !inSunrise);
|| (TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISE.contains(type) && !isSunrise);
}
/** Returns an enum that encodes how and when this name is reserved in the current tld. */