mirror of
https://github.com/google/nomulus
synced 2026-08-20 06:06:11 +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:
@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.HttpException.NotImplementedException;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,7 @@ import javax.inject.Inject;
|
||||
path = RdapAutnumAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
isPrefix = true,
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapAutnumAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.util.Clock;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -34,7 +33,7 @@ import org.joda.time.DateTime;
|
||||
path = RdapDomainAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
isPrefix = true,
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapDomainAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.request.HttpException.UnprocessableEntityException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.util.Idn;
|
||||
@@ -66,7 +65,7 @@ import org.joda.time.DateTime;
|
||||
@Action(
|
||||
path = RdapDomainSearchAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapDomainSearchAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import google.registry.request.Action;
|
||||
import google.registry.request.HttpException.BadRequestException;
|
||||
import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.util.Clock;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -51,7 +50,7 @@ import org.joda.time.DateTime;
|
||||
path = RdapEntityAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
isPrefix = true,
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapEntityAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.request.HttpException.UnprocessableEntityException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.util.Clock;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -61,7 +60,7 @@ import org.joda.time.DateTime;
|
||||
@Action(
|
||||
path = RdapEntitySearchAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapEntitySearchAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.rdap.RdapJsonFormatter.BoilerplateType;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.util.Clock;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -31,7 +30,7 @@ import javax.inject.Inject;
|
||||
path = RdapHelpAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
isPrefix = true,
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapHelpAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.HttpException.NotImplementedException;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,7 @@ import javax.inject.Inject;
|
||||
path = RdapIpAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
isPrefix = true,
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapIpAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.util.Clock;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -34,7 +33,7 @@ import org.joda.time.DateTime;
|
||||
path = RdapNameserverAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
isPrefix = true,
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapNameserverAction extends RdapActionBase {
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ import google.registry.request.HttpException.BadRequestException;
|
||||
import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.Idn;
|
||||
import java.net.InetAddress;
|
||||
@@ -58,7 +57,7 @@ import org.joda.time.DateTime;
|
||||
@Action(
|
||||
path = RdapNameserverSearchAction.PATH,
|
||||
method = {GET, HEAD},
|
||||
auth = @Auth(minimumLevel = AuthLevel.NONE, userPolicy = Auth.UserPolicy.PUBLIC)
|
||||
auth = Auth.AUTH_PUBLIC_ANONYMOUS
|
||||
)
|
||||
public class RdapNameserverSearchAction extends RdapActionBase {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user