mirror of
https://github.com/google/nomulus
synced 2026-01-09 07:33:42 +00:00
Change @Auth to an AutoValue, and created a set of predefined Auths
We want to be safer and more explicit about the authentication needed by the many actions that exist. As such, we make the 'auth' parameter required in @Action (so it's always clear who can run a specific action) and we replace the @Auth with an enum so that only pre-approved configurations that are aptly named and documented can be used. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=162210306
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -27,6 +27,7 @@ import google.registry.model.rde.RdeNamingUtils;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.RequestParameters;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -52,7 +53,12 @@ import org.joda.time.DateTime;
|
||||
*
|
||||
* @see <a href="http://newgtlds.icann.org/en/applicants/agb/agreement-approved-09jan14-en.htm">Registry Agreement</a>
|
||||
*/
|
||||
@Action(path = BrdaCopyAction.PATH, method = POST, automaticallyPrintOk = true)
|
||||
@Action(
|
||||
path = BrdaCopyAction.PATH,
|
||||
method = POST,
|
||||
automaticallyPrintOk = true,
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public final class BrdaCopyAction implements Runnable {
|
||||
|
||||
static final String PATH = "/_dr/task/brdaCopy";
|
||||
|
||||
@@ -36,6 +36,7 @@ import google.registry.request.HttpException.NoContentException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.RequestParameters;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -48,7 +49,11 @@ import org.joda.time.Duration;
|
||||
/**
|
||||
* Action that uploads a small XML RDE report to ICANN after {@link RdeUploadAction} has finished.
|
||||
*/
|
||||
@Action(path = RdeReportAction.PATH, method = POST)
|
||||
@Action(
|
||||
path = RdeReportAction.PATH,
|
||||
method = POST,
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public final class RdeReportAction implements Runnable, EscrowTask {
|
||||
|
||||
static final String PATH = "/_dr/task/rdeReport";
|
||||
|
||||
@@ -45,6 +45,7 @@ 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.util.Clock;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import javax.inject.Inject;
|
||||
@@ -187,7 +188,8 @@ import org.joda.time.Duration;
|
||||
*/
|
||||
@Action(
|
||||
path = RdeStagingAction.PATH,
|
||||
method = {GET, POST}
|
||||
method = {GET, POST},
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public final class RdeStagingAction implements Runnable {
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import google.registry.request.HttpException.ServiceUnavailableException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.RequestParameters;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.util.Retrier;
|
||||
@@ -77,7 +78,11 @@ import org.joda.time.Duration;
|
||||
* <p>Once this action completes, it rolls the cursor forward a day and triggers
|
||||
* {@link RdeReportAction}.
|
||||
*/
|
||||
@Action(path = RdeUploadAction.PATH, method = POST)
|
||||
@Action(
|
||||
path = RdeUploadAction.PATH,
|
||||
method = POST,
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public final class RdeUploadAction implements Runnable, EscrowTask {
|
||||
|
||||
static final String PATH = "/_dr/task/rdeUpload";
|
||||
|
||||
@@ -16,6 +16,7 @@ java_library(
|
||||
"//java/google/registry/model",
|
||||
"//java/google/registry/pricing",
|
||||
"//java/google/registry/request",
|
||||
"//java/google/registry/request/auth",
|
||||
"//java/google/registry/util",
|
||||
"//java/google/registry/xjc",
|
||||
"//java/google/registry/xml",
|
||||
|
||||
@@ -33,6 +33,7 @@ import google.registry.model.contact.ContactResource;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.util.SystemClock;
|
||||
import google.registry.xjc.JaxbFragment;
|
||||
@@ -45,7 +46,10 @@ import javax.inject.Inject;
|
||||
*
|
||||
* <p>Specify the escrow file to import with the "path" parameter.
|
||||
*/
|
||||
@Action(path = "/_dr/task/importRdeContacts")
|
||||
@Action(
|
||||
path = "/_dr/task/importRdeContacts",
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public class RdeContactImportAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
|
||||
@@ -50,6 +50,7 @@ import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.util.SystemClock;
|
||||
import google.registry.xjc.JaxbFragment;
|
||||
@@ -63,7 +64,10 @@ import org.joda.money.Money;
|
||||
*
|
||||
* <p>Specify the escrow file to import with the "path" parameter.
|
||||
*/
|
||||
@Action(path = "/_dr/task/importRdeDomains")
|
||||
@Action(
|
||||
path = "/_dr/task/importRdeDomains",
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public class RdeDomainImportAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
|
||||
@@ -33,6 +33,7 @@ import google.registry.model.host.HostResource;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.util.SystemClock;
|
||||
import google.registry.xjc.JaxbFragment;
|
||||
@@ -45,7 +46,10 @@ import javax.inject.Inject;
|
||||
*
|
||||
* <p>Specify the escrow file to import with the "path" parameter.
|
||||
*/
|
||||
@Action(path = "/_dr/task/importRdeHosts")
|
||||
@Action(
|
||||
path = "/_dr/task/importRdeHosts",
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public class RdeHostImportAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
|
||||
@@ -33,6 +33,7 @@ import google.registry.model.host.HostResource;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.xjc.JaxbFragment;
|
||||
import google.registry.xjc.rdehost.XjcRdeHost;
|
||||
@@ -51,7 +52,10 @@ import org.joda.time.DateTime;
|
||||
*
|
||||
* <p>Specify the escrow file to import with the "path" parameter.
|
||||
*/
|
||||
@Action(path = "/_dr/task/linkRdeHosts")
|
||||
@Action(
|
||||
path = "/_dr/task/linkRdeHosts",
|
||||
auth = Auth.AUTH_INTERNAL_ONLY
|
||||
)
|
||||
public class RdeHostLinkAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
|
||||
Reference in New Issue
Block a user