From 7f2821cd7e88e93d8640f8c06bfc38f3fd04361b Mon Sep 17 00:00:00 2001 From: nickfelt Date: Mon, 1 May 2017 14:56:56 -0700 Subject: [PATCH] Open up RdeStagingAction @Action settings to support tool access This change means that RdeStagingAction now accepts POST requests and supports the API auth method, which is needed for the new GenerateEscrowDepositCommand (as of [] to be able to invoke the action in manual mode. Note that this shouldn't affect the cron setting that invokes it currently, which are GET requests with INTERNAL auth. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154764870 --- java/google/registry/rde/BUILD | 1 + java/google/registry/rde/RdeStagingAction.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/java/google/registry/rde/BUILD b/java/google/registry/rde/BUILD index a0156c635..d3d68ca97 100644 --- a/java/google/registry/rde/BUILD +++ b/java/google/registry/rde/BUILD @@ -15,6 +15,7 @@ java_library( "//java/google/registry/mapreduce/inputs", "//java/google/registry/model", "//java/google/registry/request", + "//java/google/registry/request/auth", "//java/google/registry/tldconfig/idn", "//java/google/registry/util", "//java/google/registry/xjc", diff --git a/java/google/registry/rde/RdeStagingAction.java b/java/google/registry/rde/RdeStagingAction.java index a941e5301..52481aa36 100644 --- a/java/google/registry/rde/RdeStagingAction.java +++ b/java/google/registry/rde/RdeStagingAction.java @@ -14,6 +14,8 @@ package google.registry.rde; +import static google.registry.request.Action.Method.GET; +import static google.registry.request.Action.Method.POST; import static google.registry.util.PipelineUtils.createJobPath; import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT; @@ -41,6 +43,8 @@ import google.registry.request.HttpException.BadRequestException; import google.registry.request.Parameter; import google.registry.request.RequestParameters; import google.registry.request.Response; +import google.registry.request.auth.Auth; +import google.registry.request.auth.AuthLevel; import google.registry.util.Clock; import google.registry.util.FormattingLogger; import javax.inject.Inject; @@ -181,7 +185,15 @@ import org.joda.time.Duration; * @see Registry Data Escrow Specification * @see Domain Name Registration Data Objects Mapping */ -@Action(path = RdeStagingAction.PATH) +@Action( + path = RdeStagingAction.PATH, + method = {GET, POST}, + auth = + @Auth( + methods = {Auth.AuthMethod.INTERNAL, Auth.AuthMethod.API}, + minimumLevel = AuthLevel.APP, + userPolicy = Auth.UserPolicy.ADMIN + )) public final class RdeStagingAction implements Runnable { public static final String PATH = "/_dr/task/rdeStaging";