mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Add base AllocationToken validation logic for domain checks
Next up is adding custom logic so that the results of these checks can be more meaningful. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=181660956
This commit is contained in:
parent
716ba726fc
commit
5726f1dc4e
12 changed files with 266 additions and 38 deletions
|
@ -39,6 +39,8 @@ import google.registry.model.domain.launch.LaunchCheckExtension;
|
|||
import google.registry.model.domain.launch.LaunchCheckResponseExtension;
|
||||
import google.registry.model.domain.launch.LaunchCheckResponseExtension.LaunchCheck;
|
||||
import google.registry.model.domain.launch.LaunchCheckResponseExtension.LaunchCheckName;
|
||||
import google.registry.model.domain.token.AllocationTokenExtension;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import google.registry.model.registry.Registry;
|
||||
|
@ -61,11 +63,13 @@ import org.joda.time.DateTime;
|
|||
* @error {@link DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link DomainFlowUtils.TldDoesNotExistException}
|
||||
* @error {@link DomainClaimsCheckNotAllowedInSunrise}
|
||||
* @error {@link DomainClaimsCheckNotAllowedWithAllocationTokens}
|
||||
*/
|
||||
@ReportingSpec(ActivityReportField.DOMAIN_CHECK) // Claims check is a special domain check.
|
||||
public final class DomainClaimsCheckFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
|
@ -78,9 +82,12 @@ public final class DomainClaimsCheckFlow implements Flow {
|
|||
|
||||
@Override
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(LaunchCheckExtension.class);
|
||||
extensionManager.register(LaunchCheckExtension.class, AllocationTokenExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
if (eppInput.getSingleExtension(AllocationTokenExtension.class) != null) {
|
||||
throw new DomainClaimsCheckNotAllowedWithAllocationTokens();
|
||||
}
|
||||
List<String> targetIds = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(targetIds, maxChecks);
|
||||
Set<String> seenTlds = new HashSet<>();
|
||||
|
@ -118,4 +125,11 @@ public final class DomainClaimsCheckFlow implements Flow {
|
|||
super("Claims checks are not allowed during sunrise");
|
||||
}
|
||||
}
|
||||
|
||||
/** Claims checks are not allowed with allocation tokens. */
|
||||
static class DomainClaimsCheckNotAllowedWithAllocationTokens extends CommandUseErrorException {
|
||||
public DomainClaimsCheckNotAllowedWithAllocationTokens() {
|
||||
super("Claims checks are not allowed with allocation tokens");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue