Return more informative errors when signed mark is invalid at this time

A "mark" tells us that the holder owns the trademark for a given domain name. It is signed for authentication.

If the signature's certificate is either "not yet valid" or "expired", we return explicit errors to that effect.

But in addition to the signature's certificate, the mark itself might not be valid yet or already expired. Right now if that happens - we return an error saying "the mark doesn't match the domain name".

That is wrong - as the mark can match the domain name, just be expired. Returning "the mark doesn't match the domain name" in that case is misleading.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190069976
This commit is contained in:
guyben 2018-03-22 08:39:47 -07:00 committed by jianglai
parent 27dedf316b
commit b5ae37c5cc
6 changed files with 61 additions and 7 deletions

View file

@ -68,6 +68,8 @@ import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.domain.DomainCreateFlow.DomainHasOpenApplicationsException;
import google.registry.flows.domain.DomainCreateFlow.MustHaveSignedMarksInCurrentPhaseException;
import google.registry.flows.domain.DomainCreateFlow.NoGeneralRegistrationsInCurrentPhaseException;
import google.registry.flows.domain.DomainFlowTmchUtils.FoundMarkExpiredException;
import google.registry.flows.domain.DomainFlowTmchUtils.FoundMarkNotYetValidException;
import google.registry.flows.domain.DomainFlowTmchUtils.NoMarksFoundMatchingDomainException;
import google.registry.flows.domain.DomainFlowUtils.AcceptedTooLongAgoException;
import google.registry.flows.domain.DomainFlowUtils.BadDomainNameCharacterException;
@ -1820,6 +1822,28 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFail_startDateSunriseRegistration_markNotYetValid() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
// If we move now back in time a bit, the mark will not have gone into effect yet.
clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1));
setEppInput("domain_create_registration_start_date_sunrise_encoded_signed_mark.xml");
persistContactsAndHosts();
EppException thrown = assertThrows(FoundMarkNotYetValidException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFail_startDateSunriseRegistration_markExpired() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
// Move time forward to the mark expiration time.
clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z"));
setEppInput("domain_create_registration_start_date_sunrise_encoded_signed_mark.xml");
persistContactsAndHosts();
EppException thrown = assertThrows(FoundMarkExpiredException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_startDateSunriseRegistration_withClaimsNotice() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);