mirror of
https://github.com/google/nomulus
synced 2026-09-21 07:24:26 +00:00
Make GKE networking work more properly (#2531)
This commit is contained in:
@@ -119,6 +119,18 @@ public final class RegistryConfig {
|
||||
return config.gcpProject.projectIdNumber;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Config("backendServiceIds")
|
||||
public static Map<String, Long> provideBackendServiceIds(RegistryConfigSettings config) {
|
||||
return config.gcpProject.backendServiceIds;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Config("baseDomain")
|
||||
public static String provideBaseDomain(RegistryConfigSettings config) {
|
||||
return config.gcpProject.baseDomain;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Config("locationId")
|
||||
public static String provideLocationId(RegistryConfigSettings config) {
|
||||
@@ -1259,12 +1271,6 @@ public final class RegistryConfig {
|
||||
return config.auth.oauthClientId;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Config("fallbackOauthClientId")
|
||||
public static String provideFallbackOauthClientId(RegistryConfigSettings config) {
|
||||
return config.auth.fallbackOauthClientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the OAuth scopes required for accessing Google APIs using the default credential.
|
||||
*/
|
||||
|
||||
@@ -56,13 +56,14 @@ public class RegistryConfigSettings {
|
||||
public String bsaServiceUrl;
|
||||
public String toolsServiceUrl;
|
||||
public String pubapiServiceUrl;
|
||||
public Map<String, Long> backendServiceIds;
|
||||
public String baseDomain;
|
||||
}
|
||||
|
||||
/** Configuration options for authenticating users. */
|
||||
public static class Auth {
|
||||
public List<String> allowedServiceAccountEmails;
|
||||
public String oauthClientId;
|
||||
public String fallbackOauthClientId;
|
||||
}
|
||||
|
||||
/** Configuration options for accessing Google APIs. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# This is the default configuration file for Nomulus. Do not make changes to it
|
||||
# unless you are writing new features that requires you to. To customize an
|
||||
# unless you are writing new features that require you to. To customize an
|
||||
# individual deployment or environment, create a nomulus-config.yaml file in the
|
||||
# WEB-INF/ directory overriding only the values you wish to change. You may need
|
||||
# to override some of these values to configure and enable some services used in
|
||||
@@ -24,6 +24,17 @@ gcpProject:
|
||||
toolsServiceUrl: https://tools.example.com
|
||||
pubapiServiceUrl: https://pubapi.example.com
|
||||
|
||||
# The backend service IDs created when setting up GKE routes. They will be included in the
|
||||
# audience field in the JWT that IAP creates.
|
||||
# See: https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload
|
||||
backendServiceIds:
|
||||
frontend: 12345
|
||||
backend: 12345
|
||||
pubapi: 12345
|
||||
console: 12345
|
||||
|
||||
# The base domain name of the registry service. Services are reachable at [service].baseDomain.
|
||||
baseDomain: registry.test
|
||||
|
||||
gSuite:
|
||||
# Publicly accessible domain name of the running G Suite instance.
|
||||
@@ -328,25 +339,21 @@ caching:
|
||||
# Note: Only allowedServiceAccountEmails and oauthClientId should be configured.
|
||||
# Other fields are related to OAuth-based authentication and will be removed.
|
||||
auth:
|
||||
# Service accounts (e.g. default service account, account used by Cloud
|
||||
# Service accounts (e.g., default service account, account used by Cloud
|
||||
# Scheduler) allowed to send authenticated requests.
|
||||
allowedServiceAccountEmails:
|
||||
- default-service-account-email@email.com
|
||||
- cloud-scheduler-email@email.com
|
||||
|
||||
# OAuth 2.0 client ID that will be used as the audience in OIDC ID tokens sent
|
||||
# from clients (e.g. proxy, nomulus tool, cloud tasks) for authentication. The
|
||||
# from clients (e.g., proxy, nomulus tool, cloud tasks) for authentication. The
|
||||
# same ID is the only one accepted by the regular OIDC or IAP authentication
|
||||
# mechanisms. In most cases we should use the client ID created for IAP here,
|
||||
# mechanisms. In most cases, we should use the client ID created for IAP here,
|
||||
# as it allows requests bearing a token with this audience to be accepted by
|
||||
# both IAP or regular OIDC. The clientId value in proxy config file should be
|
||||
# the same as this one.
|
||||
oauthClientId: iap-oauth-clientid
|
||||
|
||||
# Same as above, but serve as a fallback, so we can switch the client ID of
|
||||
# the proxy without downtime.
|
||||
fallbackOauthClientId: fallback-oauth-clientid
|
||||
|
||||
credentialOAuth:
|
||||
# OAuth scopes required for accessing Google APIs using the default
|
||||
# credential.
|
||||
|
||||
@@ -36,7 +36,7 @@ import javax.inject.Inject;
|
||||
/** Action that manually triggers refresh of DNS information. */
|
||||
@Action(
|
||||
service = Action.Service.BACKEND,
|
||||
path = "/_dr/dnsRefresh",
|
||||
path = "/_dr/task/dnsRefresh",
|
||||
automaticallyPrintOk = true,
|
||||
auth = Auth.AUTH_ADMIN)
|
||||
public final class RefreshDnsAction implements Runnable {
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
<!-- Manually refreshes DNS information. -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>backend-servlet</servlet-name>
|
||||
<url-pattern>/_dr/dnsRefresh</url-pattern>
|
||||
<url-pattern>/_dr/task/dnsRefresh</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Fans out a cron task over an adjustable range of TLDs. -->
|
||||
|
||||
@@ -102,9 +102,11 @@ interface RegistryComponent {
|
||||
class RegistryModule {
|
||||
@Provides
|
||||
static RequestHandler<RequestComponent> provideRequestHandler(
|
||||
@Config("baseDomain") String baseDomain,
|
||||
Provider<RequestComponent.Builder> componentProvider,
|
||||
RequestAuthenticator requestAuthenticator) {
|
||||
return RequestHandler.create(RequestComponent.class, componentProvider, requestAuthenticator);
|
||||
return RequestHandler.create(
|
||||
RequestComponent.class, baseDomain, componentProvider, requestAuthenticator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ import google.registry.ui.server.console.ConsoleDomainGetAction;
|
||||
import google.registry.ui.server.console.ConsoleDomainListAction;
|
||||
import google.registry.ui.server.console.ConsoleDumDownloadAction;
|
||||
import google.registry.ui.server.console.ConsoleEppPasswordAction;
|
||||
import google.registry.ui.server.console.ConsoleModule;
|
||||
import google.registry.ui.server.console.ConsoleRegistryLockAction;
|
||||
import google.registry.ui.server.console.ConsoleRegistryLockVerifyAction;
|
||||
import google.registry.ui.server.console.ConsoleUpdateRegistrarAction;
|
||||
@@ -121,15 +122,6 @@ import google.registry.ui.server.console.RegistrarsAction;
|
||||
import google.registry.ui.server.console.settings.ContactAction;
|
||||
import google.registry.ui.server.console.settings.SecurityAction;
|
||||
import google.registry.ui.server.console.settings.WhoisRegistrarFieldsAction;
|
||||
import google.registry.ui.server.registrar.ConsoleOteSetupAction;
|
||||
import google.registry.ui.server.registrar.ConsoleRegistrarCreatorAction;
|
||||
import google.registry.ui.server.registrar.ConsoleUiAction;
|
||||
import google.registry.ui.server.registrar.OteStatusAction;
|
||||
import google.registry.ui.server.registrar.RegistrarConsoleModule;
|
||||
import google.registry.ui.server.registrar.RegistrarSettingsAction;
|
||||
import google.registry.ui.server.registrar.RegistryLockGetAction;
|
||||
import google.registry.ui.server.registrar.RegistryLockPostAction;
|
||||
import google.registry.ui.server.registrar.RegistryLockVerifyAction;
|
||||
import google.registry.whois.WhoisAction;
|
||||
import google.registry.whois.WhoisHttpAction;
|
||||
import google.registry.whois.WhoisModule;
|
||||
@@ -142,6 +134,7 @@ import google.registry.whois.WhoisModule;
|
||||
BillingModule.class,
|
||||
CheckApiModule.class,
|
||||
CloudDnsWriterModule.class,
|
||||
ConsoleModule.class,
|
||||
CronModule.class,
|
||||
CustomLogicModule.class,
|
||||
DnsCountQueryCoordinatorModule.class,
|
||||
@@ -154,7 +147,6 @@ import google.registry.whois.WhoisModule;
|
||||
LoadTestModule.class,
|
||||
RdapModule.class,
|
||||
RdeModule.class,
|
||||
RegistrarConsoleModule.class,
|
||||
ReportingModule.class,
|
||||
RequestModule.class,
|
||||
SheetModule.class,
|
||||
@@ -186,16 +178,10 @@ interface RequestComponent {
|
||||
|
||||
ConsoleEppPasswordAction consoleEppPasswordAction();
|
||||
|
||||
ConsoleOteSetupAction consoleOteSetupAction();
|
||||
|
||||
ConsoleRegistrarCreatorAction consoleRegistrarCreatorAction();
|
||||
|
||||
ConsoleRegistryLockAction consoleRegistryLockAction();
|
||||
|
||||
ConsoleRegistryLockVerifyAction consoleRegistryLockVerifyAction();
|
||||
|
||||
ConsoleUiAction consoleUiAction();
|
||||
|
||||
ConsoleUpdateRegistrarAction consoleUpdateRegistrarAction();
|
||||
|
||||
ConsoleUserDataAction consoleUserDataAction();
|
||||
@@ -254,8 +240,6 @@ interface RequestComponent {
|
||||
|
||||
NordnVerifyAction nordnVerifyAction();
|
||||
|
||||
OteStatusAction oteStatusAction();
|
||||
|
||||
PublishDnsUpdatesAction publishDnsUpdatesAction();
|
||||
|
||||
PublishInvoicesAction uploadInvoicesAction();
|
||||
@@ -296,16 +280,8 @@ interface RequestComponent {
|
||||
|
||||
RefreshDnsOnHostRenameAction refreshDnsOnHostRenameAction();
|
||||
|
||||
RegistrarSettingsAction registrarSettingsAction();
|
||||
|
||||
RegistrarsAction registrarsAction();
|
||||
|
||||
RegistryLockGetAction registryLockGetAction();
|
||||
|
||||
RegistryLockPostAction registryLockPostAction();
|
||||
|
||||
RegistryLockVerifyAction registryLockVerifyAction();
|
||||
|
||||
RelockDomainAction relockDomainAction();
|
||||
|
||||
ResaveAllEppResourcesPipelineAction resaveAllEppResourcesPipelineAction();
|
||||
|
||||
@@ -29,6 +29,7 @@ import google.registry.ui.server.console.ConsoleDomainGetAction;
|
||||
import google.registry.ui.server.console.ConsoleDomainListAction;
|
||||
import google.registry.ui.server.console.ConsoleDumDownloadAction;
|
||||
import google.registry.ui.server.console.ConsoleEppPasswordAction;
|
||||
import google.registry.ui.server.console.ConsoleModule;
|
||||
import google.registry.ui.server.console.ConsoleRegistryLockAction;
|
||||
import google.registry.ui.server.console.ConsoleRegistryLockVerifyAction;
|
||||
import google.registry.ui.server.console.ConsoleUpdateRegistrarAction;
|
||||
@@ -41,7 +42,6 @@ import google.registry.ui.server.registrar.ConsoleOteSetupAction;
|
||||
import google.registry.ui.server.registrar.ConsoleRegistrarCreatorAction;
|
||||
import google.registry.ui.server.registrar.ConsoleUiAction;
|
||||
import google.registry.ui.server.registrar.OteStatusAction;
|
||||
import google.registry.ui.server.registrar.RegistrarConsoleModule;
|
||||
import google.registry.ui.server.registrar.RegistrarSettingsAction;
|
||||
import google.registry.ui.server.registrar.RegistryLockGetAction;
|
||||
import google.registry.ui.server.registrar.RegistryLockPostAction;
|
||||
@@ -54,7 +54,7 @@ import google.registry.ui.server.registrar.RegistryLockVerifyAction;
|
||||
BatchModule.class,
|
||||
DnsModule.class,
|
||||
EppTlsModule.class,
|
||||
RegistrarConsoleModule.class,
|
||||
ConsoleModule.class,
|
||||
RequestModule.class,
|
||||
WhiteboxModule.class,
|
||||
})
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
package google.registry.request;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import google.registry.request.auth.Auth;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -36,7 +38,6 @@ public @interface Action {
|
||||
BACKEND("backend"),
|
||||
PUBAPI("pubapi");
|
||||
|
||||
|
||||
private final String serviceId;
|
||||
|
||||
Service(String serviceId) {
|
||||
@@ -49,9 +50,33 @@ public @interface Action {
|
||||
}
|
||||
}
|
||||
|
||||
enum GkeService {
|
||||
// This designation means that it defers to the GAE service, so we don't have to annotate EVERY
|
||||
// action during the GKE migration.
|
||||
SAME_AS_GAE("same_as_gae"),
|
||||
FRONTEND("frontend"),
|
||||
BACKEND("backend"),
|
||||
PUBAPI("pubapi"),
|
||||
CONSOLE("console");
|
||||
|
||||
private final String serviceId;
|
||||
|
||||
GkeService(String serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
|
||||
public String getServiceId() {
|
||||
checkState(this != SAME_AS_GAE, "Cannot get service Id for SAME_AS_GAE");
|
||||
return serviceId;
|
||||
}
|
||||
}
|
||||
|
||||
/** Which App Engine service this action lives on. */
|
||||
Service service();
|
||||
|
||||
/** Which GKE service this action lives on. */
|
||||
GkeService gkeService() default GkeService.SAME_AS_GAE;
|
||||
|
||||
/** HTTP path to serve the action from. The path components must be percent-escaped. */
|
||||
String path();
|
||||
|
||||
@@ -72,4 +97,22 @@ public @interface Action {
|
||||
|
||||
/** Authentication settings. */
|
||||
Auth auth();
|
||||
|
||||
// TODO(jianglai): Use Action.gkeService() directly once we are off GAE.
|
||||
class ServiceGetter {
|
||||
public static GkeService get(Action action) {
|
||||
GkeService service = action.gkeService();
|
||||
if (service != GkeService.SAME_AS_GAE) {
|
||||
return service;
|
||||
}
|
||||
Service gaeService = action.service();
|
||||
return switch (gaeService) {
|
||||
case DEFAULT -> GkeService.FRONTEND;
|
||||
case BACKEND -> GkeService.BACKEND;
|
||||
case TOOLS -> GkeService.BACKEND;
|
||||
case BSA -> GkeService.BACKEND;
|
||||
case PUBAPI -> GkeService.PUBAPI;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,17 @@ import static jakarta.servlet.http.HttpServletResponse.SC_METHOD_NOT_ALLOWED;
|
||||
import static jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND;
|
||||
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.auth.AuthResult;
|
||||
import google.registry.request.auth.RequestAuthenticator;
|
||||
import google.registry.util.NonFinalForTesting;
|
||||
import google.registry.util.RegistryEnvironment;
|
||||
import google.registry.util.SystemClock;
|
||||
import google.registry.util.TypeUtils.TypeInstantiator;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Provider;
|
||||
@@ -69,6 +72,7 @@ public class RequestHandler<C> {
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final Router router;
|
||||
@Nullable private final String baseDomain;
|
||||
private final Provider<? extends RequestComponentBuilder<C>> requestComponentBuilderProvider;
|
||||
private final RequestAuthenticator requestAuthenticator;
|
||||
private final SystemClock clock = new SystemClock();
|
||||
@@ -91,22 +95,22 @@ public class RequestHandler<C> {
|
||||
protected RequestHandler(
|
||||
Provider<? extends RequestComponentBuilder<C>> requestComponentBuilderProvider,
|
||||
RequestAuthenticator requestAuthenticator) {
|
||||
this(null, requestComponentBuilderProvider, requestAuthenticator);
|
||||
this(null, null, requestComponentBuilderProvider, requestAuthenticator);
|
||||
}
|
||||
|
||||
/** Creates a new RequestHandler with an explicit component class for test purposes. */
|
||||
public static <C> RequestHandler<C> create(
|
||||
Class<C> component,
|
||||
@Nullable String baseDomain,
|
||||
Provider<? extends RequestComponentBuilder<C>> requestComponentBuilderProvider,
|
||||
RequestAuthenticator requestAuthenticator) {
|
||||
return new RequestHandler<>(
|
||||
checkNotNull(component),
|
||||
requestComponentBuilderProvider,
|
||||
requestAuthenticator);
|
||||
checkNotNull(component), baseDomain, requestComponentBuilderProvider, requestAuthenticator);
|
||||
}
|
||||
|
||||
private RequestHandler(
|
||||
@Nullable Class<C> component,
|
||||
@Nullable String baseDomain,
|
||||
Provider<? extends RequestComponentBuilder<C>> requestComponentBuilderProvider,
|
||||
RequestAuthenticator requestAuthenticator) {
|
||||
// If the component class isn't explicitly provided, infer it from the class's own typing.
|
||||
@@ -114,6 +118,7 @@ public class RequestHandler<C> {
|
||||
// preserved at runtime, so only expose that option via the protected constructor.
|
||||
this.router = Router.create(
|
||||
component != null ? component : new TypeInstantiator<C>(getClass()){}.getExactType());
|
||||
this.baseDomain = baseDomain;
|
||||
this.requestComponentBuilderProvider = checkNotNull(requestComponentBuilderProvider);
|
||||
this.requestAuthenticator = checkNotNull(requestAuthenticator);
|
||||
}
|
||||
@@ -137,6 +142,17 @@ public class RequestHandler<C> {
|
||||
rsp.sendError(SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
if (RegistryEnvironment.isOnJetty()) {
|
||||
GkeService service = Action.ServiceGetter.get(route.get().action());
|
||||
String expectedDomain = String.format("%s.%s", service.getServiceId(), baseDomain);
|
||||
String actualDomain = req.getServerName();
|
||||
if (!Objects.equals(actualDomain, expectedDomain)) {
|
||||
logger.atWarning().log(
|
||||
"Actual domain %s does not match expected domain %s", actualDomain, expectedDomain);
|
||||
rsp.sendError(SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!route.get().isMethodAllowed(method)) {
|
||||
logger.atWarning().log("Method %s not allowed for: %s", method, path);
|
||||
rsp.sendError(SC_METHOD_NOT_ALLOWED);
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Streams;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,7 @@ import java.util.Map;
|
||||
* the content to be displayed. The columns are:
|
||||
*
|
||||
* <ol>
|
||||
* <li>the GKE service this action lives on
|
||||
* <li>the URL path which maps to this action (with a "(*)" after it if the prefix flag is set)
|
||||
* <li>the simple name of the action class
|
||||
* <li>the allowable HTTP methods
|
||||
@@ -49,12 +51,13 @@ import java.util.Map;
|
||||
*/
|
||||
public class RouterDisplayHelper {
|
||||
|
||||
private static final String SERVICE = "service";
|
||||
private static final String PATH = "path";
|
||||
private static final String CLASS = "class";
|
||||
private static final String METHODS = "methods";
|
||||
private static final String MINIMUM_LEVEL = "minLevel";
|
||||
|
||||
private static final String FORMAT = "%%-%ds %%-%ds %%-%ds %%-2s %%-%ds %%s";
|
||||
private static final String FORMAT = "%%-%ds %%-%ds %%-%ds %%-%ds %%-2s %%-%ds %%s";
|
||||
|
||||
/** Returns a string representation of the routing map in the specified component. */
|
||||
public static String extractHumanReadableRoutesFromComponent(Class<?> componentClass) {
|
||||
@@ -76,6 +79,7 @@ public class RouterDisplayHelper {
|
||||
private static String getFormatString(Map<String, Integer> columnWidths) {
|
||||
return String.format(
|
||||
FORMAT,
|
||||
columnWidths.get(SERVICE),
|
||||
columnWidths.get(PATH),
|
||||
columnWidths.get(CLASS),
|
||||
columnWidths.get(METHODS),
|
||||
@@ -84,18 +88,13 @@ public class RouterDisplayHelper {
|
||||
|
||||
private static String headerToString(String formatString) {
|
||||
return String.format(
|
||||
formatString,
|
||||
"PATH",
|
||||
"CLASS",
|
||||
"METHODS",
|
||||
"OK",
|
||||
"MIN",
|
||||
"USER_POLICY");
|
||||
formatString, "SERVICE", "PATH", "CLASS", "METHODS", "OK", "MIN", "USER_POLICY");
|
||||
}
|
||||
|
||||
private static String routeToString(Route route, String formatString) {
|
||||
return String.format(
|
||||
formatString,
|
||||
Action.ServiceGetter.get(route.action()).name(),
|
||||
route.action().isPrefix() ? (route.action().path() + "(*)") : route.action().path(),
|
||||
route.actionClass().getSimpleName(),
|
||||
Joiner.on(",").join(route.action().method()),
|
||||
@@ -107,12 +106,17 @@ public class RouterDisplayHelper {
|
||||
private static String formatRoutes(Iterable<Route> routes) {
|
||||
|
||||
// Use the column header length as a minimum.
|
||||
int serviceWidth = 7;
|
||||
int pathWidth = 4;
|
||||
int classWidth = 5;
|
||||
int methodsWidth = 7;
|
||||
int minLevelWidth = 3;
|
||||
for (Route route : routes) {
|
||||
int len =
|
||||
int len = Action.ServiceGetter.get(route.action()).name().length();
|
||||
if (len > serviceWidth) {
|
||||
serviceWidth = len;
|
||||
}
|
||||
len =
|
||||
route.action().isPrefix()
|
||||
? (route.action().path().length() + 3)
|
||||
: route.action().path().length();
|
||||
@@ -135,6 +139,7 @@ public class RouterDisplayHelper {
|
||||
final String formatString =
|
||||
getFormatString(
|
||||
new ImmutableMap.Builder<String, Integer>()
|
||||
.put(SERVICE, serviceWidth)
|
||||
.put(PATH, pathWidth)
|
||||
.put(CLASS, classWidth)
|
||||
.put(METHODS, methodsWidth)
|
||||
@@ -143,6 +148,9 @@ public class RouterDisplayHelper {
|
||||
return headerToString(formatString)
|
||||
+ String.format("%n")
|
||||
+ Streams.stream(routes)
|
||||
.sorted(
|
||||
Comparator.comparing(
|
||||
(Route route) -> Action.ServiceGetter.get(route.action()).ordinal()))
|
||||
.map(route -> routeToString(route, formatString))
|
||||
.collect(joining(String.format("%n")));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package google.registry.request.auth;
|
||||
|
||||
import static com.google.common.net.HttpHeaders.AUTHORIZATION;
|
||||
|
||||
import com.google.auth.oauth2.TokenVerifier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
@@ -24,6 +23,10 @@ import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.request.auth.OidcTokenAuthenticationMechanism.IapOidcAuthenticationMechanism;
|
||||
import google.registry.request.auth.OidcTokenAuthenticationMechanism.RegularOidcAuthenticationMechanism;
|
||||
import google.registry.request.auth.OidcTokenAuthenticationMechanism.TokenExtractor;
|
||||
import google.registry.request.auth.OidcTokenAuthenticationMechanism.TokenVerifier;
|
||||
import google.registry.util.RegistryEnvironment;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Qualifier;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -35,9 +38,10 @@ public class AuthModule {
|
||||
// See https://cloud.google.com/iap/docs/signed-headers-howto#securing_iap_headers.
|
||||
public static final String IAP_HEADER_NAME = "X-Goog-IAP-JWT-Assertion";
|
||||
public static final String BEARER_PREFIX = "Bearer ";
|
||||
// TODO: Change the IAP audience format once we are on GKE.
|
||||
// TODO (jianglai): Only use GKE audience once we are fully migrated to GKE.
|
||||
// See: https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload
|
||||
private static final String IAP_AUDIENCE_FORMAT = "/projects/%d/apps/%s";
|
||||
private static final String IAP_GAE_AUDIENCE_FORMAT = "/projects/%d/apps/%s";
|
||||
private static final String IAP_GKE_AUDIENCE_FORMAT = "/projects/%d/global/backendServices/%d";
|
||||
private static final String IAP_ISSUER_URL = "https://cloud.google.com/iap";
|
||||
private static final String REGULAR_ISSUER_URL = "https://accounts.google.com";
|
||||
|
||||
@@ -62,24 +66,35 @@ public class AuthModule {
|
||||
@IapOidc
|
||||
@Singleton
|
||||
TokenVerifier provideIapTokenVerifier(
|
||||
@Config("projectId") String projectId, @Config("projectIdNumber") long projectIdNumber) {
|
||||
String audience = String.format(IAP_AUDIENCE_FORMAT, projectIdNumber, projectId);
|
||||
return TokenVerifier.newBuilder().setAudience(audience).setIssuer(IAP_ISSUER_URL).build();
|
||||
@Config("projectId") String projectId,
|
||||
@Config("projectIdNumber") long projectIdNumber,
|
||||
@Config("backendServiceIds") Map<String, Long> backendServiceIds) {
|
||||
com.google.auth.oauth2.TokenVerifier.Builder tokenVerifierBuilder =
|
||||
com.google.auth.oauth2.TokenVerifier.newBuilder().setIssuer(IAP_ISSUER_URL);
|
||||
return (String service, String token) -> {
|
||||
String audience;
|
||||
if (RegistryEnvironment.isOnJetty()) {
|
||||
long backendServiceId = backendServiceIds.get(service);
|
||||
audience = String.format(IAP_GKE_AUDIENCE_FORMAT, projectIdNumber, backendServiceId);
|
||||
} else {
|
||||
audience = String.format(IAP_GAE_AUDIENCE_FORMAT, projectIdNumber, projectId);
|
||||
}
|
||||
return tokenVerifierBuilder.setAudience(audience).build().verify(token);
|
||||
};
|
||||
}
|
||||
|
||||
@Provides
|
||||
@RegularOidc
|
||||
@Singleton
|
||||
TokenVerifier provideRegularTokenVerifier(@Config("oauthClientId") String clientId) {
|
||||
return TokenVerifier.newBuilder().setAudience(clientId).setIssuer(REGULAR_ISSUER_URL).build();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@RegularOidcFallback
|
||||
@Singleton
|
||||
TokenVerifier provideFallbackRegularTokenVerifier(
|
||||
@Config("fallbackOauthClientId") String clientId) {
|
||||
return TokenVerifier.newBuilder().setAudience(clientId).setIssuer(REGULAR_ISSUER_URL).build();
|
||||
com.google.auth.oauth2.TokenVerifier tokenVerifier =
|
||||
com.google.auth.oauth2.TokenVerifier.newBuilder()
|
||||
.setAudience(clientId)
|
||||
.setIssuer(REGULAR_ISSUER_URL)
|
||||
.build();
|
||||
return (@Nullable String service, String token) -> {
|
||||
return tokenVerifier.verify(token);
|
||||
};
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
+27
-34
@@ -18,8 +18,9 @@ import static com.google.common.base.Preconditions.checkState;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
|
||||
import com.google.api.client.json.webtoken.JsonWebSignature;
|
||||
import com.google.auth.oauth2.TokenVerifier;
|
||||
import com.google.auth.oauth2.TokenVerifier.VerificationException;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
@@ -27,7 +28,6 @@ import google.registry.model.console.User;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.request.auth.AuthModule.IapOidc;
|
||||
import google.registry.request.auth.AuthModule.RegularOidc;
|
||||
import google.registry.request.auth.AuthModule.RegularOidcFallback;
|
||||
import google.registry.request.auth.AuthSettings.AuthLevel;
|
||||
import google.registry.util.RegistryEnvironment;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -51,27 +51,23 @@ public abstract class OidcTokenAuthenticationMechanism implements Authentication
|
||||
|
||||
public static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
// A workaround that allows "use" of the OIDC authenticator when running local testing, i.e.
|
||||
// A workaround that allows "use" of the OIDC authenticator when running local testing, i.e.,
|
||||
// the RegistryTestServer
|
||||
private static AuthResult authResultForTesting = null;
|
||||
|
||||
protected final TokenVerifier tokenVerifier;
|
||||
|
||||
protected final Optional<TokenVerifier> fallbackTokenVerifier;
|
||||
|
||||
protected final TokenExtractor tokenExtractor;
|
||||
|
||||
protected final TokenVerifier tokenVerifier;
|
||||
|
||||
private final ImmutableSet<String> serviceAccountEmails;
|
||||
|
||||
protected OidcTokenAuthenticationMechanism(
|
||||
ImmutableSet<String> serviceAccountEmails,
|
||||
TokenVerifier tokenVerifier,
|
||||
@Nullable TokenVerifier fallbackTokenVerifier,
|
||||
TokenExtractor tokenExtractor) {
|
||||
TokenExtractor tokenExtractor,
|
||||
TokenVerifier tokenVerifier) {
|
||||
this.serviceAccountEmails = serviceAccountEmails;
|
||||
this.tokenVerifier = tokenVerifier;
|
||||
this.fallbackTokenVerifier = Optional.ofNullable(fallbackTokenVerifier);
|
||||
this.tokenExtractor = tokenExtractor;
|
||||
this.tokenVerifier = tokenVerifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +83,12 @@ public abstract class OidcTokenAuthenticationMechanism implements Authentication
|
||||
}
|
||||
JsonWebSignature token = null;
|
||||
try {
|
||||
token = tokenVerifier.verify(rawIdToken);
|
||||
String service = null;
|
||||
if (RegistryEnvironment.isOnJetty()) {
|
||||
String hostname = request.getServerName();
|
||||
service = Splitter.on('.').split(hostname).iterator().next();
|
||||
}
|
||||
token = tokenVerifier.verify(service, rawIdToken);
|
||||
} catch (Exception e) {
|
||||
logger.atInfo().withCause(e).log(
|
||||
"Failed OIDC verification attempt:\n%s",
|
||||
@@ -97,20 +98,7 @@ public abstract class OidcTokenAuthenticationMechanism implements Authentication
|
||||
}
|
||||
|
||||
if (token == null) {
|
||||
if (fallbackTokenVerifier.isPresent()) {
|
||||
try {
|
||||
token = fallbackTokenVerifier.get().verify(rawIdToken);
|
||||
} catch (Exception e) {
|
||||
logger.atInfo().withCause(e).log(
|
||||
"Failed OIDC fallback verification attempt:\n%s",
|
||||
RegistryEnvironment.get().equals(RegistryEnvironment.PRODUCTION)
|
||||
? "Raw token redacted in prod"
|
||||
: rawIdToken);
|
||||
return AuthResult.NOT_AUTHENTICATED;
|
||||
}
|
||||
} else {
|
||||
return AuthResult.NOT_AUTHENTICATED;
|
||||
}
|
||||
return AuthResult.NOT_AUTHENTICATED;
|
||||
}
|
||||
|
||||
String email = (String) token.getPayload().get("email");
|
||||
@@ -155,6 +143,12 @@ public abstract class OidcTokenAuthenticationMechanism implements Authentication
|
||||
String extract(HttpServletRequest request);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
protected interface TokenVerifier {
|
||||
@Nullable
|
||||
JsonWebSignature verify(@Nullable String service, String rawToken) throws VerificationException;
|
||||
}
|
||||
|
||||
/**
|
||||
* A mechanism to authenticate HTTP requests that have gone through the GCP Identity-Aware Proxy.
|
||||
*
|
||||
@@ -171,9 +165,9 @@ public abstract class OidcTokenAuthenticationMechanism implements Authentication
|
||||
@Inject
|
||||
protected IapOidcAuthenticationMechanism(
|
||||
@Config("allowedServiceAccountEmails") ImmutableSet<String> serviceAccountEmails,
|
||||
@IapOidc TokenVerifier tokenVerifier,
|
||||
@IapOidc TokenExtractor tokenExtractor) {
|
||||
super(serviceAccountEmails, tokenVerifier, null, tokenExtractor);
|
||||
@IapOidc TokenExtractor tokenExtractor,
|
||||
@IapOidc TokenVerifier tokenVerifier) {
|
||||
super(serviceAccountEmails, tokenExtractor, tokenVerifier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,10 +186,9 @@ public abstract class OidcTokenAuthenticationMechanism implements Authentication
|
||||
@Inject
|
||||
protected RegularOidcAuthenticationMechanism(
|
||||
@Config("allowedServiceAccountEmails") ImmutableSet<String> serviceAccountEmails,
|
||||
@RegularOidc TokenVerifier tokenVerifier,
|
||||
@RegularOidcFallback TokenVerifier fallbackTokenVerifier,
|
||||
@RegularOidc TokenExtractor tokenExtractor) {
|
||||
super(serviceAccountEmails, tokenVerifier, fallbackTokenVerifier, tokenExtractor);
|
||||
@RegularOidc TokenExtractor tokenExtractor,
|
||||
@RegularOidc TokenVerifier tokenVerifier) {
|
||||
super(serviceAccountEmails, tokenExtractor, tokenVerifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ import google.registry.model.registrar.RegistrarPocBase;
|
||||
import google.registry.request.Action.Service;
|
||||
import google.registry.request.HttpException;
|
||||
import google.registry.security.XsrfTokenManager;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.ui.server.registrar.ConsoleUiAction;
|
||||
import google.registry.util.DiffUtils;
|
||||
import google.registry.util.RegistryEnvironment;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.ui.server.registrar;
|
||||
package google.registry.ui.server.console;
|
||||
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.AuthResult;
|
||||
@@ -24,15 +24,16 @@ import google.registry.model.console.ConsolePermission;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** Returns a JSON representation of a domain to the registrar console. */
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleDomainGetAction.PATH,
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
public class ConsoleDomainGetAction extends ConsoleApiAction {
|
||||
|
||||
@@ -27,9 +27,9 @@ import google.registry.model.CreateAutoTimestamp;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
@@ -39,6 +39,7 @@ import org.joda.time.DateTime;
|
||||
/** Returns a (paginated) list of domains for a particular registrar. */
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleDomainListAction.PATH,
|
||||
method = Action.Method.GET,
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
@@ -26,9 +26,9 @@ import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.model.console.ConsolePermission;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.util.Clock;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
@@ -40,6 +40,7 @@ import org.joda.time.DateTime;
|
||||
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleDumDownloadAction.PATH,
|
||||
method = {GET},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
@@ -30,17 +30,18 @@ import google.registry.flows.PasswordOnlyTransportCredentials;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor;
|
||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor.RegistrarAccessDeniedException;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.util.DiffUtils;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleEppPasswordAction.PATH,
|
||||
method = {POST},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.ui.server.registrar;
|
||||
package google.registry.ui.server.console;
|
||||
|
||||
import static google.registry.request.RequestParameters.extractBooleanParameter;
|
||||
import static google.registry.request.RequestParameters.extractOptionalIntParameter;
|
||||
@@ -41,8 +41,8 @@ import org.joda.time.DateTime;
|
||||
|
||||
/** Dagger module for the Registrar Console parameters. */
|
||||
@Module
|
||||
public final class RegistrarConsoleModule {
|
||||
static final String PARAM_CLIENT_ID = "clientId";
|
||||
public final class ConsoleModule {
|
||||
public static final String PARAM_CLIENT_ID = "clientId";
|
||||
|
||||
@Provides
|
||||
@RequestScope
|
||||
@@ -35,11 +35,11 @@ import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.tld.RegistryLockDao;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.tools.DomainLockUtils;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.util.EmailMessage;
|
||||
import jakarta.mail.internet.AddressException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
@@ -56,6 +56,7 @@ import org.joda.time.Duration;
|
||||
*/
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleRegistryLockAction.PATH,
|
||||
method = {GET, POST},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
+2
-1
@@ -22,16 +22,17 @@ import com.google.gson.annotations.Expose;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.tools.DomainLockUtils;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** Handler for verifying registry lock requests, a form of 2FA. */
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleRegistryLockVerifyAction.PATH,
|
||||
method = {GET},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
+2
-1
@@ -26,10 +26,10 @@ import google.registry.model.console.ConsolePermission;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.HttpException.BadRequestException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.util.DomainNameUtils;
|
||||
import google.registry.util.RegistryEnvironment;
|
||||
import java.util.Optional;
|
||||
@@ -38,6 +38,7 @@ import javax.inject.Inject;
|
||||
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleUpdateRegistrarAction.PATH,
|
||||
method = {POST},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
@@ -21,15 +21,16 @@ import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.security.XsrfTokenManager;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import javax.inject.Inject;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ConsoleUserDataAction.PATH,
|
||||
method = {GET},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
@@ -34,9 +34,9 @@ import google.registry.model.registrar.RegistrarBase;
|
||||
import google.registry.model.registrar.RegistrarBase.State;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.util.StringGenerator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -46,6 +46,7 @@ import javax.inject.Named;
|
||||
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = RegistrarsAction.PATH,
|
||||
method = {GET, POST},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
@@ -31,11 +31,12 @@ import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.persistence.transaction.QueryComposer.Comparator;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.ui.forms.FormException;
|
||||
import google.registry.ui.server.console.ConsoleApiAction;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.ui.server.console.ConsoleApiParams;
|
||||
import google.registry.ui.server.registrar.RegistrarSettingsAction;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
@@ -43,6 +44,7 @@ import javax.inject.Inject;
|
||||
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = ContactAction.PATH,
|
||||
method = {GET, POST},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
@@ -28,17 +28,19 @@ import google.registry.model.console.ConsolePermission;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor;
|
||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor.RegistrarAccessDeniedException;
|
||||
import google.registry.ui.server.console.ConsoleApiAction;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.ui.server.console.ConsoleApiParams;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = SecurityAction.PATH,
|
||||
method = {POST},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
+3
-1
@@ -25,12 +25,13 @@ import google.registry.model.console.ConsolePermission;
|
||||
import google.registry.model.console.User;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.GkeService;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor;
|
||||
import google.registry.request.auth.AuthenticatedRegistrarAccessor.RegistrarAccessDeniedException;
|
||||
import google.registry.ui.server.console.ConsoleApiAction;
|
||||
import google.registry.ui.server.registrar.ConsoleApiParams;
|
||||
import google.registry.ui.server.console.ConsoleApiParams;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
@@ -43,6 +44,7 @@ import javax.inject.Inject;
|
||||
*/
|
||||
@Action(
|
||||
service = Action.Service.DEFAULT,
|
||||
gkeService = GkeService.CONSOLE,
|
||||
path = WhoisRegistrarFieldsAction.PATH,
|
||||
method = {POST},
|
||||
auth = Auth.AUTH_PUBLIC_LOGGED_IN)
|
||||
|
||||
@@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.security.JsonResponseHelper.Status.SUCCESS;
|
||||
import static google.registry.ui.server.registrar.RegistrarConsoleModule.PARAM_CLIENT_ID;
|
||||
import static google.registry.ui.server.console.ConsoleModule.PARAM_CLIENT_ID;
|
||||
import static jakarta.servlet.http.HttpServletResponse.SC_FORBIDDEN;
|
||||
import static jakarta.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user