mirror of
https://github.com/google/nomulus.git
synced 2025-05-20 03:09:33 +02:00
Rename client ID to registrar ID in most places (#1317)
* Rename client ID to registrar ID in most places This is a code-only change, that shouldn't require any sort of data migration. Correspondingly, there are some existing uses of clientId that are not migrated (e.g. Datastore fields, task queue payloads, URL parameters for actions that might be hit from task queues, etc.). And it of course doesn't modify any fields in EPP XML. Note that the Cloud SQL schema fields are already named using the registar_id pattern. This also doesn't yet touch on the -c parameters in nomulus tools; that will be coming later (since that is an external manual touch-point, it will require a lot more in the way of changes to various meta scripts and documentation). * Change more client IDs * Merge branch 'master' into clientid-to-registrarid
This commit is contained in:
parent
0b6f18f6d4
commit
d5a91e7218
268 changed files with 1897 additions and 1786 deletions
|
@ -126,18 +126,18 @@ public final class AsyncTaskEnqueuer {
|
|||
public void enqueueAsyncDelete(
|
||||
EppResource resourceToDelete,
|
||||
DateTime now,
|
||||
String requestingClientId,
|
||||
String requestingRegistrarId,
|
||||
Trid trid,
|
||||
boolean isSuperuser) {
|
||||
Key<EppResource> resourceKey = Key.create(resourceToDelete);
|
||||
logger.atInfo().log(
|
||||
"Enqueuing async deletion of %s on behalf of registrar %s.",
|
||||
resourceKey, requestingClientId);
|
||||
resourceKey, requestingRegistrarId);
|
||||
TaskOptions task =
|
||||
TaskOptions.Builder.withMethod(Method.PULL)
|
||||
.countdownMillis(asyncDeleteDelay.getMillis())
|
||||
.param(PARAM_RESOURCE_KEY, resourceKey.getString())
|
||||
.param(PARAM_REQUESTING_CLIENT_ID, requestingClientId)
|
||||
.param(PARAM_REQUESTING_CLIENT_ID, requestingRegistrarId)
|
||||
.param(PARAM_SERVER_TRANSACTION_ID, trid.getServerTransactionId())
|
||||
.param(PARAM_IS_SUPERUSER, Boolean.toString(isSuperuser))
|
||||
.param(PARAM_REQUESTED_TIME, now.toString());
|
||||
|
|
|
@ -343,15 +343,15 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
}
|
||||
// Contacts and external hosts have a direct client id. For subordinate hosts it needs to be
|
||||
// read off of the superordinate domain.
|
||||
String resourceClientId = resource.getPersistedCurrentSponsorClientId();
|
||||
String resourceRegistrarId = resource.getPersistedCurrentSponsorRegistrarId();
|
||||
if (resource instanceof HostResource && ((HostResource) resource).isSubordinate()) {
|
||||
resourceClientId =
|
||||
resourceRegistrarId =
|
||||
tm().loadByKey(((HostResource) resource).getSuperordinateDomain())
|
||||
.cloneProjectedAtTime(now)
|
||||
.getCurrentSponsorClientId();
|
||||
.getCurrentSponsorRegistrarId();
|
||||
}
|
||||
boolean requestedByCurrentOwner =
|
||||
resourceClientId.equals(deletionRequest.requestingClientId());
|
||||
resourceRegistrarId.equals(deletionRequest.requestingClientId());
|
||||
|
||||
boolean deleteAllowed =
|
||||
hasNoActiveReferences && (requestedByCurrentOwner || deletionRequest.isSuperuser());
|
||||
|
@ -371,14 +371,14 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
|
||||
HistoryEntry historyEntry =
|
||||
HistoryEntry.createBuilderForResource(resource)
|
||||
.setClientId(deletionRequest.requestingClientId())
|
||||
.setRegistrarId(deletionRequest.requestingClientId())
|
||||
.setModificationTime(now)
|
||||
.setType(getHistoryEntryType(resource, deleteAllowed))
|
||||
.build();
|
||||
|
||||
PollMessage.OneTime pollMessage =
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setClientId(deletionRequest.requestingClientId())
|
||||
.setRegistrarId(deletionRequest.requestingClientId())
|
||||
.setMsg(pollMessageText)
|
||||
.setParent(historyEntry)
|
||||
.setEventTime(now)
|
||||
|
|
|
@ -135,7 +135,7 @@ public class DeleteLoadTestDataAction implements Runnable {
|
|||
}
|
||||
|
||||
private void deleteContact(ContactResource contact) {
|
||||
if (!LOAD_TEST_REGISTRARS.contains(contact.getPersistedCurrentSponsorClientId())) {
|
||||
if (!LOAD_TEST_REGISTRARS.contains(contact.getPersistedCurrentSponsorRegistrarId())) {
|
||||
return;
|
||||
}
|
||||
// We cannot remove contacts from domains in the general case, so we cannot delete contacts
|
||||
|
@ -150,7 +150,7 @@ public class DeleteLoadTestDataAction implements Runnable {
|
|||
}
|
||||
|
||||
private void deleteHost(HostResource host) {
|
||||
if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorClientId())) {
|
||||
if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorRegistrarId())) {
|
||||
return;
|
||||
}
|
||||
VKey<HostResource> hostVKey = host.createVKey();
|
||||
|
@ -198,7 +198,7 @@ public class DeleteLoadTestDataAction implements Runnable {
|
|||
|
||||
@Override
|
||||
public final void map(EppResource resource) {
|
||||
if (LOAD_TEST_REGISTRARS.contains(resource.getPersistedCurrentSponsorClientId())) {
|
||||
if (LOAD_TEST_REGISTRARS.contains(resource.getPersistedCurrentSponsorRegistrarId())) {
|
||||
deleteResource(resource);
|
||||
getContext()
|
||||
.incrementCounter(
|
||||
|
|
|
@ -291,7 +291,7 @@ public class DeleteProberDataAction implements Runnable {
|
|||
.setModificationTime(tm().getTransactionTime())
|
||||
.setBySuperuser(true)
|
||||
.setReason("Deletion of prober data")
|
||||
.setClientId(registryAdminRegistrarId)
|
||||
.setRegistrarId(registryAdminRegistrarId)
|
||||
.build();
|
||||
// Note that we don't bother handling grace periods, billing events, pending transfers, poll
|
||||
// messages, or auto-renews because those will all be hard-deleted the next time the job runs
|
||||
|
|
|
@ -324,7 +324,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
|
|||
DomainHistory historyEntry =
|
||||
new DomainHistory.Builder()
|
||||
.setBySuperuser(false)
|
||||
.setClientId(recurring.getClientId())
|
||||
.setRegistrarId(recurring.getRegistrarId())
|
||||
.setModificationTime(tm().getTransactionTime())
|
||||
.setDomain(tm().loadByKey(domainKey))
|
||||
.setPeriod(Period.create(1, YEARS))
|
||||
|
@ -354,7 +354,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
|
|||
syntheticOneTimesBuilder.add(
|
||||
new OneTime.Builder()
|
||||
.setBillingTime(billingTime)
|
||||
.setClientId(recurring.getClientId())
|
||||
.setRegistrarId(recurring.getRegistrarId())
|
||||
.setCost(renewCost)
|
||||
.setEventTime(eventTime)
|
||||
.setFlags(union(recurring.getFlags(), Flag.SYNTHETIC))
|
||||
|
|
|
@ -203,11 +203,11 @@ public class RelockDomainAction implements Runnable {
|
|||
"Domain %s has a pending transfer.",
|
||||
domainName);
|
||||
checkArgument(
|
||||
domain.getCurrentSponsorClientId().equals(oldLock.getRegistrarId()),
|
||||
domain.getCurrentSponsorRegistrarId().equals(oldLock.getRegistrarId()),
|
||||
"Domain %s has been transferred from registrar %s to registrar %s since the unlock.",
|
||||
domainName,
|
||||
oldLock.getRegistrarId(),
|
||||
domain.getCurrentSponsorClientId());
|
||||
domain.getCurrentSponsorRegistrarId());
|
||||
}
|
||||
|
||||
private void handleNonRetryableFailure(RegistryLock oldLock, Throwable t) {
|
||||
|
@ -293,7 +293,7 @@ public class RelockDomainAction implements Runnable {
|
|||
|
||||
private ImmutableSet<InternetAddress> getEmailRecipients(String registrarId) {
|
||||
Registrar registrar =
|
||||
Registrar.loadByClientIdCached(registrarId)
|
||||
Registrar.loadByRegistrarIdCached(registrarId)
|
||||
.orElseThrow(
|
||||
() ->
|
||||
new IllegalStateException(String.format("Unknown registrar %s", registrarId)));
|
||||
|
|
|
@ -172,7 +172,7 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
|||
registrar.getRegistrarName(),
|
||||
certificateType,
|
||||
expirationDate,
|
||||
registrar.getClientId()))
|
||||
registrar.getRegistrarId()))
|
||||
.setRecipients(recipients)
|
||||
.setCcs(getEmailAddresses(registrar, Type.ADMIN))
|
||||
.build());
|
||||
|
|
|
@ -125,7 +125,7 @@ public class InvoicingPipeline implements Serializable {
|
|||
oneTime.getId(),
|
||||
DateTimeUtils.toZonedDateTime(oneTime.getBillingTime(), ZoneId.of("UTC")),
|
||||
DateTimeUtils.toZonedDateTime(oneTime.getEventTime(), ZoneId.of("UTC")),
|
||||
registrar.getClientId(),
|
||||
registrar.getRegistrarId(),
|
||||
registrar.getBillingIdentifier().toString(),
|
||||
registrar.getPoNumber().orElse(""),
|
||||
DomainNameUtils.getTldFromDomainName(oneTime.getTargetId()),
|
||||
|
|
|
@ -151,7 +151,7 @@ public class Spec11Pipeline implements Serializable {
|
|||
return DomainNameInfo.create(
|
||||
domainBase.getDomainName(),
|
||||
domainBase.getRepoId(),
|
||||
domainBase.getCurrentSponsorClientId(),
|
||||
domainBase.getCurrentSponsorRegistrarId(),
|
||||
emailAddress);
|
||||
}
|
||||
|
||||
|
@ -199,15 +199,15 @@ public class Spec11Pipeline implements Serializable {
|
|||
MapElements.into(TypeDescriptors.strings())
|
||||
.via(
|
||||
(KV<String, Iterable<EmailAndThreatMatch>> kv) -> {
|
||||
String clientId = kv.getKey();
|
||||
String registrarId = kv.getKey();
|
||||
checkArgument(
|
||||
kv.getValue().iterator().hasNext(),
|
||||
String.format(
|
||||
"Registrar with ID %s had no corresponding threats", clientId));
|
||||
"Registrar with ID %s had no corresponding threats", registrarId));
|
||||
String email = kv.getValue().iterator().next().email();
|
||||
JSONObject output = new JSONObject();
|
||||
try {
|
||||
output.put(REGISTRAR_CLIENT_ID_FIELD, clientId);
|
||||
output.put(REGISTRAR_CLIENT_ID_FIELD, registrarId);
|
||||
output.put(REGISTRAR_EMAIL_FIELD, email);
|
||||
JSONArray threatMatchArray = new JSONArray();
|
||||
for (EmailAndThreatMatch emailAndThreatMatch : kv.getValue()) {
|
||||
|
|
|
@ -1138,8 +1138,8 @@ public final class RegistryConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the clientId of the registrar that admins are automatically logged in as if they
|
||||
* aren't otherwise associated with one.
|
||||
* Returns the ID of the registrar that admins are automatically logged in as if they aren't
|
||||
* otherwise associated with one.
|
||||
*/
|
||||
@Provides
|
||||
@Config("registryAdminClientId")
|
||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
|||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.request.Action.Method.POST;
|
||||
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||
import static google.registry.util.RegistrarUtils.normalizeClientId;
|
||||
import static google.registry.util.RegistrarUtils.normalizeRegistrarId;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||
|
||||
|
@ -96,16 +96,15 @@ public final class SyncGroupMembersAction implements Runnable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the Google Groups email address for the given registrar clientId and
|
||||
* RegistrarContact.Type
|
||||
* Returns the Google Groups email address for the given registrar ID and RegistrarContact.Type.
|
||||
*/
|
||||
public static String getGroupEmailAddressForContactType(
|
||||
String clientId, RegistrarContact.Type type, String gSuiteDomainName) {
|
||||
// Take the registrar's clientId, make it lowercase, and remove all characters that aren't
|
||||
String registrarId, RegistrarContact.Type type, String gSuiteDomainName) {
|
||||
// Take the registrar's ID, make it lowercase, and remove all characters that aren't
|
||||
// alphanumeric, hyphens, or underscores.
|
||||
return String.format(
|
||||
"%s-%s-contacts@%s",
|
||||
normalizeClientId(clientId), type.getDisplayName(), gSuiteDomainName);
|
||||
normalizeRegistrarId(registrarId), type.getDisplayName(), gSuiteDomainName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,8 +175,8 @@ public final class SyncGroupMembersAction implements Runnable {
|
|||
long totalAdded = 0;
|
||||
long totalRemoved = 0;
|
||||
for (final RegistrarContact.Type type : RegistrarContact.Type.values()) {
|
||||
groupKey = getGroupEmailAddressForContactType(
|
||||
registrar.getClientId(), type, gSuiteDomainName);
|
||||
groupKey =
|
||||
getGroupEmailAddressForContactType(registrar.getRegistrarId(), type, gSuiteDomainName);
|
||||
Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey);
|
||||
Set<String> desiredMembers =
|
||||
registrarContacts
|
||||
|
@ -196,11 +195,13 @@ public final class SyncGroupMembersAction implements Runnable {
|
|||
}
|
||||
logger.atInfo().log(
|
||||
"Successfully synced contacts for registrar %s: added %d and removed %d",
|
||||
registrar.getClientId(), totalAdded, totalRemoved);
|
||||
registrar.getRegistrarId(), totalAdded, totalRemoved);
|
||||
} catch (IOException e) {
|
||||
// Package up exception and re-throw with attached additional relevant info.
|
||||
String msg = String.format("Couldn't sync contacts for registrar %s to group %s",
|
||||
registrar.getClientId(), groupKey);
|
||||
String msg =
|
||||
String.format(
|
||||
"Couldn't sync contacts for registrar %s to group %s",
|
||||
registrar.getRegistrarId(), groupKey);
|
||||
throw new RuntimeException(msg, e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class SyncRegistrarsSheet {
|
|||
new Ordering<Registrar>() {
|
||||
@Override
|
||||
public int compare(Registrar left, Registrar right) {
|
||||
return left.getClientId().compareTo(right.getClientId());
|
||||
return left.getRegistrarId().compareTo(right.getRegistrarId());
|
||||
}
|
||||
}.immutableSortedCopy(Registrar.loadAllCached()).stream()
|
||||
.filter(
|
||||
|
@ -116,7 +116,7 @@ class SyncRegistrarsSheet {
|
|||
// and you'll need to remove deleted columns probably like a week after
|
||||
// deployment.
|
||||
//
|
||||
builder.put("clientIdentifier", convert(registrar.getClientId()));
|
||||
builder.put("clientIdentifier", convert(registrar.getRegistrarId()));
|
||||
builder.put("registrarName", convert(registrar.getRegistrarName()));
|
||||
builder.put("state", convert(registrar.getState()));
|
||||
builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier()));
|
||||
|
|
|
@ -61,7 +61,7 @@ public final class EppController {
|
|||
boolean isDryRun,
|
||||
boolean isSuperuser,
|
||||
byte[] inputXmlBytes) {
|
||||
eppMetricBuilder.setClientId(Optional.ofNullable(sessionMetadata.getClientId()));
|
||||
eppMetricBuilder.setRegistrarId(Optional.ofNullable(sessionMetadata.getRegistrarId()));
|
||||
try {
|
||||
EppInput eppInput;
|
||||
try {
|
||||
|
@ -76,7 +76,7 @@ public final class EppController {
|
|||
JSONValue.toJSONString(
|
||||
ImmutableMap.<String, Object>of(
|
||||
"clientId",
|
||||
nullToEmpty(sessionMetadata.getClientId()),
|
||||
nullToEmpty(sessionMetadata.getRegistrarId()),
|
||||
"resultCode",
|
||||
e.getResult().getCode().code,
|
||||
"resultMessage",
|
||||
|
|
|
@ -88,7 +88,7 @@ public class EppMetrics {
|
|||
String eppStatusCode =
|
||||
metric.getStatus().isPresent() ? String.valueOf(metric.getStatus().get().code) : "";
|
||||
eppRequestsByRegistrar.increment(
|
||||
metric.getCommandName().orElse(""), metric.getClientId().orElse(""), eppStatusCode);
|
||||
metric.getCommandName().orElse(""), metric.getRegistrarId().orElse(""), eppStatusCode);
|
||||
eppRequestsByTld.increment(
|
||||
metric.getCommandName().orElse(""), metric.getTld().orElse(""), eppStatusCode);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,10 @@ public class EppToolAction implements Runnable {
|
|||
|
||||
public static final String PATH = "/_dr/epptool";
|
||||
|
||||
@Inject @Parameter("clientId") String clientId;
|
||||
@Inject
|
||||
@Parameter("clientId")
|
||||
String registrarId;
|
||||
|
||||
@Inject @Parameter("superuser") boolean isSuperuser;
|
||||
@Inject @Parameter("dryRun") boolean isDryRun;
|
||||
@Inject @Parameter("xml") String xml;
|
||||
|
@ -49,8 +52,7 @@ public class EppToolAction implements Runnable {
|
|||
public void run() {
|
||||
eppRequestHandler.executeEpp(
|
||||
new StatelessRequestSessionMetadata(
|
||||
clientId,
|
||||
ProtocolDefinition.getVisibleServiceExtensionUris()),
|
||||
registrarId, ProtocolDefinition.getVisibleServiceExtensionUris()),
|
||||
new PasswordOnlyTransportCredentials(),
|
||||
EppRequestSource.TOOL,
|
||||
isDryRun,
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.common.flogger.FluentLogger;
|
|||
import google.registry.flows.EppException.CommandUseErrorException;
|
||||
import google.registry.flows.EppException.SyntaxErrorException;
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.exceptions.OnlyToolCanPassMetadataException;
|
||||
import google.registry.flows.exceptions.UnauthorizedForSuperuserExtensionException;
|
||||
|
@ -55,7 +55,7 @@ public final class ExtensionManager {
|
|||
|
||||
@Inject EppInput eppInput;
|
||||
@Inject SessionMetadata sessionMetadata;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject Class<? extends Flow> flowClass;
|
||||
@Inject EppRequestSource eppRequestSource;
|
||||
|
@ -101,7 +101,7 @@ public final class ExtensionManager {
|
|||
}
|
||||
logger.atInfo().log(
|
||||
"Client %s is attempting to run %s without declaring URIs %s on login",
|
||||
clientId, flowClass.getSimpleName(), undeclaredUris);
|
||||
registrarId, flowClass.getSimpleName(), undeclaredUris);
|
||||
}
|
||||
|
||||
private static final ImmutableSet<EppRequestSource> ALLOWED_METADATA_EPP_REQUEST_SOURCES =
|
||||
|
|
|
@ -164,11 +164,11 @@ public class FlowModule {
|
|||
|
||||
@Provides
|
||||
@FlowScope
|
||||
@ClientId
|
||||
static String provideClientId(SessionMetadata sessionMetadata) {
|
||||
// Treat a missing clientId as null so we can always inject a non-null value. All we do with the
|
||||
// clientId is log it (as "") or detect its absence, both of which work fine with empty.
|
||||
return Strings.nullToEmpty(sessionMetadata.getClientId());
|
||||
@RegistrarId
|
||||
static String provideRegistrarId(SessionMetadata sessionMetadata) {
|
||||
// Treat a missing registrarId as null so we can always inject a non-null value. All we do with
|
||||
// the registrarId is log it (as "") or detect its absence, both of which work fine with empty.
|
||||
return Strings.nullToEmpty(sessionMetadata.getRegistrarId());
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -220,14 +220,14 @@ public class FlowModule {
|
|||
Trid trid,
|
||||
byte[] inputXmlBytes,
|
||||
boolean isSuperuser,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
EppInput eppInput) {
|
||||
builder
|
||||
.setModificationTime(tm().getTransactionTime())
|
||||
.setTrid(trid)
|
||||
.setXmlBytes(inputXmlBytes)
|
||||
.setBySuperuser(isSuperuser)
|
||||
.setClientId(clientId);
|
||||
.setRegistrarId(registrarId);
|
||||
Optional<MetadataExtension> metadataExtension =
|
||||
eppInput.getSingleExtension(MetadataExtension.class);
|
||||
metadataExtension.ifPresent(
|
||||
|
@ -249,10 +249,10 @@ public class FlowModule {
|
|||
Trid trid,
|
||||
@InputXml byte[] inputXmlBytes,
|
||||
@Superuser boolean isSuperuser,
|
||||
@ClientId String clientId,
|
||||
@RegistrarId String registrarId,
|
||||
EppInput eppInput) {
|
||||
return makeHistoryEntryBuilder(
|
||||
new ContactHistory.Builder(), trid, inputXmlBytes, isSuperuser, clientId, eppInput);
|
||||
new ContactHistory.Builder(), trid, inputXmlBytes, isSuperuser, registrarId, eppInput);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,10 +266,10 @@ public class FlowModule {
|
|||
Trid trid,
|
||||
@InputXml byte[] inputXmlBytes,
|
||||
@Superuser boolean isSuperuser,
|
||||
@ClientId String clientId,
|
||||
@RegistrarId String registrarId,
|
||||
EppInput eppInput) {
|
||||
return makeHistoryEntryBuilder(
|
||||
new HostHistory.Builder(), trid, inputXmlBytes, isSuperuser, clientId, eppInput);
|
||||
new HostHistory.Builder(), trid, inputXmlBytes, isSuperuser, registrarId, eppInput);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,10 +283,10 @@ public class FlowModule {
|
|||
Trid trid,
|
||||
@InputXml byte[] inputXmlBytes,
|
||||
@Superuser boolean isSuperuser,
|
||||
@ClientId String clientId,
|
||||
@RegistrarId String registrarId,
|
||||
EppInput eppInput) {
|
||||
return makeHistoryEntryBuilder(
|
||||
new DomainHistory.Builder(), trid, inputXmlBytes, isSuperuser, clientId, eppInput);
|
||||
new DomainHistory.Builder(), trid, inputXmlBytes, isSuperuser, registrarId, eppInput);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -322,7 +322,7 @@ public class FlowModule {
|
|||
/** Dagger qualifier for registrar client id. */
|
||||
@Qualifier
|
||||
@Documented
|
||||
public @interface ClientId {}
|
||||
public @interface RegistrarId {}
|
||||
|
||||
/** Dagger qualifier for the target id (foreign key) for single resource flows. */
|
||||
@Qualifier
|
||||
|
|
|
@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.InputXml;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
|
@ -45,7 +45,7 @@ public class FlowReporter {
|
|||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@Inject Trid trid;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @InputXml byte[] inputXmlBytes;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject Class<? extends Flow> flowClass;
|
||||
|
@ -64,7 +64,7 @@ public class FlowReporter {
|
|||
JSONValue.toJSONString(
|
||||
new ImmutableMap.Builder<String, Object>()
|
||||
.put("serverTrid", trid.getServerTransactionId())
|
||||
.put("clientId", clientId)
|
||||
.put("clientId", registrarId)
|
||||
.put("commandType", eppInput.getCommandType())
|
||||
.put("resourceType", eppInput.getResourceType().orElse(""))
|
||||
.put("flowClassName", flowClass.getSimpleName())
|
||||
|
|
|
@ -19,9 +19,9 @@ import static google.registry.xml.XmlTransformer.prettyPrint;
|
|||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.DryRun;
|
||||
import google.registry.flows.FlowModule.InputXml;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.Transactional;
|
||||
import google.registry.flows.session.LoginFlow;
|
||||
|
@ -38,7 +38,7 @@ public class FlowRunner {
|
|||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject TransportCredentials credentials;
|
||||
@Inject EppRequestSource eppRequestSource;
|
||||
@Inject Provider<Flow> flowProvider;
|
||||
|
@ -59,7 +59,7 @@ public class FlowRunner {
|
|||
logger.atInfo().log(
|
||||
COMMAND_LOG_FORMAT,
|
||||
trid.getServerTransactionId(),
|
||||
clientId,
|
||||
registrarId,
|
||||
sessionMetadata,
|
||||
prettyXml.replace("\n", "\n\t"),
|
||||
credentials,
|
||||
|
@ -74,8 +74,8 @@ public class FlowRunner {
|
|||
if (!isTransactional) {
|
||||
EppOutput eppOutput = EppOutput.create(flowProvider.get().run());
|
||||
if (flowClass.equals(LoginFlow.class)) {
|
||||
// In LoginFlow, clientId isn't known until after the flow executes, so save it then.
|
||||
eppMetricBuilder.setClientId(sessionMetadata.getClientId());
|
||||
// In LoginFlow, registrarId isn't known until after the flow executes, so save it then.
|
||||
eppMetricBuilder.setRegistrarId(sessionMetadata.getRegistrarId());
|
||||
}
|
||||
return eppOutput;
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ public final class FlowUtils {
|
|||
private FlowUtils() {}
|
||||
|
||||
/** Validate that there is a logged in client. */
|
||||
public static void validateClientIsLoggedIn(String clientId) throws EppException {
|
||||
if (clientId.isEmpty()) {
|
||||
public static void validateRegistrarIsLoggedIn(String registrarId) throws EppException {
|
||||
if (registrarId.isEmpty()) {
|
||||
throw new NotLoggedInException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.servlet.http.HttpSession;
|
|||
/** A metadata class that is a wrapper around {@link HttpSession}. */
|
||||
public class HttpSessionMetadata implements SessionMetadata {
|
||||
|
||||
private static final String CLIENT_ID = "CLIENT_ID";
|
||||
private static final String REGISTRAR_ID = "REGISTRAR_ID";
|
||||
private static final String SERVICE_EXTENSIONS = "SERVICE_EXTENSIONS";
|
||||
private static final String FAILED_LOGIN_ATTEMPTS = "FAILED_LOGIN_ATTEMPTS";
|
||||
|
||||
|
@ -41,8 +41,8 @@ public class HttpSessionMetadata implements SessionMetadata {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getClientId() {
|
||||
return (String) session.getAttribute(CLIENT_ID);
|
||||
public String getRegistrarId() {
|
||||
return (String) session.getAttribute(REGISTRAR_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,8 +57,8 @@ public class HttpSessionMetadata implements SessionMetadata {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setClientId(String clientId) {
|
||||
session.setAttribute(CLIENT_ID, clientId);
|
||||
public void setRegistrarId(String registrarId) {
|
||||
session.setAttribute(REGISTRAR_ID, registrarId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class HttpSessionMetadata implements SessionMetadata {
|
|||
@Override
|
||||
public String toString() {
|
||||
return toStringHelper(getClass())
|
||||
.add("clientId", getClientId())
|
||||
.add("clientId", getRegistrarId())
|
||||
.add("failedLoginAttempts", getFailedLoginAttempts())
|
||||
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
|
||||
.toString();
|
||||
|
|
|
@ -69,10 +69,10 @@ public final class ResourceFlowUtils {
|
|||
*/
|
||||
private static final int FAILFAST_CHECK_COUNT = 5;
|
||||
|
||||
/** Check that the given clientId corresponds to the owner of given resource. */
|
||||
public static void verifyResourceOwnership(String myClientId, EppResource resource)
|
||||
/** Check that the given registrarId corresponds to the owner of given resource. */
|
||||
public static void verifyResourceOwnership(String myRegistrarId, EppResource resource)
|
||||
throws EppException {
|
||||
if (!myClientId.equals(resource.getPersistedCurrentSponsorClientId())) {
|
||||
if (!myRegistrarId.equals(resource.getPersistedCurrentSponsorRegistrarId())) {
|
||||
throw new ResourceNotOwnedException();
|
||||
}
|
||||
}
|
||||
|
@ -138,8 +138,8 @@ public final class ResourceFlowUtils {
|
|||
}
|
||||
|
||||
public static <R extends EppResource & ResourceWithTransferData> void verifyTransferInitiator(
|
||||
String clientId, R resource) throws NotTransferInitiatorException {
|
||||
if (!resource.getTransferData().getGainingClientId().equals(clientId)) {
|
||||
String registrarId, R resource) throws NotTransferInitiatorException {
|
||||
if (!resource.getTransferData().getGainingRegistrarId().equals(registrarId)) {
|
||||
throw new NotTransferInitiatorException();
|
||||
}
|
||||
}
|
||||
|
@ -155,12 +155,12 @@ public final class ResourceFlowUtils {
|
|||
}
|
||||
|
||||
public static <R extends EppResource> void verifyResourceDoesNotExist(
|
||||
Class<R> clazz, String targetId, DateTime now, String clientId) throws EppException {
|
||||
Class<R> clazz, String targetId, DateTime now, String registrarId) throws EppException {
|
||||
VKey<R> key = loadAndGetKey(clazz, targetId, now);
|
||||
if (key != null) {
|
||||
R resource = tm().loadByKey(key);
|
||||
// These are similar exceptions, but we can track them internally as log-based metrics.
|
||||
if (Objects.equals(clientId, resource.getPersistedCurrentSponsorClientId())) {
|
||||
if (Objects.equals(registrarId, resource.getPersistedCurrentSponsorRegistrarId())) {
|
||||
throw new ResourceAlreadyExistsForThisClientException(targetId);
|
||||
} else {
|
||||
throw new ResourceCreateContentionException(targetId);
|
||||
|
|
|
@ -26,13 +26,13 @@ public interface SessionMetadata {
|
|||
*/
|
||||
void invalidate();
|
||||
|
||||
String getClientId();
|
||||
String getRegistrarId();
|
||||
|
||||
Set<String> getServiceExtensionUris();
|
||||
|
||||
int getFailedLoginAttempts();
|
||||
|
||||
void setClientId(String clientId);
|
||||
void setRegistrarId(String registrarId);
|
||||
|
||||
void setServiceExtensionUris(Set<String> serviceExtensionUris);
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ import java.util.Set;
|
|||
/** A read-only {@link SessionMetadata} that doesn't support login/logout. */
|
||||
public class StatelessRequestSessionMetadata implements SessionMetadata {
|
||||
|
||||
private final String clientId;
|
||||
private final String registrarId;
|
||||
private final ImmutableSet<String> serviceExtensionUris;
|
||||
|
||||
public StatelessRequestSessionMetadata(
|
||||
String clientId, ImmutableSet<String> serviceExtensionUris) {
|
||||
this.clientId = checkNotNull(clientId);
|
||||
String registrarId, ImmutableSet<String> serviceExtensionUris) {
|
||||
this.registrarId = checkNotNull(registrarId);
|
||||
this.serviceExtensionUris = checkNotNull(serviceExtensionUris);
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
public String getRegistrarId() {
|
||||
return registrarId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,7 +55,7 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setClientId(String clientId) {
|
||||
public void setRegistrarId(String registrarId) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
|
|||
@Override
|
||||
public String toString() {
|
||||
return toStringHelper(getClass())
|
||||
.add("clientId", getClientId())
|
||||
.add("clientId", getRegistrarId())
|
||||
.add("failedLoginAttempts", getFailedLoginAttempts())
|
||||
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
|
||||
.toString();
|
||||
|
|
|
@ -97,7 +97,7 @@ public class TlsCredentials implements TransportCredentials {
|
|||
if (ipAddressAllowList.isEmpty()) {
|
||||
logger.atInfo().log(
|
||||
"Skipping IP allow list check because %s doesn't have an IP allow list.",
|
||||
registrar.getClientId());
|
||||
registrar.getRegistrarId());
|
||||
return;
|
||||
}
|
||||
// In the rare unexpected case that the client inet address wasn't passed along at all, then
|
||||
|
@ -113,7 +113,7 @@ public class TlsCredentials implements TransportCredentials {
|
|||
logger.atInfo().log(
|
||||
"Authentication error: IP address %s is not allow-listed for registrar %s; allow list is:"
|
||||
+ " %s",
|
||||
clientInetAddr, registrar.getClientId(), ipAddressAllowList);
|
||||
clientInetAddr, registrar.getRegistrarId(), ipAddressAllowList);
|
||||
throw new BadRegistrarIpAddressException();
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,8 @@ public class TlsCredentials implements TransportCredentials {
|
|||
// Check that the request included the certificate hash
|
||||
if (!clientCertificateHash.isPresent()) {
|
||||
logger.atInfo().log(
|
||||
"Request from registrar %s did not include X-SSL-Certificate.", registrar.getClientId());
|
||||
"Request from registrar %s did not include X-SSL-Certificate.",
|
||||
registrar.getRegistrarId());
|
||||
throw new MissingRegistrarCertificateException();
|
||||
}
|
||||
// Check if the certificate hash is equal to the one on file for the registrar.
|
||||
|
@ -141,7 +142,7 @@ public class TlsCredentials implements TransportCredentials {
|
|||
logger.atWarning().log(
|
||||
"Non-matching certificate hash (%s) for %s, wanted either %s or %s.",
|
||||
clientCertificateHash,
|
||||
registrar.getClientId(),
|
||||
registrar.getRegistrarId(),
|
||||
registrar.getClientCertificateHash(),
|
||||
registrar.getFailoverClientCertificateHash());
|
||||
throw new BadRegistrarCertificateException();
|
||||
|
@ -156,7 +157,7 @@ public class TlsCredentials implements TransportCredentials {
|
|||
} catch (InsecureCertificateException e) {
|
||||
logger.atWarning().log(
|
||||
"Registrar certificate used for %s does not meet certificate requirements: %s",
|
||||
registrar.getClientId(), e.getMessage());
|
||||
registrar.getRegistrarId(), e.getMessage());
|
||||
throw new CertificateContainsSecurityViolationsException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount;
|
||||
import static google.registry.model.EppResourceUtils.checkResourcesExist;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import google.registry.config.RegistryConfig.Config;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.model.contact.ContactCommand.Check;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
|
@ -47,7 +47,7 @@ import javax.inject.Inject;
|
|||
public final class ContactCheckFlow implements Flow {
|
||||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Clock clock;
|
||||
@Inject @Config("maxChecks") int maxChecks;
|
||||
|
@ -57,7 +57,7 @@ public final class ContactCheckFlow implements Flow {
|
|||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
ImmutableList<String> targetIds = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(targetIds, maxChecks);
|
||||
ImmutableSet<String> existingIds =
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist;
|
||||
import static google.registry.flows.contact.ContactFlowUtils.validateAsciiPostalInfo;
|
||||
import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy;
|
||||
|
@ -27,7 +27,7 @@ import com.googlecode.objectify.Key;
|
|||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -60,7 +60,7 @@ public final class ContactCreateFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject ContactHistory.Builder historyBuilder;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -71,16 +71,16 @@ public final class ContactCreateFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
Create command = (Create) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
verifyResourceDoesNotExist(ContactResource.class, targetId, now, clientId);
|
||||
verifyResourceDoesNotExist(ContactResource.class, targetId, now, registrarId);
|
||||
ContactResource newContact =
|
||||
new ContactResource.Builder()
|
||||
.setContactId(targetId)
|
||||
.setAuthInfo(command.getAuthInfo())
|
||||
.setCreationClientId(clientId)
|
||||
.setPersistedCurrentSponsorClientId(clientId)
|
||||
.setCreationRegistrarId(registrarId)
|
||||
.setPersistedCurrentSponsorRegistrarId(registrarId)
|
||||
.setRepoId(createRepoId(allocateId(), roidSuffix))
|
||||
.setFaxNumber(command.getFax())
|
||||
.setVoiceNumber(command.getVoice())
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.checkLinkedDomains;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
|
||||
|
@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import google.registry.batch.AsyncTaskEnqueuer;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -75,7 +75,7 @@ public final class ContactDeleteFlow implements TransactionalFlow {
|
|||
StatusValue.SERVER_DELETE_PROHIBITED);
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Trid trid;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
|
@ -91,21 +91,21 @@ public final class ContactDeleteFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
checkLinkedDomains(targetId, now, ContactResource.class, DomainBase::getReferencedContacts);
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES);
|
||||
verifyOptionalAuthInfo(authInfo, existingContact);
|
||||
if (!isSuperuser) {
|
||||
verifyResourceOwnership(clientId, existingContact);
|
||||
verifyResourceOwnership(registrarId, existingContact);
|
||||
}
|
||||
Type historyEntryType;
|
||||
Code resultCode;
|
||||
ContactResource newContact;
|
||||
if (tm().isOfy()) {
|
||||
asyncTaskEnqueuer.enqueueAsyncDelete(
|
||||
existingContact, tm().getTransactionTime(), clientId, trid, isSuperuser);
|
||||
existingContact, tm().getTransactionTime(), registrarId, trid, isSuperuser);
|
||||
newContact = existingContact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build();
|
||||
historyEntryType = Type.CONTACT_PENDING_DELETE;
|
||||
resultCode = SUCCESS_WITH_ACTION_PENDING;
|
||||
|
@ -113,7 +113,7 @@ public final class ContactDeleteFlow implements TransactionalFlow {
|
|||
// Handle pending transfers on contact deletion.
|
||||
newContact =
|
||||
existingContact.getStatusValues().contains(StatusValue.PENDING_TRANSFER)
|
||||
? denyPendingTransfer(existingContact, SERVER_CANCELLED, now, clientId)
|
||||
? denyPendingTransfer(existingContact, SERVER_CANCELLED, now, registrarId)
|
||||
: existingContact;
|
||||
// Wipe out PII on contact deletion.
|
||||
newContact =
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ContactFlowUtils {
|
|||
DateTime now,
|
||||
Key<ContactHistory> contactHistoryKey) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setClientId(transferData.getGainingClientId())
|
||||
.setRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setEventTime(transferData.getPendingTransferExpirationTime())
|
||||
.setMsg(transferData.getTransferStatus().getMessage())
|
||||
.setResponseData(
|
||||
|
@ -92,7 +92,7 @@ public class ContactFlowUtils {
|
|||
static PollMessage createLosingTransferPollMessage(
|
||||
String targetId, TransferData transferData, Key<ContactHistory> contactHistoryKey) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setClientId(transferData.getLosingClientId())
|
||||
.setRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setEventTime(transferData.getPendingTransferExpirationTime())
|
||||
.setMsg(transferData.getTransferStatus().getMessage())
|
||||
.setResponseData(ImmutableList.of(createTransferResponse(targetId, transferData)))
|
||||
|
@ -105,8 +105,8 @@ public class ContactFlowUtils {
|
|||
String targetId, TransferData transferData) {
|
||||
return new ContactTransferResponse.Builder()
|
||||
.setContactId(targetId)
|
||||
.setGainingClientId(transferData.getGainingClientId())
|
||||
.setLosingClientId(transferData.getLosingClientId())
|
||||
.setGainingRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
|
||||
.setTransferRequestTime(transferData.getTransferRequestTime())
|
||||
.setTransferStatus(transferData.getTransferStatus())
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||
import static google.registry.model.EppResourceUtils.isLinked;
|
||||
|
@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -54,7 +54,7 @@ public final class ContactInfoFlow implements Flow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Clock clock;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
|
@ -67,13 +67,13 @@ public final class ContactInfoFlow implements Flow {
|
|||
public final EppResponse run() throws EppException {
|
||||
DateTime now = clock.nowUtc();
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
ContactResource contact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
if (!isSuperuser) {
|
||||
verifyResourceOwnership(clientId, contact);
|
||||
verifyResourceOwnership(registrarId, contact);
|
||||
}
|
||||
boolean includeAuthInfo =
|
||||
clientId.equals(contact.getCurrentSponsorClientId()) || authInfo.isPresent();
|
||||
registrarId.equals(contact.getCurrentSponsorRegistrarId()) || authInfo.isPresent();
|
||||
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
|
||||
statusValues.addAll(contact.getStatusValues());
|
||||
if (isLinked(contact.createVKey(), now)) {
|
||||
|
@ -89,10 +89,10 @@ public final class ContactInfoFlow implements Flow {
|
|||
.setVoiceNumber(contact.getVoiceNumber())
|
||||
.setFaxNumber(contact.getFaxNumber())
|
||||
.setEmailAddress(contact.getEmailAddress())
|
||||
.setCurrentSponsorClientId(contact.getCurrentSponsorClientId())
|
||||
.setCreationClientId(contact.getCreationClientId())
|
||||
.setCurrentSponsorClientId(contact.getCurrentSponsorRegistrarId())
|
||||
.setCreationClientId(contact.getCreationRegistrarId())
|
||||
.setCreationTime(contact.getCreationTime())
|
||||
.setLastEppUpdateClientId(contact.getLastEppUpdateClientId())
|
||||
.setLastEppUpdateClientId(contact.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(contact.getLastEppUpdateTime())
|
||||
.setLastTransferTime(contact.getLastTransferTime())
|
||||
.setAuthInfo(includeAuthInfo ? contact.getAuthInfo() : null)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
|
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -64,7 +64,7 @@ public final class ContactTransferApproveFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject ContactHistory.Builder historyBuilder;
|
||||
|
@ -79,12 +79,12 @@ public final class ContactTransferApproveFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingContact);
|
||||
verifyHasPendingTransfer(existingContact);
|
||||
verifyResourceOwnership(clientId, existingContact);
|
||||
verifyResourceOwnership(registrarId, existingContact);
|
||||
ContactResource newContact =
|
||||
approvePendingTransfer(existingContact, TransferStatus.CLIENT_APPROVED, now);
|
||||
ContactHistory contactHistory =
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
|
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -65,7 +65,7 @@ public final class ContactTransferCancelFlow implements TransactionalFlow {
|
|||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject ContactHistory.Builder historyBuilder;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -75,14 +75,14 @@ public final class ContactTransferCancelFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingContact);
|
||||
verifyHasPendingTransfer(existingContact);
|
||||
verifyTransferInitiator(clientId, existingContact);
|
||||
verifyTransferInitiator(registrarId, existingContact);
|
||||
ContactResource newContact =
|
||||
denyPendingTransfer(existingContact, TransferStatus.CLIENT_CANCELLED, now, clientId);
|
||||
denyPendingTransfer(existingContact, TransferStatus.CLIENT_CANCELLED, now, registrarId);
|
||||
ContactHistory contactHistory =
|
||||
historyBuilder.setType(CONTACT_TRANSFER_CANCEL).setContact(newContact).build();
|
||||
// Create a poll message for the losing client.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
|
||||
|
@ -22,7 +22,7 @@ import static google.registry.flows.contact.ContactFlowUtils.createTransferRespo
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
|
||||
|
@ -55,7 +55,7 @@ public final class ContactTransferQueryFlow implements Flow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Clock clock;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -64,7 +64,7 @@ public final class ContactTransferQueryFlow implements Flow {
|
|||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
ContactResource contact =
|
||||
loadAndVerifyExistence(ContactResource.class, targetId, clock.nowUtc());
|
||||
verifyOptionalAuthInfo(authInfo, contact);
|
||||
|
@ -76,8 +76,8 @@ public final class ContactTransferQueryFlow implements Flow {
|
|||
// Note that the authorization info on the command (if present) has already been verified. If
|
||||
// it's present, then the other checks are unnecessary.
|
||||
if (!authInfo.isPresent()
|
||||
&& !clientId.equals(contact.getTransferData().getGainingClientId())
|
||||
&& !clientId.equals(contact.getTransferData().getLosingClientId())) {
|
||||
&& !registrarId.equals(contact.getTransferData().getGainingRegistrarId())
|
||||
&& !registrarId.equals(contact.getTransferData().getLosingRegistrarId())) {
|
||||
throw new NotAuthorizedToViewTransferException();
|
||||
}
|
||||
return responseBuilder
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
|
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -63,7 +63,7 @@ public final class ContactTransferRejectFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject ContactHistory.Builder historyBuilder;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -73,14 +73,14 @@ public final class ContactTransferRejectFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingContact);
|
||||
verifyHasPendingTransfer(existingContact);
|
||||
verifyResourceOwnership(clientId, existingContact);
|
||||
verifyResourceOwnership(registrarId, existingContact);
|
||||
ContactResource newContact =
|
||||
denyPendingTransfer(existingContact, TransferStatus.CLIENT_REJECTED, now, clientId);
|
||||
denyPendingTransfer(existingContact, TransferStatus.CLIENT_REJECTED, now, registrarId);
|
||||
ContactHistory contactHistory =
|
||||
historyBuilder.setType(CONTACT_TRANSFER_REJECT).setContact(newContact).build();
|
||||
PollMessage gainingPollMessage =
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfoPresentForResourceTransfer;
|
||||
|
@ -32,7 +32,7 @@ import com.googlecode.objectify.Key;
|
|||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -80,7 +80,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String gainingClientId;
|
||||
@Inject @RegistrarId String gainingClientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Config("contactAutomaticTransferLength") Duration automaticTransferLength;
|
||||
|
||||
|
@ -93,7 +93,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(gainingClientId);
|
||||
validateRegistrarIsLoggedIn(gainingClientId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyAuthInfoPresentForResourceTransfer(authInfo);
|
||||
|
@ -102,7 +102,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
|
|||
if (TransferStatus.PENDING.equals(existingContact.getTransferData().getTransferStatus())) {
|
||||
throw new AlreadyPendingTransferException(targetId);
|
||||
}
|
||||
String losingClientId = existingContact.getCurrentSponsorClientId();
|
||||
String losingClientId = existingContact.getCurrentSponsorRegistrarId();
|
||||
// Verify that this client doesn't already sponsor this resource.
|
||||
if (gainingClientId.equals(losingClientId)) {
|
||||
throw new ObjectAlreadySponsoredException();
|
||||
|
@ -114,8 +114,8 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
|
|||
new ContactTransferData.Builder()
|
||||
.setTransferRequestTime(now)
|
||||
.setTransferRequestTrid(trid)
|
||||
.setGainingClientId(gainingClientId)
|
||||
.setLosingClientId(losingClientId)
|
||||
.setGainingRegistrarId(gainingClientId)
|
||||
.setLosingRegistrarId(losingClientId)
|
||||
.setPendingTransferExpirationTime(transferExpirationTime)
|
||||
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||
.build();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.contact;
|
||||
|
||||
import static com.google.common.collect.Sets.union;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.checkSameValuesNotAddedAndRemoved;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable;
|
||||
|
@ -30,7 +30,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -79,7 +79,7 @@ public final class ContactUpdateFlow implements TransactionalFlow {
|
|||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject ContactHistory.Builder historyBuilder;
|
||||
|
@ -90,7 +90,7 @@ public final class ContactUpdateFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
Update command = (Update) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
|
@ -98,7 +98,7 @@ public final class ContactUpdateFlow implements TransactionalFlow {
|
|||
ImmutableSet<StatusValue> statusToRemove = command.getInnerRemove().getStatusValues();
|
||||
ImmutableSet<StatusValue> statusesToAdd = command.getInnerAdd().getStatusValues();
|
||||
if (!isSuperuser) { // The superuser can update any contact and set any status.
|
||||
verifyResourceOwnership(clientId, existingContact);
|
||||
verifyResourceOwnership(registrarId, existingContact);
|
||||
verifyAllStatusesAreClientSettable(union(statusesToAdd, statusToRemove));
|
||||
}
|
||||
verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES);
|
||||
|
@ -125,9 +125,10 @@ public final class ContactUpdateFlow implements TransactionalFlow {
|
|||
builder.setInternationalizedPostalInfo(null);
|
||||
}
|
||||
}
|
||||
ContactResource newContact = builder
|
||||
ContactResource newContact =
|
||||
builder
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(clientId)
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.setAuthInfo(preferFirst(change.getAuthInfo(), existingContact.getAuthInfo()))
|
||||
.setDisclose(preferFirst(change.getDisclose(), existingContact.getDisclose()))
|
||||
.setEmailAddress(preferFirst(change.getEmail(), existingContact.getEmailAddress()))
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.flows.domain;
|
|||
import static com.google.common.base.Strings.emptyToNull;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static com.google.common.collect.ImmutableMap.toImmutableMap;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.getReservationTypes;
|
||||
|
@ -41,7 +41,7 @@ import google.registry.flows.EppException;
|
|||
import google.registry.flows.EppException.ParameterValuePolicyErrorException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.flows.custom.DomainCheckFlowCustomLogic;
|
||||
|
@ -113,7 +113,7 @@ public final class DomainCheckFlow implements Flow {
|
|||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
|
||||
@Inject
|
||||
@Config("maxChecks")
|
||||
|
@ -135,7 +135,7 @@ public final class DomainCheckFlow implements Flow {
|
|||
FeeCheckCommandExtension.class, LaunchCheckExtension.class, AllocationTokenExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
ImmutableList<String> domainNames = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(domainNames, maxChecks);
|
||||
DateTime now = clock.nowUtc();
|
||||
|
@ -151,7 +151,7 @@ public final class DomainCheckFlow implements Flow {
|
|||
String tld = parsedDomain.parent().toString();
|
||||
boolean tldFirstTimeSeen = seenTlds.add(tld);
|
||||
if (tldFirstTimeSeen && !isSuperuser) {
|
||||
checkAllowedAccessToTld(clientId, tld);
|
||||
checkAllowedAccessToTld(registrarId, tld);
|
||||
verifyNotInPredelegation(Registry.get(tld), now);
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public final class DomainCheckFlow implements Flow {
|
|||
allocationTokenFlowUtils.checkDomainsWithToken(
|
||||
ImmutableList.copyOf(parsedDomains.values()),
|
||||
tokenExtension.getAllocationToken(),
|
||||
clientId,
|
||||
registrarId,
|
||||
now));
|
||||
|
||||
ImmutableList.Builder<DomainCheck> checksBuilder = new ImmutableList.Builder<>();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.validateDomainName;
|
||||
|
@ -31,7 +31,7 @@ import google.registry.flows.EppException;
|
|||
import google.registry.flows.EppException.CommandUseErrorException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.model.domain.DomainCommand.Check;
|
||||
|
@ -69,7 +69,7 @@ public final class DomainClaimsCheckFlow implements Flow {
|
|||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject Clock clock;
|
||||
@Inject @Config("maxChecks") int maxChecks;
|
||||
|
@ -82,7 +82,7 @@ public final class DomainClaimsCheckFlow implements Flow {
|
|||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(LaunchCheckExtension.class, AllocationTokenExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
if (eppInput.getSingleExtension(AllocationTokenExtension.class).isPresent()) {
|
||||
throw new DomainClaimsCheckNotAllowedWithAllocationTokens();
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public final class DomainClaimsCheckFlow implements Flow {
|
|||
// Only validate access to a TLD the first time it is encountered.
|
||||
if (seenTlds.add(tld)) {
|
||||
if (!isSuperuser) {
|
||||
checkAllowedAccessToTld(clientId, tld);
|
||||
checkAllowedAccessToTld(registrarId, tld);
|
||||
Registry registry = Registry.get(tld);
|
||||
DateTime now = clock.nowUtc();
|
||||
verifyNotInPredelegation(registry, now);
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.domain;
|
|||
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.flows.FlowUtils.persistEntityChanges;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.COLLISION_MESSAGE;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
|
||||
|
@ -62,7 +62,7 @@ import google.registry.flows.EppException;
|
|||
import google.registry.flows.EppException.CommandUseErrorException;
|
||||
import google.registry.flows.EppException.ParameterValuePolicyErrorException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -204,7 +204,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -226,15 +226,15 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
AllocationTokenExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
verifyRegistrarIsActive(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
verifyRegistrarIsActive(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainCommand.Create command = cloneAndLinkReferences((Create) resourceCommand, now);
|
||||
Period period = command.getPeriod();
|
||||
verifyUnitIsYears(period);
|
||||
int years = period.getValue();
|
||||
validateRegistrationPeriod(years);
|
||||
verifyResourceDoesNotExist(DomainBase.class, targetId, now, clientId);
|
||||
verifyResourceDoesNotExist(DomainBase.class, targetId, now, registrarId);
|
||||
// Validate that this is actually a legal domain name on a TLD that the registrar has access to.
|
||||
InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName());
|
||||
String domainLabel = domainName.parts().get(0);
|
||||
|
@ -252,7 +252,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
}
|
||||
boolean isSunriseCreate = hasSignedMarks && (tldState == START_DATE_SUNRISE);
|
||||
Optional<AllocationToken> allocationToken =
|
||||
verifyAllocationTokenIfPresent(command, registry, clientId, now);
|
||||
verifyAllocationTokenIfPresent(command, registry, registrarId, now);
|
||||
boolean isAnchorTenant =
|
||||
isAnchorTenant(
|
||||
domainName, allocationToken, eppInput.getSingleExtension(MetadataExtension.class));
|
||||
|
@ -261,7 +261,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
// notice without specifying a claims key, ignore the registry phase, and override blocks on
|
||||
// registering premium domains.
|
||||
if (!isSuperuser) {
|
||||
checkAllowedAccessToTld(clientId, registry.getTldStr());
|
||||
checkAllowedAccessToTld(registrarId, registry.getTldStr());
|
||||
boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken);
|
||||
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, isValidReservedCreate, hasSignedMarks);
|
||||
if (launchCreate.isPresent()) {
|
||||
|
@ -276,7 +276,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
if (now.isBefore(registry.getClaimsPeriodEnd())) {
|
||||
verifyClaimsNoticeIfAndOnlyIfNeeded(domainName, hasSignedMarks, hasClaimsNotice);
|
||||
}
|
||||
verifyPremiumNameIsNotBlocked(targetId, now, clientId);
|
||||
verifyPremiumNameIsNotBlocked(targetId, now, registrarId);
|
||||
verifySignedMarkOnlyInSunrise(hasSignedMarks, tldState);
|
||||
}
|
||||
String signedMarkId = null;
|
||||
|
@ -338,8 +338,8 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
: ImmutableSet.of();
|
||||
DomainBase domain =
|
||||
new DomainBase.Builder()
|
||||
.setCreationClientId(clientId)
|
||||
.setPersistedCurrentSponsorClientId(clientId)
|
||||
.setCreationRegistrarId(registrarId)
|
||||
.setPersistedCurrentSponsorRegistrarId(registrarId)
|
||||
.setRepoId(repoId)
|
||||
.setIdnTableName(validateDomainNameWithIdnTables(domainName))
|
||||
.setRegistrationExpirationTime(registrationExpirationTime)
|
||||
|
@ -361,7 +361,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
buildDomainHistory(domain, registry, now, period, registry.getAddGracePeriodLength());
|
||||
if (reservationTypes.contains(NAME_COLLISION)) {
|
||||
entitiesToSave.add(
|
||||
createNameCollisionOneTimePollMessage(targetId, domainHistory, clientId, now));
|
||||
createNameCollisionOneTimePollMessage(targetId, domainHistory, registrarId, now));
|
||||
}
|
||||
entitiesToSave.add(
|
||||
domain,
|
||||
|
@ -472,14 +472,14 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
|
||||
/** Verifies and returns the allocation token if one is specified, otherwise does nothing. */
|
||||
private Optional<AllocationToken> verifyAllocationTokenIfPresent(
|
||||
DomainCommand.Create command, Registry registry, String clientId, DateTime now)
|
||||
DomainCommand.Create command, Registry registry, String registrarId, DateTime now)
|
||||
throws EppException {
|
||||
Optional<AllocationTokenExtension> extension =
|
||||
eppInput.getSingleExtension(AllocationTokenExtension.class);
|
||||
return Optional.ofNullable(
|
||||
extension.isPresent()
|
||||
? allocationTokenFlowUtils.loadTokenAndValidateDomainCreate(
|
||||
command, extension.get().getAllocationToken(), registry, clientId, now)
|
||||
command, extension.get().getAllocationToken(), registry, registrarId, now)
|
||||
: null);
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
return new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.CREATE)
|
||||
.setTargetId(targetId)
|
||||
.setClientId(clientId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setPeriodYears(years)
|
||||
.setCost(feesAndCredits.getCreateCost())
|
||||
.setEventTime(now)
|
||||
|
@ -545,7 +545,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
.setReason(Reason.RENEW)
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(targetId)
|
||||
.setClientId(clientId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(registrationExpirationTime)
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setParent(domainHistoryKey)
|
||||
|
@ -556,7 +556,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
Key<DomainHistory> domainHistoryKey, DateTime registrationExpirationTime) {
|
||||
return new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setClientId(clientId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(registrationExpirationTime)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
.setParentKey(domainHistoryKey)
|
||||
|
@ -568,7 +568,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
return new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.FEE_EARLY_ACCESS)
|
||||
.setTargetId(createBillingEvent.getTargetId())
|
||||
.setClientId(createBillingEvent.getClientId())
|
||||
.setRegistrarId(createBillingEvent.getRegistrarId())
|
||||
.setPeriodYears(1)
|
||||
.setCost(feesAndCredits.getEapCost())
|
||||
.setEventTime(createBillingEvent.getEventTime())
|
||||
|
@ -579,9 +579,12 @@ public class DomainCreateFlow implements TransactionalFlow {
|
|||
}
|
||||
|
||||
private static PollMessage.OneTime createNameCollisionOneTimePollMessage(
|
||||
String fullyQualifiedDomainName, HistoryEntry historyEntry, String clientId, DateTime now) {
|
||||
String fullyQualifiedDomainName,
|
||||
HistoryEntry historyEntry,
|
||||
String registrarId,
|
||||
DateTime now) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setClientId(clientId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(now)
|
||||
.setMsg(COLLISION_MESSAGE) // Remind the registrar of the name collision policy.
|
||||
.setResponseData(
|
||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.persistEntityChanges;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
|
@ -50,7 +50,7 @@ import google.registry.dns.DnsQueue;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.EppException.AssociationProhibitsOperationException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
|
@ -124,7 +124,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
@Inject EppInput eppInput;
|
||||
@Inject SessionMetadata sessionMetadata;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -141,7 +141,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
MetadataExtension.class, SecDnsCreateExtension.class, DomainDeleteSuperuserExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
// Loads the target resource if it exists
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
|
@ -153,12 +153,12 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
DomainBase.Builder builder;
|
||||
if (existingDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
|
||||
builder =
|
||||
denyPendingTransfer(existingDomain, TransferStatus.SERVER_CANCELLED, now, clientId)
|
||||
denyPendingTransfer(existingDomain, TransferStatus.SERVER_CANCELLED, now, registrarId)
|
||||
.asBuilder();
|
||||
} else {
|
||||
builder = existingDomain.asBuilder();
|
||||
}
|
||||
builder.setLastEppUpdateTime(now).setLastEppUpdateClientId(clientId);
|
||||
builder.setLastEppUpdateTime(now).setLastEppUpdateRegistrarId(registrarId);
|
||||
Duration redemptionGracePeriodLength = registry.getRedemptionGracePeriodLength();
|
||||
Duration pendingDeleteLength = registry.getPendingDeleteLength();
|
||||
Optional<DomainDeleteSuperuserExtension> domainDeleteSuperuserExtension =
|
||||
|
@ -199,7 +199,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
GracePeriodStatus.REDEMPTION,
|
||||
existingDomain.getRepoId(),
|
||||
redemptionTime,
|
||||
clientId)));
|
||||
registrarId)));
|
||||
// Note: The expiration time is unchanged, so if it's before the new deletion time, there will
|
||||
// be a "phantom autorenew" where the expiration time advances. No poll message will be
|
||||
// produced (since we are ending the autorenew recurrences at "now" below) and the billing
|
||||
|
@ -220,7 +220,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
// Send a second poll message immediately if the domain is being deleted asynchronously by a
|
||||
// registrar other than the sponsoring registrar (which will necessarily be a superuser).
|
||||
if (durationUntilDelete.isLongerThan(Duration.ZERO)
|
||||
&& !clientId.equals(existingDomain.getPersistedCurrentSponsorClientId())) {
|
||||
&& !registrarId.equals(existingDomain.getPersistedCurrentSponsorRegistrarId())) {
|
||||
entitiesToSave.add(
|
||||
createImmediateDeletePollMessage(existingDomain, domainHistoryKey, now, deletionTime));
|
||||
}
|
||||
|
@ -292,9 +292,9 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES);
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
if (!isSuperuser) {
|
||||
verifyResourceOwnership(clientId, existingDomain);
|
||||
verifyResourceOwnership(registrarId, existingDomain);
|
||||
verifyNotInPredelegation(registry, now);
|
||||
checkAllowedAccessToTld(clientId, registry.getTld().toString());
|
||||
checkAllowedAccessToTld(registrarId, registry.getTld().toString());
|
||||
}
|
||||
if (!existingDomain.getSubordinateHosts().isEmpty()) {
|
||||
throw new DomainToDeleteHasHostsException();
|
||||
|
@ -347,7 +347,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
: "Deleted by registry administrator.")
|
||||
: "Domain deleted.";
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setClientId(existingDomain.getCurrentSponsorClientId())
|
||||
.setRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(deletionTime)
|
||||
.setMsg(message)
|
||||
.setResponseData(
|
||||
|
@ -364,7 +364,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
|||
DateTime now,
|
||||
DateTime deletionTime) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setClientId(existingDomain.getPersistedCurrentSponsorClientId())
|
||||
.setRegistrarId(existingDomain.getPersistedCurrentSponsorRegistrarId())
|
||||
.setEventTime(now)
|
||||
.setParentKey(domainHistoryKey)
|
||||
.setMsg(
|
||||
|
|
|
@ -285,8 +285,8 @@ public class DomainFlowUtils {
|
|||
}
|
||||
|
||||
/** Check if the registrar running the flow has access to the TLD in question. */
|
||||
public static void checkAllowedAccessToTld(String clientId, String tld) throws EppException {
|
||||
if (!Registrar.loadByClientIdCached(clientId).get().getAllowedTlds().contains(tld)) {
|
||||
public static void checkAllowedAccessToTld(String registrarId, String tld) throws EppException {
|
||||
if (!Registrar.loadByRegistrarIdCached(registrarId).get().getAllowedTlds().contains(tld)) {
|
||||
throw new DomainFlowUtils.NotAuthorizedForTldException(tld);
|
||||
}
|
||||
}
|
||||
|
@ -464,10 +464,10 @@ public class DomainFlowUtils {
|
|||
* where it would not be allowed is if domain name is premium, and premium names are blocked by
|
||||
* this registrar.
|
||||
*/
|
||||
static void verifyPremiumNameIsNotBlocked(String domainName, DateTime priceTime, String clientId)
|
||||
throws EppException {
|
||||
static void verifyPremiumNameIsNotBlocked(
|
||||
String domainName, DateTime priceTime, String registrarId) throws EppException {
|
||||
if (isDomainPremium(domainName, priceTime)) {
|
||||
if (Registrar.loadByClientIdCached(clientId).get().getBlockPremiumNames()) {
|
||||
if (Registrar.loadByRegistrarIdCached(registrarId).get().getBlockPremiumNames()) {
|
||||
throw new PremiumNameBlockedException();
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ public class DomainFlowUtils {
|
|||
.setReason(Reason.RENEW)
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setClientId(domain.getCurrentSponsorClientId())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(domain.getRegistrationExpirationTime());
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ public class DomainFlowUtils {
|
|||
public static PollMessage.Autorenew.Builder newAutorenewPollMessage(DomainBase domain) {
|
||||
return new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(domain.getDomainName())
|
||||
.setClientId(domain.getCurrentSponsorClientId())
|
||||
.setRegistrarId(domain.getCurrentSponsorRegistrarId())
|
||||
.setEventTime(domain.getRegistrationExpirationTime())
|
||||
.setMsg("Domain was auto-renewed.");
|
||||
}
|
||||
|
@ -896,9 +896,9 @@ public class DomainFlowUtils {
|
|||
* <p>Non-active registrars are not allowed to run operations that cost money, like domain creates
|
||||
* or renews.
|
||||
*/
|
||||
static void verifyRegistrarIsActive(String clientId)
|
||||
static void verifyRegistrarIsActive(String registrarId)
|
||||
throws RegistrarMustBeActiveForThisOperationException {
|
||||
Registrar registrar = Registrar.loadByClientIdCached(clientId).get();
|
||||
Registrar registrar = Registrar.loadByRegistrarIdCached(registrarId).get();
|
||||
if (registrar.getState() != State.ACTIVE) {
|
||||
throw new RegistrarMustBeActiveForThisOperationException();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.addSecDnsExtensionIfPresent;
|
||||
|
@ -30,7 +30,7 @@ import com.google.common.net.InternetDomainName;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.flows.custom.DomainInfoFlowCustomLogic;
|
||||
|
@ -79,7 +79,7 @@ public final class DomainInfoFlow implements Flow {
|
|||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Clock clock;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -94,7 +94,7 @@ public final class DomainInfoFlow implements Flow {
|
|||
extensionManager.register(FeeInfoCommandExtensionV06.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = clock.nowUtc();
|
||||
DomainBase domain = verifyExistence(
|
||||
DomainBase.class, targetId, loadByForeignKey(DomainBase.class, targetId, now));
|
||||
|
@ -112,12 +112,12 @@ public final class DomainInfoFlow implements Flow {
|
|||
DomainInfoData.newBuilder()
|
||||
.setFullyQualifiedDomainName(domain.getDomainName())
|
||||
.setRepoId(domain.getRepoId())
|
||||
.setCurrentSponsorClientId(domain.getCurrentSponsorClientId())
|
||||
.setCurrentSponsorClientId(domain.getCurrentSponsorRegistrarId())
|
||||
.setRegistrant(
|
||||
transactIfJpaTm(() -> tm().loadByKey(domain.getRegistrant())).getContactId());
|
||||
// If authInfo is non-null, then the caller is authorized to see the full information since we
|
||||
// will have already verified the authInfo is valid.
|
||||
if (clientId.equals(domain.getCurrentSponsorClientId()) || authInfo.isPresent()) {
|
||||
if (registrarId.equals(domain.getCurrentSponsorRegistrarId()) || authInfo.isPresent()) {
|
||||
HostsRequest hostsRequest = ((Info) resourceCommand).getHostsRequest();
|
||||
infoBuilder
|
||||
.setStatusValues(domain.getStatusValues())
|
||||
|
@ -126,9 +126,9 @@ public final class DomainInfoFlow implements Flow {
|
|||
.setNameservers(hostsRequest.requestDelegated() ? domain.loadNameserverHostNames() : null)
|
||||
.setSubordinateHosts(
|
||||
hostsRequest.requestSubordinate() ? domain.getSubordinateHosts() : null)
|
||||
.setCreationClientId(domain.getCreationClientId())
|
||||
.setCreationClientId(domain.getCreationRegistrarId())
|
||||
.setCreationTime(domain.getCreationTime())
|
||||
.setLastEppUpdateClientId(domain.getLastEppUpdateClientId())
|
||||
.setLastEppUpdateClientId(domain.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(domain.getLastEppUpdateTime())
|
||||
.setRegistrationExpirationTime(domain.getRegistrationExpirationTime())
|
||||
.setLastTransferTime(domain.getLastTransferTime())
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.domain;
|
|||
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.persistEntityChanges;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
|
@ -39,7 +39,7 @@ import com.googlecode.objectify.Key;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.EppException.ParameterValueRangeErrorException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -123,7 +123,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -137,8 +137,8 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
extensionManager.register(FeeRenewCommandExtension.class, MetadataExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
verifyRegistrarIsActive(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
verifyRegistrarIsActive(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
Renew command = (Renew) resourceCommand;
|
||||
// Loads the target resource if it exists
|
||||
|
@ -182,7 +182,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
existingDomain
|
||||
.asBuilder()
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(clientId)
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.setRegistrationExpirationTime(newExpirationTime)
|
||||
.setAutorenewBillingEvent(newAutorenewEvent.createVKey())
|
||||
.setAutorenewPollMessage(newAutorenewPollMessage.createVKey())
|
||||
|
@ -250,8 +250,8 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
verifyNoDisallowedStatuses(existingDomain, RENEW_DISALLOWED_STATUSES);
|
||||
if (!isSuperuser) {
|
||||
verifyResourceOwnership(clientId, existingDomain);
|
||||
checkAllowedAccessToTld(clientId, existingDomain.getTld());
|
||||
verifyResourceOwnership(registrarId, existingDomain);
|
||||
checkAllowedAccessToTld(registrarId, existingDomain.getTld());
|
||||
}
|
||||
verifyUnitIsYears(command.getPeriod());
|
||||
// If the date they specify doesn't match the expiration, fail. (This is an idempotence check).
|
||||
|
@ -266,7 +266,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
return new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.RENEW)
|
||||
.setTargetId(targetId)
|
||||
.setClientId(clientId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setPeriodYears(years)
|
||||
.setCost(renewCost)
|
||||
.setEventTime(now)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||
|
@ -40,7 +40,7 @@ import google.registry.flows.EppException;
|
|||
import google.registry.flows.EppException.CommandUseErrorException;
|
||||
import google.registry.flows.EppException.StatusProhibitsOperationException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -116,7 +116,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -132,8 +132,8 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
MetadataExtension.class,
|
||||
RgpUpdateExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
verifyRegistrarIsActive(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
verifyRegistrarIsActive(registrarId);
|
||||
Update command = (Update) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
|
@ -174,7 +174,12 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
.build();
|
||||
DomainBase newDomain =
|
||||
performRestore(
|
||||
existingDomain, newExpirationTime, autorenewEvent, autorenewPollMessage, now, clientId);
|
||||
existingDomain,
|
||||
newExpirationTime,
|
||||
autorenewEvent,
|
||||
autorenewPollMessage,
|
||||
now,
|
||||
registrarId);
|
||||
updateForeignKeyIndexDeletionTime(newDomain);
|
||||
DomainHistory domainHistory = buildDomainHistory(newDomain, now);
|
||||
entitiesToSave.add(newDomain, domainHistory, autorenewEvent, autorenewPollMessage);
|
||||
|
@ -205,10 +210,10 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
DateTime now) throws EppException {
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
if (!isSuperuser) {
|
||||
verifyResourceOwnership(clientId, existingDomain);
|
||||
verifyResourceOwnership(registrarId, existingDomain);
|
||||
verifyNotReserved(InternetDomainName.from(targetId), false);
|
||||
verifyPremiumNameIsNotBlocked(targetId, now, clientId);
|
||||
checkAllowedAccessToTld(clientId, existingDomain.getTld());
|
||||
verifyPremiumNameIsNotBlocked(targetId, now, registrarId);
|
||||
checkAllowedAccessToTld(registrarId, existingDomain.getTld());
|
||||
}
|
||||
// No other changes can be specified on a restore request.
|
||||
if (!command.noChangesPresent()) {
|
||||
|
@ -227,7 +232,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
BillingEvent.Recurring autorenewEvent,
|
||||
PollMessage.Autorenew autorenewPollMessage,
|
||||
DateTime now,
|
||||
String clientId) {
|
||||
String registrarId) {
|
||||
return existingDomain
|
||||
.asBuilder()
|
||||
.setRegistrationExpirationTime(newExpirationTime)
|
||||
|
@ -241,7 +246,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
// it won't immediately be deleted again.
|
||||
.setAutorenewEndTime(Optional.empty())
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(clientId)
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -261,7 +266,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
|||
Key<DomainHistory> domainHistoryKey, Money cost, DateTime now) {
|
||||
return new BillingEvent.OneTime.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setClientId(clientId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setEventTime(now)
|
||||
.setBillingTime(now)
|
||||
.setPeriodYears(1)
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.domain;
|
|||
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.computeExDateForApprovalTime;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
|
@ -40,7 +40,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -89,7 +89,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -104,18 +104,18 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
verifyHasPendingTransfer(existingDomain);
|
||||
verifyResourceOwnership(clientId, existingDomain);
|
||||
verifyResourceOwnership(registrarId, existingDomain);
|
||||
String tld = existingDomain.getTld();
|
||||
if (!isSuperuser) {
|
||||
checkAllowedAccessToTld(clientId, tld);
|
||||
checkAllowedAccessToTld(registrarId, tld);
|
||||
}
|
||||
DomainTransferData transferData = existingDomain.getTransferData();
|
||||
String gainingClientId = transferData.getGainingClientId();
|
||||
String gainingRegistrarId = transferData.getGainingRegistrarId();
|
||||
// Create a transfer billing event for 1 year, unless the superuser extension was used to set
|
||||
// the transfer period to zero. There is not a transfer cost if the transfer period is zero.
|
||||
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
|
||||
|
@ -127,7 +127,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.TRANSFER)
|
||||
.setTargetId(targetId)
|
||||
.setClientId(gainingClientId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setPeriodYears(1)
|
||||
.setCost(getDomainRenewCost(targetId, transferData.getTransferRequestTime(), 1))
|
||||
.setEventTime(now)
|
||||
|
@ -162,7 +162,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
.setReason(Reason.RENEW)
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(targetId)
|
||||
.setClientId(gainingClientId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setParent(domainHistoryKey)
|
||||
|
@ -171,7 +171,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
PollMessage.Autorenew gainingClientAutorenewPollMessage =
|
||||
new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setClientId(gainingClientId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(newExpirationTime)
|
||||
.setAutorenewEndTime(END_OF_TIME)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
|
@ -206,10 +206,10 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
oneTime)))
|
||||
.orElseGet(ImmutableSet::of))
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(clientId)
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.build();
|
||||
Registry registry = Registry.get(existingDomain.getTld());
|
||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, gainingClientId);
|
||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, gainingRegistrarId);
|
||||
// Create a poll message for the gaining client.
|
||||
PollMessage gainingClientPollMessage =
|
||||
createGainingTransferPollMessage(
|
||||
|
@ -232,7 +232,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
}
|
||||
|
||||
private DomainHistory buildDomainHistory(
|
||||
DomainBase newDomain, Registry registry, DateTime now, String gainingClientId) {
|
||||
DomainBase newDomain, Registry registry, DateTime now, String gainingRegistrarId) {
|
||||
ImmutableSet<DomainTransactionRecord> cancelingRecords =
|
||||
createCancelingRecords(
|
||||
newDomain,
|
||||
|
@ -241,7 +241,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
|||
ImmutableSet.of(TRANSFER_SUCCESSFUL));
|
||||
return historyBuilder
|
||||
.setType(DOMAIN_TRANSFER_APPROVE)
|
||||
.setOtherClientId(gainingClientId)
|
||||
.setOtherRegistrarId(gainingRegistrarId)
|
||||
.setDomain(newDomain)
|
||||
.setDomainTransactionRecords(
|
||||
union(
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
|
@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -76,7 +76,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -87,24 +87,24 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
verifyHasPendingTransfer(existingDomain);
|
||||
verifyTransferInitiator(clientId, existingDomain);
|
||||
verifyTransferInitiator(registrarId, existingDomain);
|
||||
if (!isSuperuser) {
|
||||
checkAllowedAccessToTld(clientId, existingDomain.getTld());
|
||||
checkAllowedAccessToTld(registrarId, existingDomain.getTld());
|
||||
}
|
||||
Registry registry = Registry.get(existingDomain.getTld());
|
||||
|
||||
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
|
||||
historyBuilder
|
||||
.setId(domainHistoryKey.getId())
|
||||
.setOtherClientId(existingDomain.getTransferData().getLosingClientId());
|
||||
.setOtherRegistrarId(existingDomain.getTransferData().getLosingRegistrarId());
|
||||
|
||||
DomainBase newDomain =
|
||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, clientId);
|
||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, registrarId);
|
||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now);
|
||||
tm().putAll(
|
||||
newDomain,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse;
|
||||
|
@ -22,7 +22,7 @@ import static google.registry.flows.domain.DomainTransferUtils.createTransferRes
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.ResourceFlowUtils;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -59,7 +59,7 @@ public final class DomainTransferQueryFlow implements Flow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Clock clock;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -68,7 +68,7 @@ public final class DomainTransferQueryFlow implements Flow {
|
|||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = clock.nowUtc();
|
||||
DomainBase domain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, domain);
|
||||
|
@ -81,8 +81,8 @@ public final class DomainTransferQueryFlow implements Flow {
|
|||
// Note that the authorization info on the command (if present) has already been verified. If
|
||||
// it's present, then the other checks are unnecessary.
|
||||
if (!authInfo.isPresent()
|
||||
&& !clientId.equals(transferData.getGainingClientId())
|
||||
&& !clientId.equals(transferData.getLosingClientId())) {
|
||||
&& !registrarId.equals(transferData.getGainingRegistrarId())
|
||||
&& !registrarId.equals(transferData.getLosingRegistrarId())) {
|
||||
throw new NotAuthorizedToViewTransferException();
|
||||
}
|
||||
DateTime newExpirationTime = null;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
|
||||
|
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -78,7 +78,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -89,23 +89,23 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
Registry registry = Registry.get(existingDomain.getTld());
|
||||
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
|
||||
historyBuilder
|
||||
.setId(domainHistoryKey.getId())
|
||||
.setOtherClientId(existingDomain.getTransferData().getGainingClientId());
|
||||
.setOtherRegistrarId(existingDomain.getTransferData().getGainingRegistrarId());
|
||||
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
verifyHasPendingTransfer(existingDomain);
|
||||
verifyResourceOwnership(clientId, existingDomain);
|
||||
verifyResourceOwnership(registrarId, existingDomain);
|
||||
if (!isSuperuser) {
|
||||
checkAllowedAccessToTld(clientId, existingDomain.getTld());
|
||||
checkAllowedAccessToTld(registrarId, existingDomain.getTld());
|
||||
}
|
||||
DomainBase newDomain =
|
||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, clientId);
|
||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, registrarId);
|
||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now);
|
||||
tm().putAll(
|
||||
newDomain,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.FlowUtils.createHistoryKey;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.computeExDateForApprovalTime;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo;
|
||||
|
@ -41,7 +41,7 @@ import com.googlecode.objectify.Key;
|
|||
import google.registry.batch.AsyncTaskEnqueuer;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -125,7 +125,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String gainingClientId;
|
||||
@Inject @RegistrarId String gainingClientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -142,7 +142,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
FeeTransferCommandExtension.class,
|
||||
MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(gainingClientId);
|
||||
validateRegistrarIsLoggedIn(gainingClientId);
|
||||
verifyRegistrarIsActive(gainingClientId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
|
@ -174,7 +174,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
|
||||
historyBuilder
|
||||
.setId(domainHistoryKey.getId())
|
||||
.setOtherClientId(existingDomain.getCurrentSponsorClientId());
|
||||
.setOtherRegistrarId(existingDomain.getCurrentSponsorRegistrarId());
|
||||
DateTime automaticTransferTime =
|
||||
superuserExtension.isPresent()
|
||||
? now.plusDays(superuserExtension.get().getAutomaticTransferLength())
|
||||
|
@ -207,8 +207,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
new DomainTransferData.Builder()
|
||||
.setTransferRequestTrid(trid)
|
||||
.setTransferRequestTime(now)
|
||||
.setGainingClientId(gainingClientId)
|
||||
.setLosingClientId(existingDomain.getCurrentSponsorClientId())
|
||||
.setGainingRegistrarId(gainingClientId)
|
||||
.setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
|
||||
.setPendingTransferExpirationTime(automaticTransferTime)
|
||||
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime),
|
||||
serverApproveEntities,
|
||||
|
@ -231,7 +231,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
.setTransferData(pendingTransferData)
|
||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(gainingClientId)
|
||||
.setLastEppUpdateRegistrarId(gainingClientId)
|
||||
.build();
|
||||
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, period);
|
||||
|
||||
|
@ -264,7 +264,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
throw new AlreadyPendingTransferException(targetId);
|
||||
}
|
||||
// Verify that this client doesn't already sponsor this resource.
|
||||
if (gainingClientId.equals(existingDomain.getCurrentSponsorClientId())) {
|
||||
if (gainingClientId.equals(existingDomain.getCurrentSponsorRegistrarId())) {
|
||||
throw new ObjectAlreadySponsoredException();
|
||||
}
|
||||
verifyTransferPeriod(period, superuserExtension);
|
||||
|
|
|
@ -108,7 +108,7 @@ public final class DomainTransferUtils {
|
|||
Key<DomainHistory> domainHistoryKey,
|
||||
DomainBase existingDomain,
|
||||
Trid trid,
|
||||
String gainingClientId,
|
||||
String gainingRegistrarId,
|
||||
Optional<Money> transferCost,
|
||||
DateTime now) {
|
||||
String targetId = existingDomain.getDomainName();
|
||||
|
@ -117,8 +117,8 @@ public final class DomainTransferUtils {
|
|||
new DomainTransferData.Builder()
|
||||
.setTransferRequestTrid(trid)
|
||||
.setTransferRequestTime(now)
|
||||
.setGainingClientId(gainingClientId)
|
||||
.setLosingClientId(existingDomain.getCurrentSponsorClientId())
|
||||
.setGainingRegistrarId(gainingRegistrarId)
|
||||
.setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
|
||||
.setPendingTransferExpirationTime(automaticTransferTime)
|
||||
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime)
|
||||
.setTransferStatus(TransferStatus.SERVER_APPROVED)
|
||||
|
@ -132,7 +132,7 @@ public final class DomainTransferUtils {
|
|||
automaticTransferTime,
|
||||
domainHistoryKey,
|
||||
targetId,
|
||||
gainingClientId,
|
||||
gainingRegistrarId,
|
||||
registry,
|
||||
cost)));
|
||||
createOptionalAutorenewCancellation(
|
||||
|
@ -141,10 +141,10 @@ public final class DomainTransferUtils {
|
|||
return builder
|
||||
.add(
|
||||
createGainingClientAutorenewEvent(
|
||||
serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingClientId))
|
||||
serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingRegistrarId))
|
||||
.add(
|
||||
createGainingClientAutorenewPollMessage(
|
||||
serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingClientId))
|
||||
serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingRegistrarId))
|
||||
.add(
|
||||
createGainingTransferPollMessage(
|
||||
targetId,
|
||||
|
@ -169,7 +169,7 @@ public final class DomainTransferUtils {
|
|||
DateTime now,
|
||||
Key<DomainHistory> domainHistoryKey) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setClientId(transferData.getGainingClientId())
|
||||
.setRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setEventTime(transferData.getPendingTransferExpirationTime())
|
||||
.setMsg(transferData.getTransferStatus().getMessage())
|
||||
.setResponseData(
|
||||
|
@ -191,7 +191,7 @@ public final class DomainTransferUtils {
|
|||
@Nullable DateTime extendedRegistrationExpirationTime,
|
||||
Key<DomainHistory> domainHistoryKey) {
|
||||
return new PollMessage.OneTime.Builder()
|
||||
.setClientId(transferData.getLosingClientId())
|
||||
.setRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setEventTime(transferData.getPendingTransferExpirationTime())
|
||||
.setMsg(transferData.getTransferStatus().getMessage())
|
||||
.setResponseData(
|
||||
|
@ -208,8 +208,8 @@ public final class DomainTransferUtils {
|
|||
@Nullable DateTime extendedRegistrationExpirationTime) {
|
||||
return new DomainTransferResponse.Builder()
|
||||
.setFullyQualifiedDomainName(targetId)
|
||||
.setGainingClientId(transferData.getGainingClientId())
|
||||
.setLosingClientId(transferData.getLosingClientId())
|
||||
.setGainingRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
|
||||
.setTransferRequestTime(transferData.getTransferRequestTime())
|
||||
.setTransferStatus(transferData.getTransferStatus())
|
||||
|
@ -221,10 +221,10 @@ public final class DomainTransferUtils {
|
|||
DateTime serverApproveNewExpirationTime,
|
||||
Key<DomainHistory> domainHistoryKey,
|
||||
String targetId,
|
||||
String gainingClientId) {
|
||||
String gainingRegistrarId) {
|
||||
return new PollMessage.Autorenew.Builder()
|
||||
.setTargetId(targetId)
|
||||
.setClientId(gainingClientId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(serverApproveNewExpirationTime)
|
||||
.setAutorenewEndTime(END_OF_TIME)
|
||||
.setMsg("Domain was auto-renewed.")
|
||||
|
@ -236,12 +236,12 @@ public final class DomainTransferUtils {
|
|||
DateTime serverApproveNewExpirationTime,
|
||||
Key<DomainHistory> domainHistoryKey,
|
||||
String targetId,
|
||||
String gainingClientId) {
|
||||
String gainingRegistrarId) {
|
||||
return new BillingEvent.Recurring.Builder()
|
||||
.setReason(Reason.RENEW)
|
||||
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
|
||||
.setTargetId(targetId)
|
||||
.setClientId(gainingClientId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setEventTime(serverApproveNewExpirationTime)
|
||||
.setRecurrenceEndTime(END_OF_TIME)
|
||||
.setParent(domainHistoryKey)
|
||||
|
@ -291,13 +291,13 @@ public final class DomainTransferUtils {
|
|||
DateTime automaticTransferTime,
|
||||
Key<DomainHistory> domainHistoryKey,
|
||||
String targetId,
|
||||
String gainingClientId,
|
||||
String gainingRegistrarId,
|
||||
Registry registry,
|
||||
Money transferCost) {
|
||||
return new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.TRANSFER)
|
||||
.setTargetId(targetId)
|
||||
.setClientId(gainingClientId)
|
||||
.setRegistrarId(gainingRegistrarId)
|
||||
.setCost(transferCost)
|
||||
.setPeriodYears(1)
|
||||
.setEventTime(automaticTransferTime)
|
||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
|||
import static com.google.common.collect.Sets.symmetricDifference;
|
||||
import static com.google.common.collect.Sets.union;
|
||||
import static google.registry.flows.FlowUtils.persistEntityChanges;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.checkSameValuesNotAddedAndRemoved;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable;
|
||||
|
@ -47,7 +47,7 @@ import com.google.common.net.InternetDomainName;
|
|||
import google.registry.dns.DnsQueue;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -139,7 +139,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
|||
@Inject ExtensionManager extensionManager;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
|
@ -158,7 +158,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
|||
DomainUpdateSuperuserExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
Update command = cloneAndLinkReferences((Update) resourceCommand, now);
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
|
@ -197,10 +197,10 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
|||
String tld = existingDomain.getTld();
|
||||
if (!isSuperuser) {
|
||||
verifyNoDisallowedStatuses(existingDomain, UPDATE_DISALLOWED_STATUSES);
|
||||
verifyResourceOwnership(clientId, existingDomain);
|
||||
verifyResourceOwnership(registrarId, existingDomain);
|
||||
verifyClientUpdateNotProhibited(command, existingDomain);
|
||||
verifyAllStatusesAreClientSettable(union(add.getStatusValues(), remove.getStatusValues()));
|
||||
checkAllowedAccessToTld(clientId, tld);
|
||||
checkAllowedAccessToTld(registrarId, tld);
|
||||
}
|
||||
Registry registry = Registry.get(tld);
|
||||
Optional<FeeUpdateCommandExtension> feeUpdate =
|
||||
|
@ -244,7 +244,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
|||
secDnsUpdate.get())
|
||||
: domain.getDsData())
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(clientId)
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.addStatusValues(add.getStatusValues())
|
||||
.removeStatusValues(remove.getStatusValues())
|
||||
.addNameservers(add.getNameservers().stream().collect(toImmutableSet()))
|
||||
|
@ -291,10 +291,11 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
|||
: symmetricDifference(existingDomain.getStatusValues(), newDomain.getStatusValues())) {
|
||||
if (statusValue.isChargedStatus()) {
|
||||
// Only charge once.
|
||||
return Optional.of(new BillingEvent.OneTime.Builder()
|
||||
return Optional.of(
|
||||
new BillingEvent.OneTime.Builder()
|
||||
.setReason(Reason.SERVER_STATUS)
|
||||
.setTargetId(targetId)
|
||||
.setClientId(clientId)
|
||||
.setRegistrarId(registrarId)
|
||||
.setCost(Registry.get(existingDomain.getTld()).getServerStatusChangeCost())
|
||||
.setEventTime(now)
|
||||
.setBillingTime(now)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class AllocationTokenCustomLogic {
|
|||
DomainCommand.Create command,
|
||||
AllocationToken token,
|
||||
Registry registry,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
DateTime now)
|
||||
throws EppException {
|
||||
// Do nothing.
|
||||
|
@ -47,7 +47,7 @@ public class AllocationTokenCustomLogic {
|
|||
public ImmutableMap<InternetDomainName, String> checkDomainsWithToken(
|
||||
ImmutableList<InternetDomainName> domainNames,
|
||||
AllocationToken token,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
DateTime now) {
|
||||
// Do nothing.
|
||||
return Maps.toMap(domainNames, k -> "");
|
||||
|
|
|
@ -58,12 +58,19 @@ public class AllocationTokenFlowUtils {
|
|||
* for this request.
|
||||
*/
|
||||
public AllocationToken loadTokenAndValidateDomainCreate(
|
||||
DomainCommand.Create command, String token, Registry registry, String clientId, DateTime now)
|
||||
DomainCommand.Create command,
|
||||
String token,
|
||||
Registry registry,
|
||||
String registrarId,
|
||||
DateTime now)
|
||||
throws EppException {
|
||||
AllocationToken tokenEntity = loadToken(token);
|
||||
validateToken(
|
||||
InternetDomainName.from(command.getFullyQualifiedDomainName()), tokenEntity, clientId, now);
|
||||
return tokenCustomLogic.validateToken(command, tokenEntity, registry, clientId, now);
|
||||
InternetDomainName.from(command.getFullyQualifiedDomainName()),
|
||||
tokenEntity,
|
||||
registrarId,
|
||||
now);
|
||||
return tokenCustomLogic.validateToken(command, tokenEntity, registry, registrarId, now);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +81,7 @@ public class AllocationTokenFlowUtils {
|
|||
* validate have blank messages (i.e. no error).
|
||||
*/
|
||||
public AllocationTokenDomainCheckResults checkDomainsWithToken(
|
||||
List<InternetDomainName> domainNames, String token, String clientId, DateTime now) {
|
||||
List<InternetDomainName> domainNames, String token, String registrarId, DateTime now) {
|
||||
// If the token is completely invalid, return the error message for all domain names
|
||||
AllocationToken tokenEntity;
|
||||
try {
|
||||
|
@ -91,7 +98,7 @@ public class AllocationTokenFlowUtils {
|
|||
ImmutableMap.Builder<InternetDomainName, String> resultsBuilder = new ImmutableMap.Builder<>();
|
||||
for (InternetDomainName domainName : domainNames) {
|
||||
try {
|
||||
validateToken(domainName, tokenEntity, clientId, now);
|
||||
validateToken(domainName, tokenEntity, registrarId, now);
|
||||
validDomainNames.add(domainName);
|
||||
} catch (EppException e) {
|
||||
resultsBuilder.put(domainName, e.getMessage());
|
||||
|
@ -101,7 +108,7 @@ public class AllocationTokenFlowUtils {
|
|||
// For all valid domain names, run the custom logic and include the results
|
||||
resultsBuilder.putAll(
|
||||
tokenCustomLogic.checkDomainsWithToken(
|
||||
validDomainNames.build(), tokenEntity, clientId, now));
|
||||
validDomainNames.build(), tokenEntity, registrarId, now));
|
||||
return AllocationTokenDomainCheckResults.create(
|
||||
Optional.of(tokenEntity), resultsBuilder.build());
|
||||
}
|
||||
|
@ -123,10 +130,10 @@ public class AllocationTokenFlowUtils {
|
|||
* @throws EppException if the token is invalid in any way
|
||||
*/
|
||||
private void validateToken(
|
||||
InternetDomainName domainName, AllocationToken token, String clientId, DateTime now)
|
||||
InternetDomainName domainName, AllocationToken token, String registrarId, DateTime now)
|
||||
throws EppException {
|
||||
if (!token.getAllowedRegistrarIds().isEmpty()
|
||||
&& !token.getAllowedRegistrarIds().contains(clientId)) {
|
||||
&& !token.getAllowedRegistrarIds().contains(registrarId)) {
|
||||
throw new AllocationTokenNotValidForRegistrarException();
|
||||
}
|
||||
if (!token.getAllowedTlds().isEmpty()
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount;
|
||||
import static google.registry.model.EppResourceUtils.checkResourcesExist;
|
||||
|
||||
|
@ -24,7 +24,7 @@ import google.registry.config.RegistryConfig.Config;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
import google.registry.model.eppoutput.CheckData.HostCheck;
|
||||
|
@ -47,7 +47,7 @@ import javax.inject.Inject;
|
|||
public final class HostCheckFlow implements Flow {
|
||||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @Config("maxChecks") int maxChecks;
|
||||
@Inject Clock clock;
|
||||
|
@ -57,7 +57,7 @@ public final class HostCheckFlow implements Flow {
|
|||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
ImmutableList<String> hostnames = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(hostnames, maxChecks);
|
||||
ImmutableSet<String> existingIds =
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist;
|
||||
import static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain;
|
||||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||
|
@ -34,7 +34,7 @@ import google.registry.flows.EppException;
|
|||
import google.registry.flows.EppException.ParameterValueRangeErrorException;
|
||||
import google.registry.flows.EppException.RequiredParameterMissingException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
|
@ -84,7 +84,7 @@ public final class HostCreateFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject HostHistory.Builder historyBuilder;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
|
@ -101,17 +101,17 @@ public final class HostCreateFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
Create command = (Create) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
verifyResourceDoesNotExist(HostResource.class, targetId, now, clientId);
|
||||
verifyResourceDoesNotExist(HostResource.class, targetId, now, registrarId);
|
||||
// The superordinate domain of the host object if creating an in-bailiwick host, or null if
|
||||
// creating an external host. This is looked up before we actually create the Host object so
|
||||
// we can detect error conditions earlier.
|
||||
Optional<DomainBase> superordinateDomain =
|
||||
lookupSuperordinateDomain(validateHostName(targetId), now);
|
||||
verifySuperordinateDomainNotInPendingDelete(superordinateDomain.orElse(null));
|
||||
verifySuperordinateDomainOwnership(clientId, superordinateDomain.orElse(null));
|
||||
verifySuperordinateDomainOwnership(registrarId, superordinateDomain.orElse(null));
|
||||
boolean willBeSubordinate = superordinateDomain.isPresent();
|
||||
boolean hasIpAddresses = !isNullOrEmpty(command.getInetAddresses());
|
||||
if (willBeSubordinate != hasIpAddresses) {
|
||||
|
@ -122,8 +122,8 @@ public final class HostCreateFlow implements TransactionalFlow {
|
|||
}
|
||||
HostResource newHost =
|
||||
new HostResource.Builder()
|
||||
.setCreationClientId(clientId)
|
||||
.setPersistedCurrentSponsorClientId(clientId)
|
||||
.setCreationRegistrarId(registrarId)
|
||||
.setPersistedCurrentSponsorRegistrarId(registrarId)
|
||||
.setHostName(targetId)
|
||||
.setInetAddresses(command.getInetAddresses())
|
||||
.setRepoId(createRepoId(allocateId(), roidSuffix))
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.checkLinkedDomains;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
|
||||
|
@ -29,7 +29,7 @@ import google.registry.batch.AsyncTaskEnqueuer;
|
|||
import google.registry.dns.DnsQueue;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -78,7 +78,7 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
|||
private static final DnsQueue dnsQueue = DnsQueue.create();
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Trid trid;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
|
@ -93,7 +93,7 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
DateTime now = tm().getTransactionTime();
|
||||
validateHostName(targetId);
|
||||
checkLinkedDomains(targetId, now, HostResource.class, DomainBase::getNameservers);
|
||||
|
@ -106,14 +106,14 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
|||
existingHost.isSubordinate()
|
||||
? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now)
|
||||
: existingHost;
|
||||
verifyResourceOwnership(clientId, owningResource);
|
||||
verifyResourceOwnership(registrarId, owningResource);
|
||||
}
|
||||
HistoryEntry.Type historyEntryType;
|
||||
Result.Code resultCode;
|
||||
HostResource newHost;
|
||||
if (tm().isOfy()) {
|
||||
asyncTaskEnqueuer.enqueueAsyncDelete(
|
||||
existingHost, tm().getTransactionTime(), clientId, trid, isSuperuser);
|
||||
existingHost, tm().getTransactionTime(), registrarId, trid, isSuperuser);
|
||||
newHost = existingHost.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build();
|
||||
historyEntryType = Type.HOST_PENDING_DELETE;
|
||||
resultCode = SUCCESS_WITH_ACTION_PENDING;
|
||||
|
|
|
@ -105,11 +105,11 @@ public class HostFlowUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/** Ensure that the superordinate domain is sponsored by the provided clientId. */
|
||||
static void verifySuperordinateDomainOwnership(
|
||||
String clientId, DomainBase superordinateDomain) throws EppException {
|
||||
/** Ensure that the superordinate domain is sponsored by the provided registrar ID. */
|
||||
static void verifySuperordinateDomainOwnership(String registrarId, DomainBase superordinateDomain)
|
||||
throws EppException {
|
||||
if (superordinateDomain != null
|
||||
&& !clientId.equals(superordinateDomain.getCurrentSponsorClientId())) {
|
||||
&& !registrarId.equals(superordinateDomain.getCurrentSponsorRegistrarId())) {
|
||||
throw new HostDomainNotOwnedException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||
import static google.registry.model.EppResourceUtils.isLinked;
|
||||
|
@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.annotations.ReportingSpec;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
|
@ -53,7 +53,7 @@ import org.joda.time.DateTime;
|
|||
public final class HostInfoFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Clock clock;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -62,7 +62,7 @@ public final class HostInfoFlow implements Flow {
|
|||
@Override
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
validateHostName(targetId);
|
||||
DateTime now = clock.nowUtc();
|
||||
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
|
||||
|
@ -80,14 +80,14 @@ public final class HostInfoFlow implements Flow {
|
|||
transactIfJpaTm(
|
||||
() -> tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now));
|
||||
hostInfoDataBuilder
|
||||
.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId())
|
||||
.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorRegistrarId())
|
||||
.setLastTransferTime(host.computeLastTransferTime(superordinateDomain));
|
||||
if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
|
||||
statusValues.add(StatusValue.PENDING_TRANSFER);
|
||||
}
|
||||
} else {
|
||||
hostInfoDataBuilder
|
||||
.setCurrentSponsorClientId(host.getPersistedCurrentSponsorClientId())
|
||||
.setCurrentSponsorClientId(host.getPersistedCurrentSponsorRegistrarId())
|
||||
.setLastTransferTime(host.getLastTransferTime());
|
||||
}
|
||||
return responseBuilder
|
||||
|
@ -97,9 +97,9 @@ public final class HostInfoFlow implements Flow {
|
|||
.setRepoId(host.getRepoId())
|
||||
.setStatusValues(statusValues.build())
|
||||
.setInetAddresses(host.getInetAddresses())
|
||||
.setCreationClientId(host.getCreationClientId())
|
||||
.setCreationClientId(host.getCreationRegistrarId())
|
||||
.setCreationTime(host.getCreationTime())
|
||||
.setLastEppUpdateClientId(host.getLastEppUpdateClientId())
|
||||
.setLastEppUpdateClientId(host.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(host.getLastEppUpdateTime())
|
||||
.build())
|
||||
.build();
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.flows.host;
|
|||
|
||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.common.collect.Sets.union;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.checkSameValuesNotAddedAndRemoved;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable;
|
||||
|
@ -39,7 +39,7 @@ import google.registry.flows.EppException.ObjectAlreadyExistsException;
|
|||
import google.registry.flows.EppException.ParameterValueRangeErrorException;
|
||||
import google.registry.flows.EppException.StatusProhibitsOperationException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
|
@ -113,7 +113,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
|||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject HostHistory.Builder historyBuilder;
|
||||
|
@ -126,7 +126,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
|||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
Update command = (Update) resourceCommand;
|
||||
Change change = command.getInnerChange();
|
||||
String suppliedNewHostName = change.getFullyQualifiedHostName();
|
||||
|
@ -170,10 +170,10 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
|||
// since external hosts store their own clientId. For subordinate hosts the canonical clientId
|
||||
// comes from the superordinate domain, but we might as well update the persisted value. For
|
||||
// non-superusers this is the flow clientId, but for superusers it might not be, so compute it.
|
||||
String newPersistedClientId =
|
||||
String newPersistedRegistrarId =
|
||||
newSuperordinateDomain.isPresent()
|
||||
? newSuperordinateDomain.get().getCurrentSponsorClientId()
|
||||
: owningResource.getPersistedCurrentSponsorClientId();
|
||||
? newSuperordinateDomain.get().getCurrentSponsorRegistrarId()
|
||||
: owningResource.getPersistedCurrentSponsorRegistrarId();
|
||||
HostResource newHost =
|
||||
existingHost
|
||||
.asBuilder()
|
||||
|
@ -183,11 +183,11 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
|||
.addInetAddresses(add.getInetAddresses())
|
||||
.removeInetAddresses(remove.getInetAddresses())
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(clientId)
|
||||
.setLastEppUpdateRegistrarId(registrarId)
|
||||
.setSuperordinateDomain(newSuperordinateDomainKey)
|
||||
.setLastSuperordinateChange(lastSuperordinateChange)
|
||||
.setLastTransferTime(lastTransferTime)
|
||||
.setPersistedCurrentSponsorClientId(newPersistedClientId)
|
||||
.setPersistedCurrentSponsorRegistrarId(newPersistedRegistrarId)
|
||||
.build();
|
||||
verifyHasIpsIffIsExternal(command, existingHost, newHost);
|
||||
ImmutableSet.Builder<ImmutableObject> entitiesToInsert = new ImmutableSet.Builder<>();
|
||||
|
@ -217,12 +217,12 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
|||
if (!isSuperuser) {
|
||||
// Verify that the host belongs to this registrar, either directly or because it is currently
|
||||
// subordinate to a domain owned by this registrar.
|
||||
verifyResourceOwnership(clientId, owningResource);
|
||||
verifyResourceOwnership(registrarId, owningResource);
|
||||
if (isHostRename && !existingHost.isSubordinate()) {
|
||||
throw new CannotRenameExternalHostException();
|
||||
}
|
||||
// Verify that the new superordinate domain belongs to this registrar.
|
||||
verifySuperordinateDomainOwnership(clientId, newSuperordinateDomain);
|
||||
verifySuperordinateDomainOwnership(registrarId, newSuperordinateDomain);
|
||||
ImmutableSet<StatusValue> statusesToAdd = command.getInnerAdd().getStatusValues();
|
||||
ImmutableSet<StatusValue> statusesToRemove = command.getInnerRemove().getStatusValues();
|
||||
// If the resource is marked with clientUpdateProhibited, and this update does not clear that
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.poll;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.poll.PollFlowUtils.ackPollMessage;
|
||||
import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_NO_MESSAGES;
|
||||
|
@ -29,8 +29,8 @@ import google.registry.flows.EppException.ObjectDoesNotExistException;
|
|||
import google.registry.flows.EppException.ParameterValueSyntaxErrorException;
|
||||
import google.registry.flows.EppException.RequiredParameterMissingException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.PollMessageId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import google.registry.model.poll.MessageQueueInfo;
|
||||
|
@ -58,15 +58,16 @@ import org.joda.time.DateTime;
|
|||
public class PollAckFlow implements TransactionalFlow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @PollMessageId String messageId;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
||||
@Inject PollAckFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
if (messageId.isEmpty()) {
|
||||
throw new MissingMessageIdException();
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ public class PollAckFlow implements TransactionalFlow {
|
|||
|
||||
// Make sure this client is authorized to ack this message. It could be that the message is
|
||||
// supposed to go to a different registrar.
|
||||
if (!clientId.equals(pollMessage.getClientId())) {
|
||||
if (!registrarId.equals(pollMessage.getRegistrarId())) {
|
||||
throw new NotAuthorizedToAckMessageException();
|
||||
}
|
||||
|
||||
|
@ -107,7 +108,7 @@ public class PollAckFlow implements TransactionalFlow {
|
|||
// acked, then we return a special status code indicating that. Note that the query will
|
||||
// include the message being acked.
|
||||
|
||||
int messageCount = tm().doTransactionless(() -> getPollMessageCount(clientId, now));
|
||||
int messageCount = tm().doTransactionless(() -> getPollMessageCount(registrarId, now));
|
||||
// Within the same transaction, Datastore will not reflect the updated count (potentially
|
||||
// reduced by one thanks to the acked poll message). SQL will, however, so we shouldn't reduce
|
||||
// the count in the SQL case.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.poll;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.flows.poll.PollFlowUtils.getFirstPollMessage;
|
||||
import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACK_MESSAGE;
|
||||
|
@ -25,8 +25,8 @@ import google.registry.flows.EppException;
|
|||
import google.registry.flows.EppException.ParameterValueSyntaxErrorException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.PollMessageId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import google.registry.model.poll.MessageQueueInfo;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
|
@ -50,7 +50,7 @@ import org.joda.time.DateTime;
|
|||
public class PollRequestFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @PollMessageId String messageId;
|
||||
@Inject Clock clock;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
@ -59,13 +59,13 @@ public class PollRequestFlow implements Flow {
|
|||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
if (!messageId.isEmpty()) {
|
||||
throw new UnexpectedMessageIdException();
|
||||
}
|
||||
// Return the oldest message from the queue.
|
||||
DateTime now = clock.nowUtc();
|
||||
Optional<PollMessage> maybePollMessage = getFirstPollMessage(clientId, now);
|
||||
Optional<PollMessage> maybePollMessage = getFirstPollMessage(registrarId, now);
|
||||
if (!maybePollMessage.isPresent()) {
|
||||
return responseBuilder.setResultFromCode(SUCCESS_WITH_NO_MESSAGES).build();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class PollRequestFlow implements Flow {
|
|||
new MessageQueueInfo.Builder()
|
||||
.setQueueDate(pollMessage.getEventTime())
|
||||
.setMsg(pollMessage.getMsg())
|
||||
.setQueueLength(getPollMessageCount(clientId, now))
|
||||
.setQueueLength(getPollMessageCount(registrarId, now))
|
||||
.setMessageId(makePollMessageExternalId(pollMessage))
|
||||
.build())
|
||||
.setMultipleResData(pollMessage.getResponseData())
|
||||
|
|
|
@ -30,7 +30,7 @@ import google.registry.flows.EppException.UnimplementedObjectServiceException;
|
|||
import google.registry.flows.EppException.UnimplementedOptionException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.TransportCredentials;
|
||||
import google.registry.model.eppcommon.ProtocolDefinition;
|
||||
|
@ -56,7 +56,7 @@ import javax.inject.Inject;
|
|||
* @error {@link google.registry.flows.TlsCredentials.MissingRegistrarCertificateException}
|
||||
* @error {@link google.registry.flows.TransportCredentials.BadRegistrarPasswordException}
|
||||
* @error {@link LoginFlow.AlreadyLoggedInException}
|
||||
* @error {@link LoginFlow.BadRegistrarClientIdException}
|
||||
* @error {@link BadRegistrarIdException}
|
||||
* @error {@link LoginFlow.TooManyFailedLoginsException}
|
||||
* @error {@link LoginFlow.PasswordChangesNotSupportedException}
|
||||
* @error {@link LoginFlow.RegistrarAccountNotActiveException}
|
||||
|
@ -73,8 +73,9 @@ public class LoginFlow implements Flow {
|
|||
@Inject EppInput eppInput;
|
||||
@Inject SessionMetadata sessionMetadata;
|
||||
@Inject TransportCredentials credentials;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
|
||||
@Inject LoginFlow() {}
|
||||
|
||||
/** Run the flow and log errors. */
|
||||
|
@ -92,7 +93,7 @@ public class LoginFlow implements Flow {
|
|||
public final EppResponse runWithoutLogging() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
Login login = (Login) eppInput.getCommandWrapper().getCommand();
|
||||
if (!clientId.isEmpty()) {
|
||||
if (!registrarId.isEmpty()) {
|
||||
throw new AlreadyLoggedInException();
|
||||
}
|
||||
Options options = login.getOptions();
|
||||
|
@ -114,9 +115,9 @@ public class LoginFlow implements Flow {
|
|||
}
|
||||
serviceExtensionUrisBuilder.add(uri);
|
||||
}
|
||||
Optional<Registrar> registrar = Registrar.loadByClientIdCached(login.getClientId());
|
||||
Optional<Registrar> registrar = Registrar.loadByRegistrarIdCached(login.getClientId());
|
||||
if (!registrar.isPresent()) {
|
||||
throw new BadRegistrarClientIdException(login.getClientId());
|
||||
throw new BadRegistrarIdException(login.getClientId());
|
||||
}
|
||||
|
||||
// AuthenticationErrorExceptions will propagate up through here.
|
||||
|
@ -139,15 +140,15 @@ public class LoginFlow implements Flow {
|
|||
|
||||
// We are in!
|
||||
sessionMetadata.resetFailedLoginAttempts();
|
||||
sessionMetadata.setClientId(login.getClientId());
|
||||
sessionMetadata.setRegistrarId(login.getClientId());
|
||||
sessionMetadata.setServiceExtensionUris(serviceExtensionUrisBuilder.build());
|
||||
return responseBuilder.setIsLoginResponse().build();
|
||||
}
|
||||
|
||||
/** Registrar with this client ID could not be found. */
|
||||
static class BadRegistrarClientIdException extends AuthenticationErrorException {
|
||||
public BadRegistrarClientIdException(String clientId) {
|
||||
super("Registrar with this client ID could not be found: " + clientId);
|
||||
/** Registrar with this ID could not be found. */
|
||||
static class BadRegistrarIdException extends AuthenticationErrorException {
|
||||
public BadRegistrarIdException(String registrarId) {
|
||||
super("Registrar with this ID could not be found: " + registrarId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
|
||||
package google.registry.flows.session;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.FlowUtils.validateRegistrarIsLoggedIn;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.RegistrarId;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import javax.inject.Inject;
|
||||
|
@ -33,7 +33,7 @@ import javax.inject.Inject;
|
|||
public class LogoutFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject SessionMetadata sessionMetadata;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
@Inject LogoutFlow() {}
|
||||
|
@ -41,7 +41,7 @@ public class LogoutFlow implements Flow {
|
|||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
sessionMetadata.invalidate();
|
||||
return responseBuilder.setResultFromCode(SUCCESS_AND_CLOSE).build();
|
||||
}
|
||||
|
|
|
@ -74,10 +74,10 @@ public class LoadTestAction implements Runnable {
|
|||
|
||||
public static final String PATH = "/_dr/loadtest";
|
||||
|
||||
/** The client identifier of the registrar to use for load testing. */
|
||||
/** The ID of the registrar to use for load testing. */
|
||||
@Inject
|
||||
@Parameter("loadtestClientId")
|
||||
String clientId;
|
||||
String registrarId;
|
||||
|
||||
/**
|
||||
* The number of seconds to delay the execution of the first load testing tasks by. Preparatory
|
||||
|
@ -276,11 +276,11 @@ public class LoadTestAction implements Runnable {
|
|||
|| hostInfosPerSecond > 0,
|
||||
"You must specify at least one of the 'operations per second' parameters.");
|
||||
logger.atInfo().log(
|
||||
"Running load test with the following params. clientId: %s, delaySeconds: %d, "
|
||||
"Running load test with the following params. registrarId: %s, delaySeconds: %d, "
|
||||
+ "runSeconds: %d, successful|failed domain creates/s: %d|%d, domain infos/s: %d, "
|
||||
+ "domain checks/s: %d, successful|failed contact creates/s: %d|%d, "
|
||||
+ "contact infos/s: %d, successful|failed host creates/s: %d|%d, host infos/s: %d.",
|
||||
clientId,
|
||||
registrarId,
|
||||
delaySeconds,
|
||||
runSeconds,
|
||||
successfulDomainCreatesPerSecond,
|
||||
|
@ -327,10 +327,11 @@ public class LoadTestAction implements Runnable {
|
|||
for (int i = 0; i < xmls.size(); i++) {
|
||||
// Space tasks evenly within across a second.
|
||||
int offsetMillis = (int) (1000.0 / xmls.size() * i);
|
||||
tasks.add(TaskOptions.Builder.withUrl("/_dr/epptool")
|
||||
tasks.add(
|
||||
TaskOptions.Builder.withUrl("/_dr/epptool")
|
||||
.etaMillis(start.getMillis() + offsetMillis)
|
||||
.header(X_CSRF_TOKEN, xsrfToken)
|
||||
.param("clientId", clientId)
|
||||
.param("clientId", registrarId)
|
||||
.param("superuser", Boolean.FALSE.toString())
|
||||
.param("dryRun", Boolean.FALSE.toString())
|
||||
.param("xml", xmls.get(i)));
|
||||
|
|
|
@ -175,7 +175,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
|
|||
return creationTime.getTimestamp();
|
||||
}
|
||||
|
||||
public String getCreationClientId() {
|
||||
public String getCreationRegistrarId() {
|
||||
return creationClientId;
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
|
|||
return lastEppUpdateTime;
|
||||
}
|
||||
|
||||
public String getLastEppUpdateClientId() {
|
||||
public String getLastEppUpdateRegistrarId() {
|
||||
return lastEppUpdateClientId;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
|
|||
* <p>For subordinate hosts, this value may not represent the actual current client id, which is
|
||||
* the client id of the superordinate host. For all other resources this is the true client id.
|
||||
*/
|
||||
public final String getPersistedCurrentSponsorClientId() {
|
||||
public final String getPersistedCurrentSponsorRegistrarId() {
|
||||
return currentSponsorClientId;
|
||||
}
|
||||
|
||||
|
@ -294,14 +294,14 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
|
|||
}
|
||||
|
||||
/** Set the current sponsoring registrar. */
|
||||
public B setPersistedCurrentSponsorClientId(String currentSponsorClientId) {
|
||||
getInstance().currentSponsorClientId = currentSponsorClientId;
|
||||
public B setPersistedCurrentSponsorRegistrarId(String currentSponsorRegistrarId) {
|
||||
getInstance().currentSponsorClientId = currentSponsorRegistrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/** Set the registrar that created this resource. */
|
||||
public B setCreationClientId(String creationClientId) {
|
||||
getInstance().creationClientId = creationClientId;
|
||||
public B setCreationRegistrarId(String creationRegistrarId) {
|
||||
getInstance().creationClientId = creationRegistrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
|
@ -312,8 +312,8 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
|
|||
}
|
||||
|
||||
/** Set the registrar who last performed a {@literal <update>} on this resource. */
|
||||
public B setLastEppUpdateClientId(String lastEppUpdateClientId) {
|
||||
getInstance().lastEppUpdateClientId = lastEppUpdateClientId;
|
||||
public B setLastEppUpdateRegistrarId(String lastEppUpdateRegistrarId) {
|
||||
getInstance().lastEppUpdateClientId = lastEppUpdateRegistrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ public final class EppResourceUtils {
|
|||
.removeStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
.setTransferData((T) transferDataBuilder.build())
|
||||
.setLastTransferTime(transferData.getPendingTransferExpirationTime())
|
||||
.setPersistedCurrentSponsorClientId(transferData.getGainingClientId());
|
||||
.setPersistedCurrentSponsorRegistrarId(transferData.getGainingRegistrarId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,7 +63,7 @@ import org.joda.time.Duration;
|
|||
* <p>Usage example:
|
||||
*
|
||||
* <pre>{@code
|
||||
* OteAccountBuilder.forClientId("example")
|
||||
* OteAccountBuilder.forRegistrarId("example")
|
||||
* .addContact("contact@email.com") // OPTIONAL
|
||||
* .setPassword("password") // OPTIONAL
|
||||
* .setCertificateHash(certificateHash) // OPTIONAL
|
||||
|
@ -111,7 +111,7 @@ public final class OteAccountBuilder {
|
|||
DateTime.parse("2030-03-01T00:00:00Z"),
|
||||
Money.of(CurrencyUnit.USD, 0));
|
||||
|
||||
private final ImmutableMap<String, String> clientIdToTld;
|
||||
private final ImmutableMap<String, String> registrarIdToTld;
|
||||
private final Registry sunriseTld;
|
||||
private final Registry gaTld;
|
||||
private final Registry eapTld;
|
||||
|
@ -121,16 +121,16 @@ public final class OteAccountBuilder {
|
|||
private ImmutableList<Registrar> registrars;
|
||||
private boolean replaceExisting = false;
|
||||
|
||||
private OteAccountBuilder(String baseClientId) {
|
||||
private OteAccountBuilder(String baseRegistrarId) {
|
||||
checkState(
|
||||
RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION,
|
||||
"Can't setup OT&E in production");
|
||||
clientIdToTld = createClientIdToTldMap(baseClientId);
|
||||
sunriseTld = createTld(baseClientId + "-sunrise", START_DATE_SUNRISE, false, 0);
|
||||
gaTld = createTld(baseClientId + "-ga", GENERAL_AVAILABILITY, false, 2);
|
||||
eapTld = createTld(baseClientId + "-eap", GENERAL_AVAILABILITY, true, 3);
|
||||
registrarIdToTld = createRegistrarIdToTldMap(baseRegistrarId);
|
||||
sunriseTld = createTld(baseRegistrarId + "-sunrise", START_DATE_SUNRISE, false, 0);
|
||||
gaTld = createTld(baseRegistrarId + "-ga", GENERAL_AVAILABILITY, false, 2);
|
||||
eapTld = createTld(baseRegistrarId + "-eap", GENERAL_AVAILABILITY, true, 3);
|
||||
registrars =
|
||||
clientIdToTld.keySet().stream()
|
||||
registrarIdToTld.keySet().stream()
|
||||
.map(OteAccountBuilder::createRegistrar)
|
||||
.collect(toImmutableList());
|
||||
}
|
||||
|
@ -138,11 +138,11 @@ public final class OteAccountBuilder {
|
|||
/**
|
||||
* Creates an OteAccountBuilder for the given base client ID.
|
||||
*
|
||||
* @param baseClientId the base clientId which will help name all the entities we create. Normally
|
||||
* is the same as the "prod" clientId designated for this registrar.
|
||||
* @param baseRegistrarId the base registrar ID which will help name all the entities we create.
|
||||
* Normally is the same as the "prod" ID designated for this registrar.
|
||||
*/
|
||||
public static OteAccountBuilder forClientId(String baseClientId) {
|
||||
return new OteAccountBuilder(baseClientId);
|
||||
public static OteAccountBuilder forRegistrarId(String baseRegistrarId) {
|
||||
return new OteAccountBuilder(baseRegistrarId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,14 +232,15 @@ public final class OteAccountBuilder {
|
|||
*/
|
||||
public ImmutableMap<String, String> buildAndPersist() {
|
||||
saveAllEntities();
|
||||
return clientIdToTld;
|
||||
return registrarIdToTld;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return map from the OT&E clientIds we will create to the new TLDs they will have access to.
|
||||
* Return map from the OT&E registrarIds we will create to the new TLDs they will have access
|
||||
* to.
|
||||
*/
|
||||
public ImmutableMap<String, String> getClientIdToTldMap() {
|
||||
return clientIdToTld;
|
||||
public ImmutableMap<String, String> getRegistrarIdToTldMap() {
|
||||
return registrarIdToTld;
|
||||
}
|
||||
|
||||
/** Saves all the OT&E entities we created. */
|
||||
|
@ -279,7 +280,7 @@ public final class OteAccountBuilder {
|
|||
}
|
||||
|
||||
private Registrar addAllowedTld(Registrar registrar) {
|
||||
String tld = clientIdToTld.get(registrar.getClientId());
|
||||
String tld = registrarIdToTld.get(registrar.getRegistrarId());
|
||||
if (registrar.getAllowedTlds().contains(tld)) {
|
||||
return registrar;
|
||||
}
|
||||
|
@ -324,7 +325,7 @@ public final class OteAccountBuilder {
|
|||
*/
|
||||
private static Registrar createRegistrar(String registrarName) {
|
||||
return new Registrar.Builder()
|
||||
.setClientId(registrarName)
|
||||
.setRegistrarId(registrarName)
|
||||
.setRegistrarName(registrarName)
|
||||
.setType(Registrar.Type.OTE)
|
||||
.setLocalizedAddress(DEFAULT_ADDRESS)
|
||||
|
@ -346,31 +347,31 @@ public final class OteAccountBuilder {
|
|||
.build();
|
||||
}
|
||||
|
||||
/** Returns the ClientIds of the OT&E, with the TLDs each has access to. */
|
||||
public static ImmutableMap<String, String> createClientIdToTldMap(String baseClientId) {
|
||||
/** Returns the registrar IDs of the OT&E, with the TLDs each has access to. */
|
||||
public static ImmutableMap<String, String> createRegistrarIdToTldMap(String baseRegistrarId) {
|
||||
checkArgument(
|
||||
REGISTRAR_PATTERN.matcher(baseClientId).matches(),
|
||||
REGISTRAR_PATTERN.matcher(baseRegistrarId).matches(),
|
||||
"Invalid registrar name: %s",
|
||||
baseClientId);
|
||||
baseRegistrarId);
|
||||
return new ImmutableMap.Builder<String, String>()
|
||||
.put(baseClientId + "-1", baseClientId + "-sunrise")
|
||||
.put(baseRegistrarId + "-1", baseRegistrarId + "-sunrise")
|
||||
// The -2 registrar no longer exists because landrush no longer exists.
|
||||
.put(baseClientId + "-3", baseClientId + "-ga")
|
||||
.put(baseClientId + "-4", baseClientId + "-ga")
|
||||
.put(baseClientId + "-5", baseClientId + "-eap")
|
||||
.put(baseRegistrarId + "-3", baseRegistrarId + "-ga")
|
||||
.put(baseRegistrarId + "-4", baseRegistrarId + "-ga")
|
||||
.put(baseRegistrarId + "-5", baseRegistrarId + "-eap")
|
||||
.build();
|
||||
}
|
||||
|
||||
/** Returns the base client ID that correspond to a given OT&E client ID. */
|
||||
public static String getBaseClientId(String oteClientId) {
|
||||
int index = oteClientId.lastIndexOf('-');
|
||||
checkArgument(index > 0, "Invalid OT&E client ID: %s", oteClientId);
|
||||
String baseClientId = oteClientId.substring(0, index);
|
||||
/** Returns the base registrar ID that corresponds to a given OT&E registrar ID. */
|
||||
public static String getBaseRegistrarId(String oteRegistrarId) {
|
||||
int index = oteRegistrarId.lastIndexOf('-');
|
||||
checkArgument(index > 0, "Invalid OT&E registrar ID: %s", oteRegistrarId);
|
||||
String baseRegistrarId = oteRegistrarId.substring(0, index);
|
||||
checkArgument(
|
||||
createClientIdToTldMap(baseClientId).containsKey(oteClientId),
|
||||
"ID %s is not one of the OT&E client IDs for base %s",
|
||||
oteClientId,
|
||||
baseClientId);
|
||||
return baseClientId;
|
||||
createRegistrarIdToTldMap(baseRegistrarId).containsKey(oteRegistrarId),
|
||||
"ID %s is not one of the OT&E registrar IDs for base %s",
|
||||
oteRegistrarId,
|
||||
baseRegistrarId);
|
||||
return baseRegistrarId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ public class OteStats {
|
|||
*/
|
||||
private OteStats recordRegistrarHistory(String registrarName) {
|
||||
ImmutableCollection<String> registrarIds =
|
||||
OteAccountBuilder.createClientIdToTldMap(registrarName).keySet();
|
||||
OteAccountBuilder.createRegistrarIdToTldMap(registrarName).keySet();
|
||||
|
||||
for (HistoryEntry historyEntry : HistoryEntryDao.loadHistoryObjectsByRegistrars(registrarIds)) {
|
||||
try {
|
||||
|
|
|
@ -72,8 +72,9 @@ public final class ResourceTransferUtils {
|
|||
? domainTransferData.getTransferredRegistrationExpirationTime()
|
||||
: null);
|
||||
}
|
||||
builder.setGainingClientId(transferData.getGainingClientId())
|
||||
.setLosingClientId(transferData.getLosingClientId())
|
||||
builder
|
||||
.setGainingRegistrarId(transferData.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferData.getLosingRegistrarId())
|
||||
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
|
||||
.setTransferRequestTime(transferData.getTransferRequestTime())
|
||||
.setTransferStatus(transferData.getTransferStatus());
|
||||
|
@ -119,7 +120,7 @@ public final class ResourceTransferUtils {
|
|||
tm().delete(oldTransferData.getServerApproveEntities());
|
||||
tm().put(
|
||||
new PollMessage.OneTime.Builder()
|
||||
.setClientId(oldTransferData.getGainingClientId())
|
||||
.setRegistrarId(oldTransferData.getGainingRegistrarId())
|
||||
.setEventTime(now)
|
||||
.setMsg(TransferStatus.SERVER_CANCELLED.getMessage())
|
||||
.setResponseData(
|
||||
|
@ -178,7 +179,7 @@ public final class ResourceTransferUtils {
|
|||
B builder = resolvePendingTransfer(resource, transferStatus, now);
|
||||
return builder
|
||||
.setLastTransferTime(now)
|
||||
.setPersistedCurrentSponsorClientId(resource.getTransferData().getGainingClientId())
|
||||
.setPersistedCurrentSponsorRegistrarId(resource.getTransferData().getGainingRegistrarId())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -195,7 +196,7 @@ public final class ResourceTransferUtils {
|
|||
checkArgument(transferStatus.isDenied(), "Not a denial transfer status");
|
||||
return resolvePendingTransfer(resource, transferStatus, now)
|
||||
.setLastEppUpdateTime(now)
|
||||
.setLastEppUpdateClientId(lastEppUpdateClientId)
|
||||
.setLastEppUpdateRegistrarId(lastEppUpdateClientId)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
domainRepoId = parent.getParent().getName();
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
public String getRegistrarId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
|
@ -223,8 +223,8 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setClientId(String clientId) {
|
||||
getInstance().clientId = clientId;
|
||||
public B setRegistrarId(String registrarId) {
|
||||
getInstance().clientId = registrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
new BillingEvent.Cancellation.Builder()
|
||||
.setReason(checkNotNull(GRACE_PERIOD_TO_REASON.get(gracePeriod.getType())))
|
||||
.setTargetId(targetId)
|
||||
.setClientId(gracePeriod.getClientId())
|
||||
.setRegistrarId(gracePeriod.getRegistrarId())
|
||||
.setEventTime(eventTime)
|
||||
// The charge being cancelled will take place at the grace period's expiration time.
|
||||
.setBillingTime(gracePeriod.getExpirationTime())
|
||||
|
@ -778,7 +778,7 @@ public abstract class BillingEvent extends ImmutableObject
|
|||
public static Modification createRefundFor(
|
||||
OneTime billingEvent, DomainHistory historyEntry, String description) {
|
||||
return new Builder()
|
||||
.setClientId(billingEvent.getClientId())
|
||||
.setRegistrarId(billingEvent.getRegistrarId())
|
||||
.setFlags(billingEvent.getFlags())
|
||||
.setReason(billingEvent.getReason())
|
||||
.setTargetId(billingEvent.getTargetId())
|
||||
|
|
|
@ -237,8 +237,8 @@ public class ContactBase extends EppResource implements ResourceWithTransferData
|
|||
return disclose;
|
||||
}
|
||||
|
||||
public String getCurrentSponsorClientId() {
|
||||
return getPersistedCurrentSponsorClientId();
|
||||
public String getCurrentSponsorRegistrarId() {
|
||||
return getPersistedCurrentSponsorRegistrarId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ContactResource extends ContactBase
|
|||
public Builder copyFrom(ContactBase contactBase) {
|
||||
return this.setAuthInfo(contactBase.getAuthInfo())
|
||||
.setContactId(contactBase.getContactId())
|
||||
.setCreationClientId(contactBase.getCreationClientId())
|
||||
.setCreationRegistrarId(contactBase.getCreationRegistrarId())
|
||||
.setCreationTime(contactBase.getCreationTime())
|
||||
.setDeletionTime(contactBase.getDeletionTime())
|
||||
.setDisclose(contactBase.getDisclose())
|
||||
|
@ -96,10 +96,11 @@ public class ContactResource extends ContactBase
|
|||
.setFaxNumber(contactBase.getFaxNumber())
|
||||
.setInternationalizedPostalInfo(contactBase.getInternationalizedPostalInfo())
|
||||
.setLastTransferTime(contactBase.getLastTransferTime())
|
||||
.setLastEppUpdateClientId(contactBase.getLastEppUpdateClientId())
|
||||
.setLastEppUpdateRegistrarId(contactBase.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(contactBase.getLastEppUpdateTime())
|
||||
.setLocalizedPostalInfo(contactBase.getLocalizedPostalInfo())
|
||||
.setPersistedCurrentSponsorClientId(contactBase.getPersistedCurrentSponsorClientId())
|
||||
.setPersistedCurrentSponsorRegistrarId(
|
||||
contactBase.getPersistedCurrentSponsorRegistrarId())
|
||||
.setRepoId(contactBase.getRepoId())
|
||||
.setStatusValues(contactBase.getStatusValues())
|
||||
.setTransferData(contactBase.getTransferData())
|
||||
|
|
|
@ -194,7 +194,7 @@ public class DomainBase extends DomainContent
|
|||
.setAutorenewBillingEvent(domainContent.getAutorenewBillingEvent())
|
||||
.setAutorenewEndTime(domainContent.getAutorenewEndTime())
|
||||
.setContacts(domainContent.getContacts())
|
||||
.setCreationClientId(domainContent.getCreationClientId())
|
||||
.setCreationRegistrarId(domainContent.getCreationRegistrarId())
|
||||
.setCreationTime(domainContent.getCreationTime())
|
||||
.setDomainName(domainContent.getDomainName())
|
||||
.setDeletePollMessage(domainContent.getDeletePollMessage())
|
||||
|
@ -204,10 +204,11 @@ public class DomainBase extends DomainContent
|
|||
.setIdnTableName(domainContent.getIdnTableName())
|
||||
.setLastTransferTime(domainContent.getLastTransferTime())
|
||||
.setLaunchNotice(domainContent.getLaunchNotice())
|
||||
.setLastEppUpdateClientId(domainContent.getLastEppUpdateClientId())
|
||||
.setLastEppUpdateRegistrarId(domainContent.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(domainContent.getLastEppUpdateTime())
|
||||
.setNameservers(domainContent.getNameservers())
|
||||
.setPersistedCurrentSponsorClientId(domainContent.getPersistedCurrentSponsorClientId())
|
||||
.setPersistedCurrentSponsorRegistrarId(
|
||||
domainContent.getPersistedCurrentSponsorRegistrarId())
|
||||
.setRegistrant(domainContent.getRegistrant())
|
||||
.setRegistrationExpirationTime(domainContent.getRegistrationExpirationTime())
|
||||
.setRepoId(domainContent.getRepoId())
|
||||
|
|
|
@ -520,8 +520,8 @@ public class DomainContent extends EppResource
|
|||
this.dsData = dsData;
|
||||
}
|
||||
|
||||
public final String getCurrentSponsorClientId() {
|
||||
return getPersistedCurrentSponsorClientId();
|
||||
public final String getCurrentSponsorRegistrarId() {
|
||||
return getPersistedCurrentSponsorRegistrarId();
|
||||
}
|
||||
|
||||
/** Returns true if DNS information should be published for the given domain. */
|
||||
|
@ -617,7 +617,7 @@ public class DomainContent extends EppResource
|
|||
domain.getRepoId(),
|
||||
transferExpirationTime.plus(
|
||||
Registry.get(domain.getTld()).getTransferGracePeriodLength()),
|
||||
transferData.getGainingClientId(),
|
||||
transferData.getGainingRegistrarId(),
|
||||
transferData.getServerApproveBillingEvent())));
|
||||
} else {
|
||||
// There won't be a billing event, so we don't need a grace period
|
||||
|
@ -627,7 +627,7 @@ public class DomainContent extends EppResource
|
|||
setAutomaticTransferSuccessProperties(builder, transferData);
|
||||
builder
|
||||
.setLastEppUpdateTime(transferExpirationTime)
|
||||
.setLastEppUpdateClientId(transferData.getGainingClientId());
|
||||
.setLastEppUpdateRegistrarId(transferData.getGainingRegistrarId());
|
||||
// Finish projecting to now.
|
||||
return (T) builder.build().cloneProjectedAtTime(now);
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ public class DomainContent extends EppResource
|
|||
domain.getRepoId(),
|
||||
lastAutorenewTime.plus(
|
||||
Registry.get(domain.getTld()).getAutoRenewGracePeriodLength()),
|
||||
domain.getCurrentSponsorClientId(),
|
||||
domain.getCurrentSponsorRegistrarId(),
|
||||
domain.getAutorenewBillingEvent()));
|
||||
newLastEppUpdateTime = Optional.of(lastAutorenewTime);
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ public class DomainContent extends EppResource
|
|||
|| newLastEppUpdateTime.get().isAfter(domain.getLastEppUpdateTime())) {
|
||||
builder
|
||||
.setLastEppUpdateTime(newLastEppUpdateTime.get())
|
||||
.setLastEppUpdateClientId(domain.getCurrentSponsorClientId());
|
||||
.setLastEppUpdateRegistrarId(domain.getCurrentSponsorRegistrarId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,8 +176,9 @@ public class DomainHistory extends HistoryEntry implements SqlEntity {
|
|||
@Nullable
|
||||
@Access(AccessType.PROPERTY)
|
||||
@Column(name = "historyOtherRegistrarId")
|
||||
@Override
|
||||
public String getOtherRegistrarId() {
|
||||
return super.getOtherClientId();
|
||||
return super.getOtherRegistrarId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
@Nullable VKey<BillingEvent.OneTime> billingEventOneTime,
|
||||
@Nullable VKey<BillingEvent.Recurring> billingEventRecurring,
|
||||
@Nullable Long gracePeriodId) {
|
||||
|
@ -72,7 +72,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
instance.type = checkArgumentNotNull(type);
|
||||
instance.domainRepoId = checkArgumentNotNull(domainRepoId);
|
||||
instance.expirationTime = checkArgumentNotNull(expirationTime);
|
||||
instance.clientId = checkArgumentNotNull(clientId);
|
||||
instance.clientId = checkArgumentNotNull(registrarId);
|
||||
instance.billingEventOneTime = BillingEventVKey.create(billingEventOneTime);
|
||||
instance.billingEventRecurring = BillingRecurrenceVKey.create(billingEventRecurring);
|
||||
return instance;
|
||||
|
@ -89,10 +89,10 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
@Nullable VKey<BillingEvent.OneTime> billingEventOneTime) {
|
||||
return createInternal(
|
||||
type, domainRepoId, expirationTime, clientId, billingEventOneTime, null, null);
|
||||
type, domainRepoId, expirationTime, registrarId, billingEventOneTime, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,11 +108,11 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
@Nullable VKey<BillingEvent.OneTime> billingEventOneTime,
|
||||
@Nullable Long gracePeriodId) {
|
||||
return createInternal(
|
||||
type, domainRepoId, expirationTime, clientId, billingEventOneTime, null, gracePeriodId);
|
||||
type, domainRepoId, expirationTime, registrarId, billingEventOneTime, null, gracePeriodId);
|
||||
}
|
||||
|
||||
public static GracePeriod createFromHistory(GracePeriodHistory history) {
|
||||
|
@ -131,11 +131,11 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
VKey<Recurring> billingEventRecurring) {
|
||||
checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null");
|
||||
return createInternal(
|
||||
type, domainRepoId, expirationTime, clientId, null, billingEventRecurring, null);
|
||||
type, domainRepoId, expirationTime, registrarId, null, billingEventRecurring, null);
|
||||
}
|
||||
|
||||
/** Creates a GracePeriod for a Recurring billing event and a given {@link #gracePeriodId}. */
|
||||
|
@ -144,18 +144,24 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
GracePeriodStatus type,
|
||||
String domainRepoId,
|
||||
DateTime expirationTime,
|
||||
String clientId,
|
||||
String registrarId,
|
||||
VKey<Recurring> billingEventRecurring,
|
||||
@Nullable Long gracePeriodId) {
|
||||
checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null");
|
||||
return createInternal(
|
||||
type, domainRepoId, expirationTime, clientId, null, billingEventRecurring, gracePeriodId);
|
||||
type,
|
||||
domainRepoId,
|
||||
expirationTime,
|
||||
registrarId,
|
||||
null,
|
||||
billingEventRecurring,
|
||||
gracePeriodId);
|
||||
}
|
||||
|
||||
/** Creates a GracePeriod with no billing event. */
|
||||
public static GracePeriod createWithoutBillingEvent(
|
||||
GracePeriodStatus type, String domainRepoId, DateTime expirationTime, String clientId) {
|
||||
return createInternal(type, domainRepoId, expirationTime, clientId, null, null, null);
|
||||
GracePeriodStatus type, String domainRepoId, DateTime expirationTime, String registrarId) {
|
||||
return createInternal(type, domainRepoId, expirationTime, registrarId, null, null, null);
|
||||
}
|
||||
|
||||
/** Constructs a GracePeriod of the given type from the provided one-time BillingEvent. */
|
||||
|
@ -165,7 +171,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
type,
|
||||
domainRepoId,
|
||||
billingEvent.getBillingTime(),
|
||||
billingEvent.getClientId(),
|
||||
billingEvent.getRegistrarId(),
|
||||
billingEvent.createVKey());
|
||||
}
|
||||
|
||||
|
@ -175,7 +181,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
|
|||
*
|
||||
* <p>TODO(b/162739503): Remove this function after fully migrating to Cloud SQL.
|
||||
*/
|
||||
public GracePeriod cloneAfterOfyLoad(String domainRepoId) {
|
||||
GracePeriod cloneAfterOfyLoad(String domainRepoId) {
|
||||
GracePeriod clone = clone(this);
|
||||
clone.domainRepoId = checkArgumentNotNull(domainRepoId);
|
||||
return clone;
|
||||
|
|
|
@ -91,7 +91,7 @@ public class GracePeriodBase extends ImmutableObject {
|
|||
return expirationTime;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
public String getRegistrarId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,16 +70,16 @@ public class HostResource extends HostBase
|
|||
}
|
||||
|
||||
public Builder copyFrom(HostBase hostBase) {
|
||||
return this.setCreationClientId(hostBase.getCreationClientId())
|
||||
return this.setCreationRegistrarId(hostBase.getCreationRegistrarId())
|
||||
.setCreationTime(hostBase.getCreationTime())
|
||||
.setDeletionTime(hostBase.getDeletionTime())
|
||||
.setHostName(hostBase.getHostName())
|
||||
.setInetAddresses(hostBase.getInetAddresses())
|
||||
.setLastTransferTime(hostBase.getLastTransferTime())
|
||||
.setLastSuperordinateChange(hostBase.getLastSuperordinateChange())
|
||||
.setLastEppUpdateClientId(hostBase.getLastEppUpdateClientId())
|
||||
.setLastEppUpdateRegistrarId(hostBase.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(hostBase.getLastEppUpdateTime())
|
||||
.setPersistedCurrentSponsorClientId(hostBase.getPersistedCurrentSponsorClientId())
|
||||
.setPersistedCurrentSponsorRegistrarId(hostBase.getPersistedCurrentSponsorRegistrarId())
|
||||
.setRepoId(hostBase.getRepoId())
|
||||
.setSuperordinateDomain(hostBase.getSuperordinateDomain())
|
||||
.setStatusValues(hostBase.getStatusValues());
|
||||
|
|
|
@ -142,7 +142,7 @@ public abstract class PollMessage extends ImmutableObject
|
|||
return id;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
public String getRegistrarId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
|
@ -219,8 +219,8 @@ public abstract class PollMessage extends ImmutableObject
|
|||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setClientId(String clientId) {
|
||||
getInstance().clientId = clientId;
|
||||
public B setRegistrarId(String registrarId) {
|
||||
getInstance().clientId = registrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
|
@ -441,8 +441,8 @@ public abstract class PollMessage extends ImmutableObject
|
|||
transferResponse =
|
||||
new ContactTransferResponse.Builder()
|
||||
.setContactId(contactId)
|
||||
.setGainingClientId(transferResponse.getGainingClientId())
|
||||
.setLosingClientId(transferResponse.getLosingClientId())
|
||||
.setGainingRegistrarId(transferResponse.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferResponse.getLosingRegistrarId())
|
||||
.setTransferStatus(transferResponse.getTransferStatus())
|
||||
.setTransferRequestTime(transferResponse.getTransferRequestTime())
|
||||
.setPendingTransferExpirationTime(
|
||||
|
@ -453,8 +453,8 @@ public abstract class PollMessage extends ImmutableObject
|
|||
transferResponse =
|
||||
new DomainTransferResponse.Builder()
|
||||
.setFullyQualifiedDomainName(fullyQualifiedDomainName)
|
||||
.setGainingClientId(transferResponse.getGainingClientId())
|
||||
.setLosingClientId(transferResponse.getLosingClientId())
|
||||
.setGainingRegistrarId(transferResponse.getGainingRegistrarId())
|
||||
.setLosingRegistrarId(transferResponse.getLosingRegistrarId())
|
||||
.setTransferStatus(transferResponse.getTransferStatus())
|
||||
.setTransferRequestTime(transferResponse.getTransferRequestTime())
|
||||
.setPendingTransferExpirationTime(
|
||||
|
|
|
@ -222,14 +222,15 @@ public class Registrar extends ImmutableObject
|
|||
comparing(RegistrarContact::getEmailAddress, String::compareTo);
|
||||
|
||||
/**
|
||||
* A caching {@link Supplier} of a clientId to {@link Registrar} map.
|
||||
* A caching {@link Supplier} of a registrarId to {@link Registrar} map.
|
||||
*
|
||||
* <p>The supplier's get() method enters a transactionless context briefly to avoid enrolling the
|
||||
* query inside an unrelated client-affecting transaction.
|
||||
*/
|
||||
private static final Supplier<ImmutableMap<String, Registrar>> CACHE_BY_CLIENT_ID =
|
||||
private static final Supplier<ImmutableMap<String, Registrar>> CACHE_BY_REGISTRAR_ID =
|
||||
memoizeWithShortExpiration(
|
||||
() -> tm().doTransactionless(() -> Maps.uniqueIndex(loadAll(), Registrar::getClientId)));
|
||||
() ->
|
||||
tm().doTransactionless(() -> Maps.uniqueIndex(loadAll(), Registrar::getRegistrarId)));
|
||||
|
||||
@Parent @Transient Key<EntityGroupRoot> parent = getCrossTldKey();
|
||||
|
||||
|
@ -479,7 +480,7 @@ public class Registrar extends ImmutableObject
|
|||
/** Whether or not registry lock is allowed for this registrar. */
|
||||
boolean registryLockAllowed = false;
|
||||
|
||||
public String getClientId() {
|
||||
public String getRegistrarId() {
|
||||
return clientIdentifier;
|
||||
}
|
||||
|
||||
|
@ -764,13 +765,13 @@ public class Registrar extends ImmutableObject
|
|||
super(instance);
|
||||
}
|
||||
|
||||
public Builder setClientId(String clientId) {
|
||||
// Client id must be [3,16] chars long. See "clIDType" in the base EPP schema of RFC 5730.
|
||||
public Builder setRegistrarId(String registrarId) {
|
||||
// Registrar id must be [3,16] chars long. See "clIDType" in the base EPP schema of RFC 5730.
|
||||
// (Need to validate this here as there's no matching EPP XSD for validation.)
|
||||
checkArgument(
|
||||
Range.closed(3, 16).contains(clientId.length()),
|
||||
"Client identifier must be 3-16 characters long.");
|
||||
getInstance().clientIdentifier = clientId;
|
||||
Range.closed(3, 16).contains(registrarId.length()),
|
||||
"Registrar ID must be 3-16 characters long.");
|
||||
getInstance().clientIdentifier = registrarId;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1026,40 +1027,40 @@ public class Registrar extends ImmutableObject
|
|||
|
||||
/** Loads all registrar entities using an in-memory cache. */
|
||||
public static Iterable<Registrar> loadAllCached() {
|
||||
return CACHE_BY_CLIENT_ID.get().values();
|
||||
return CACHE_BY_REGISTRAR_ID.get().values();
|
||||
}
|
||||
|
||||
/** Loads all registrar keys using an in-memory cache. */
|
||||
public static ImmutableSet<VKey<Registrar>> loadAllKeysCached() {
|
||||
return CACHE_BY_CLIENT_ID.get().keySet().stream()
|
||||
return CACHE_BY_REGISTRAR_ID.get().keySet().stream()
|
||||
.map(Registrar::createVKey)
|
||||
.collect(toImmutableSet());
|
||||
}
|
||||
|
||||
/** Loads and returns a registrar entity by its client id directly from Datastore. */
|
||||
public static Optional<Registrar> loadByClientId(String clientId) {
|
||||
checkArgument(!Strings.isNullOrEmpty(clientId), "clientId must be specified");
|
||||
return transactIfJpaTm(() -> tm().loadByKeyIfPresent(createVKey(clientId)));
|
||||
/** Loads and returns a registrar entity by its id directly from Datastore. */
|
||||
public static Optional<Registrar> loadByRegistrarId(String registrarId) {
|
||||
checkArgument(!Strings.isNullOrEmpty(registrarId), "registrarId must be specified");
|
||||
return transactIfJpaTm(() -> tm().loadByKeyIfPresent(createVKey(registrarId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and returns a registrar entity by its client id using an in-memory cache.
|
||||
* Loads and returns a registrar entity by its id using an in-memory cache.
|
||||
*
|
||||
* <p>Returns empty if the registrar isn't found.
|
||||
*/
|
||||
public static Optional<Registrar> loadByClientIdCached(String clientId) {
|
||||
checkArgument(!Strings.isNullOrEmpty(clientId), "clientId must be specified");
|
||||
return Optional.ofNullable(CACHE_BY_CLIENT_ID.get().get(clientId));
|
||||
public static Optional<Registrar> loadByRegistrarIdCached(String registrarId) {
|
||||
checkArgument(!Strings.isNullOrEmpty(registrarId), "registrarId must be specified");
|
||||
return Optional.ofNullable(CACHE_BY_REGISTRAR_ID.get().get(registrarId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and returns a registrar entity by its client id using an in-memory cache.
|
||||
* Loads and returns a registrar entity by its id using an in-memory cache.
|
||||
*
|
||||
* <p>Throws if the registrar isn't found.
|
||||
*/
|
||||
public static Registrar loadRequiredRegistrarCached(String clientId) {
|
||||
Optional<Registrar> registrar = loadByClientIdCached(clientId);
|
||||
checkArgument(registrar.isPresent(), "couldn't find registrar '%s'", clientId);
|
||||
public static Registrar loadRequiredRegistrarCached(String registrarId) {
|
||||
Optional<Registrar> registrar = loadByRegistrarIdCached(registrarId);
|
||||
checkArgument(registrar.isPresent(), "couldn't find registrar '%s'", registrarId);
|
||||
return registrar.get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ public class RegistrarContact extends ImmutableObject
|
|||
.query(
|
||||
"DELETE FROM RegistrarPoc WHERE registrarId = :registrarId AND "
|
||||
+ "emailAddress NOT IN :emailAddressesToKeep")
|
||||
.setParameter("registrarId", registrar.getClientId())
|
||||
.setParameter("registrarId", registrar.getRegistrarId())
|
||||
.setParameter("emailAddressesToKeep", emailAddressesToKeep)
|
||||
.executeUpdate();
|
||||
}
|
||||
|
|
|
@ -260,11 +260,11 @@ public class HistoryEntry extends ImmutableObject implements Buildable, Datastor
|
|||
return modificationTime;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
public String getRegistrarId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public String getOtherClientId() {
|
||||
public String getOtherRegistrarId() {
|
||||
return otherClientId;
|
||||
}
|
||||
|
||||
|
@ -489,13 +489,13 @@ public class HistoryEntry extends ImmutableObject implements Buildable, Datastor
|
|||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setClientId(String clientId) {
|
||||
getInstance().clientId = clientId;
|
||||
public B setRegistrarId(String registrarId) {
|
||||
getInstance().clientId = registrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setOtherClientId(String otherClientId) {
|
||||
getInstance().otherClientId = otherClientId;
|
||||
public B setOtherRegistrarId(String otherRegistrarId) {
|
||||
getInstance().otherClientId = otherRegistrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class BaseTransferObject extends ImmutableObject {
|
|||
return transferStatus;
|
||||
}
|
||||
|
||||
public String getGainingClientId() {
|
||||
public String getGainingRegistrarId() {
|
||||
return gainingClientId;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public abstract class BaseTransferObject extends ImmutableObject {
|
|||
return transferRequestTime;
|
||||
}
|
||||
|
||||
public String getLosingClientId() {
|
||||
public String getLosingRegistrarId() {
|
||||
return losingClientId;
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,8 @@ public abstract class BaseTransferObject extends ImmutableObject {
|
|||
}
|
||||
|
||||
/** Set the gaining registrar for a pending transfer on this resource. */
|
||||
public B setGainingClientId(String gainingClientId) {
|
||||
getInstance().gainingClientId = gainingClientId;
|
||||
public B setGainingRegistrarId(String gainingRegistrarId) {
|
||||
getInstance().gainingClientId = gainingRegistrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
|
@ -111,8 +111,8 @@ public abstract class BaseTransferObject extends ImmutableObject {
|
|||
}
|
||||
|
||||
/** Set the losing registrar for a pending transfer on this resource. */
|
||||
public B setLosingClientId(String losingClientId) {
|
||||
getInstance().losingClientId = losingClientId;
|
||||
public B setLosingRegistrarId(String losingRegistrarId) {
|
||||
getInstance().losingClientId = losingRegistrarId;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ public abstract class TransferData<
|
|||
newBuilder
|
||||
.setTransferRequestTrid(this.transferRequestTrid)
|
||||
.setTransferRequestTime(this.transferRequestTime)
|
||||
.setGainingClientId(this.gainingClientId)
|
||||
.setLosingClientId(this.losingClientId);
|
||||
.setGainingRegistrarId(this.gainingClientId)
|
||||
.setLosingRegistrarId(this.losingClientId);
|
||||
return newBuilder;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public abstract class EppMetric {
|
|||
|
||||
public abstract Optional<String> getCommandName();
|
||||
|
||||
public abstract Optional<String> getClientId();
|
||||
public abstract Optional<String> getRegistrarId();
|
||||
|
||||
public abstract Optional<String> getTld();
|
||||
|
||||
|
@ -78,9 +78,9 @@ public abstract class EppMetric {
|
|||
return setCommandName(flowSimpleClassName.replaceFirst("Flow$", ""));
|
||||
}
|
||||
|
||||
public abstract Builder setClientId(String clientId);
|
||||
public abstract Builder setRegistrarId(String registrarId);
|
||||
|
||||
public abstract Builder setClientId(Optional<String> clientId);
|
||||
public abstract Builder setRegistrarId(Optional<String> registrarId);
|
||||
|
||||
public abstract Builder setTld(String tld);
|
||||
|
||||
|
|
|
@ -201,8 +201,8 @@ public abstract class RdapActionBase implements Runnable {
|
|||
* eligible to see deleted information. Admins can see all deleted information, while
|
||||
* authenticated registrars can see only their own deleted information. Note that if this method
|
||||
* returns true, it just means that some deleted information might be viewable. If this is a
|
||||
* registrar request, the caller must still verify that the registrar can see each particular
|
||||
* item by calling {@link RdapAuthorization#isAuthorizedForClientId}.
|
||||
* registrar request, the caller must still verify that the registrar can see each particular item
|
||||
* by calling {@link RdapAuthorization#isAuthorizedForRegistrar}.
|
||||
*/
|
||||
boolean shouldIncludeDeleted() {
|
||||
// If includeDeleted is not specified, or set to false, we don't need to go any further.
|
||||
|
@ -212,7 +212,7 @@ public abstract class RdapActionBase implements Runnable {
|
|||
// Return true if we *might* be allowed to view any deleted info, meaning we're either an admin
|
||||
// or have access to at least one registrar's data
|
||||
return rdapAuthorization.role() == RdapAuthorization.Role.ADMINISTRATOR
|
||||
|| !rdapAuthorization.clientIds().isEmpty();
|
||||
|| !rdapAuthorization.registrarIds().isEmpty();
|
||||
}
|
||||
|
||||
DeletedItemHandling getDeletedItemHandling() {
|
||||
|
@ -228,8 +228,8 @@ public abstract class RdapActionBase implements Runnable {
|
|||
boolean isAuthorized(EppResource eppResource) {
|
||||
return getRequestTime().isBefore(eppResource.getDeletionTime())
|
||||
|| (shouldIncludeDeleted()
|
||||
&& rdapAuthorization.isAuthorizedForClientId(
|
||||
eppResource.getPersistedCurrentSponsorClientId()));
|
||||
&& rdapAuthorization.isAuthorizedForRegistrar(
|
||||
eppResource.getPersistedCurrentSponsorRegistrarId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,7 +241,7 @@ public abstract class RdapActionBase implements Runnable {
|
|||
boolean isAuthorized(Registrar registrar) {
|
||||
return (registrar.isLiveAndPubliclyVisible()
|
||||
|| (shouldIncludeDeleted()
|
||||
&& rdapAuthorization.isAuthorizedForClientId(registrar.getClientId())));
|
||||
&& rdapAuthorization.isAuthorizedForRegistrar(registrar.getRegistrarId())));
|
||||
}
|
||||
|
||||
String canonicalizeName(String name) {
|
||||
|
|
|
@ -32,22 +32,22 @@ public abstract class RdapAuthorization extends ImmutableObject {
|
|||
public abstract Role role();
|
||||
|
||||
/** The registrar client IDs for which access is granted (used only if the role is REGISTRAR. */
|
||||
public abstract ImmutableSet<String> clientIds();
|
||||
public abstract ImmutableSet<String> registrarIds();
|
||||
|
||||
static RdapAuthorization create(Role role, String clientId) {
|
||||
return new AutoValue_RdapAuthorization(role, ImmutableSet.of(clientId));
|
||||
static RdapAuthorization create(Role role, String registrarId) {
|
||||
return new AutoValue_RdapAuthorization(role, ImmutableSet.of(registrarId));
|
||||
}
|
||||
|
||||
static RdapAuthorization create(Role role, ImmutableSet<String> clientIds) {
|
||||
return new AutoValue_RdapAuthorization(role, clientIds);
|
||||
}
|
||||
|
||||
boolean isAuthorizedForClientId(String clientId) {
|
||||
boolean isAuthorizedForRegistrar(String registrarId) {
|
||||
switch (role()) {
|
||||
case ADMINISTRATOR:
|
||||
return true;
|
||||
case REGISTRAR:
|
||||
return clientIds().contains(clientId);
|
||||
return registrarIds().contains(registrarId);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
|||
partialStringQuery.getInitialString(),
|
||||
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
||||
return (!host.isPresent()
|
||||
|| !desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorClientId()))
|
||||
|| !desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorRegistrarId()))
|
||||
? ImmutableList.of()
|
||||
: ImmutableList.of(host.get().createVKey());
|
||||
} else {
|
||||
|
@ -434,7 +434,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
|
|||
fqhn,
|
||||
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
|
||||
if (host.isPresent()
|
||||
&& desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorClientId())) {
|
||||
&& desiredRegistrar
|
||||
.get()
|
||||
.equals(host.get().getPersistedCurrentSponsorRegistrarId())) {
|
||||
builder.add(host.get().createVKey());
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -272,7 +272,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
|
|||
DeletedItemHandling.EXCLUDE,
|
||||
rdapResultSetMaxSize + 1);
|
||||
if (!rdapAuthorization.role().equals(Role.ADMINISTRATOR)) {
|
||||
query = query.filter("currentSponsorClientId in", rdapAuthorization.clientIds());
|
||||
query = query.filter("currentSponsorClientId in", rdapAuthorization.registrarIds());
|
||||
}
|
||||
resultSet = getMatchingResources(query, false, rdapResultSetMaxSize + 1);
|
||||
} else {
|
||||
|
@ -290,7 +290,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
|
|||
if (!rdapAuthorization.role().equals(Role.ADMINISTRATOR)) {
|
||||
builder =
|
||||
builder.whereFieldIsIn(
|
||||
"currentSponsorClientId", rdapAuthorization.clientIds());
|
||||
"currentSponsorClientId", rdapAuthorization.registrarIds());
|
||||
}
|
||||
return getMatchingResourcesSql(builder, false, rdapResultSetMaxSize + 1);
|
||||
});
|
||||
|
|
|
@ -288,7 +288,7 @@ public class RdapJsonFormatter {
|
|||
Event.builder()
|
||||
.setEventAction(EventAction.REGISTRATION)
|
||||
.setEventActor(
|
||||
Optional.ofNullable(domainBase.getCreationClientId()).orElse("(none)"))
|
||||
Optional.ofNullable(domainBase.getCreationRegistrarId()).orElse("(none)"))
|
||||
.setEventDate(domainBase.getCreationTime())
|
||||
.build(),
|
||||
Event.builder()
|
||||
|
@ -307,7 +307,7 @@ public class RdapJsonFormatter {
|
|||
//
|
||||
// See {@link createRdapRegistrarEntity} for details of section 2.4 conformance
|
||||
Registrar registrar =
|
||||
Registrar.loadRequiredRegistrarCached(domainBase.getCurrentSponsorClientId());
|
||||
Registrar.loadRequiredRegistrarCached(domainBase.getCurrentSponsorRegistrarId());
|
||||
builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL));
|
||||
// RDAP Technical Implementation Guide 3.2: must have link to the registrar's RDAP URL for this
|
||||
// domain, with rel=related.
|
||||
|
@ -457,7 +457,8 @@ public class RdapJsonFormatter {
|
|||
// RDAP Response Profile 4.3 - Registrar member is optional, so we only set it for FULL
|
||||
if (outputDataType == OutputDataType.FULL) {
|
||||
Registrar registrar =
|
||||
Registrar.loadRequiredRegistrarCached(hostResource.getPersistedCurrentSponsorClientId());
|
||||
Registrar.loadRequiredRegistrarCached(
|
||||
hostResource.getPersistedCurrentSponsorRegistrarId());
|
||||
builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL));
|
||||
}
|
||||
if (outputDataType != OutputDataType.INTERNAL) {
|
||||
|
@ -490,7 +491,7 @@ public class RdapJsonFormatter {
|
|||
//
|
||||
// 2.8 allows for unredacted output for authorized people.
|
||||
boolean isAuthorized =
|
||||
rdapAuthorization.isAuthorizedForClientId(contactResource.getCurrentSponsorClientId());
|
||||
rdapAuthorization.isAuthorizedForRegistrar(contactResource.getCurrentSponsorRegistrarId());
|
||||
|
||||
// ROID needs to be redacted if we aren't authorized, so we can't have a self-link for
|
||||
// unauthorized users
|
||||
|
@ -741,7 +742,7 @@ public class RdapJsonFormatter {
|
|||
.noneMatch(contact -> contact.roles().contains(RdapEntity.Role.ABUSE))) {
|
||||
logger.atWarning().log(
|
||||
"Registrar '%s' (IANA ID %s) is missing ABUSE contact",
|
||||
registrar.getClientId(), registrar.getIanaIdentifier());
|
||||
registrar.getRegistrarId(), registrar.getIanaIdentifier());
|
||||
}
|
||||
builder.entitiesBuilder().addAll(registrarContacts);
|
||||
}
|
||||
|
@ -910,7 +911,7 @@ public class RdapJsonFormatter {
|
|||
eventsBuilder.add(
|
||||
Event.builder()
|
||||
.setEventAction(rdapEventAction)
|
||||
.setEventActor(historyEntry.getClientId())
|
||||
.setEventActor(historyEntry.getRegistrarId())
|
||||
.setEventDate(modificationTime)
|
||||
.build());
|
||||
// The last change time might not be the lastEppUpdateTime, since some changes happen without
|
||||
|
|
|
@ -125,7 +125,7 @@ public abstract class RdapSearchActionBase extends RdapActionBase {
|
|||
protected boolean shouldBeVisible(EppResource eppResource) {
|
||||
return isAuthorized(eppResource)
|
||||
&& (!registrarParam.isPresent()
|
||||
|| registrarParam.get().equals(eppResource.getPersistedCurrentSponsorClientId()));
|
||||
|| registrarParam.get().equals(eppResource.getPersistedCurrentSponsorRegistrarId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ public abstract class RdapSearchActionBase extends RdapActionBase {
|
|||
*/
|
||||
protected boolean shouldBeVisible(Registrar registrar) {
|
||||
return isAuthorized(registrar)
|
||||
&& (!registrarParam.isPresent() || registrarParam.get().equals(registrar.getClientId()));
|
||||
&& (!registrarParam.isPresent() || registrarParam.get().equals(registrar.getRegistrarId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -216,12 +216,12 @@ public final class UpdateRegistrarRdapBaseUrlsAction implements Runnable {
|
|||
if (registrar.getRdapBaseUrls().equals(baseUrls)) {
|
||||
logger.atInfo().log(
|
||||
"No change in RdapBaseUrls for registrar %s (ianaId %s)",
|
||||
registrar.getClientId(), ianaId);
|
||||
registrar.getRegistrarId(), ianaId);
|
||||
return;
|
||||
}
|
||||
logger.atInfo().log(
|
||||
"Updating RdapBaseUrls for registrar %s (ianaId %s) from %s to %s",
|
||||
registrar.getClientId(),
|
||||
registrar.getRegistrarId(),
|
||||
ianaId,
|
||||
registrar.getRdapBaseUrls(),
|
||||
baseUrls);
|
||||
|
|
|
@ -63,9 +63,9 @@ final class ContactResourceToXjcConverter {
|
|||
bean.getPostalInfos().add(convertPostalInfo(internationalizedPostalInfo));
|
||||
}
|
||||
bean.setId(model.getContactId());
|
||||
bean.setClID(model.getCurrentSponsorClientId());
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null));
|
||||
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null));
|
||||
bean.setClID(model.getCurrentSponsorRegistrarId());
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
|
||||
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null));
|
||||
bean.setCrDate(model.getCreationTime());
|
||||
bean.setUpDate(model.getLastEppUpdateTime());
|
||||
bean.setTrDate(model.getLastTransferTime());
|
||||
|
@ -112,8 +112,8 @@ final class ContactResourceToXjcConverter {
|
|||
private static XjcRdeContactTransferDataType convertTransferData(TransferData model) {
|
||||
XjcRdeContactTransferDataType bean = new XjcRdeContactTransferDataType();
|
||||
bean.setTrStatus(XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName()));
|
||||
bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingClientId()));
|
||||
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId()));
|
||||
bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingRegistrarId()));
|
||||
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingRegistrarId()));
|
||||
bean.setReDate(model.getTransferRequestTime());
|
||||
bean.setAcDate(model.getPendingTransferExpirationTime());
|
||||
return bean;
|
||||
|
|
|
@ -91,12 +91,12 @@ final class DomainBaseToXjcConverter {
|
|||
|
||||
// o A <clID> element that contains the identifier of the sponsoring
|
||||
// registrar.
|
||||
bean.setClID(model.getCurrentSponsorClientId());
|
||||
bean.setClID(model.getCurrentSponsorRegistrarId());
|
||||
|
||||
// o A <crRr> element that contains the identifier of the registrar
|
||||
// that created the domain name object. An OPTIONAL client attribute
|
||||
// is used to specify the client that performed the operation.
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null));
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
|
||||
|
||||
// o An OPTIONAL <crDate> element that contains the date and time of
|
||||
// the domain name object creation. This element MUST be present if
|
||||
|
@ -120,7 +120,7 @@ final class DomainBaseToXjcConverter {
|
|||
// MUST NOT be present if the domain has never been modified. An
|
||||
// OPTIONAL client attribute is used to specify the client that
|
||||
// performed the operation.
|
||||
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null));
|
||||
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null));
|
||||
|
||||
// o An OPTIONAL <trDate> element that contains the date and time of
|
||||
// the most recent domain object successful transfer. This element
|
||||
|
@ -254,9 +254,8 @@ final class DomainBaseToXjcConverter {
|
|||
}
|
||||
|
||||
private static boolean hasGainingAndLosingRegistrars(DomainBase model) {
|
||||
return
|
||||
!Strings.isNullOrEmpty(model.getTransferData().getGainingClientId())
|
||||
&& !Strings.isNullOrEmpty(model.getTransferData().getLosingClientId());
|
||||
return !Strings.isNullOrEmpty(model.getTransferData().getGainingRegistrarId())
|
||||
&& !Strings.isNullOrEmpty(model.getTransferData().getLosingRegistrarId());
|
||||
}
|
||||
|
||||
/** Converts {@link TransferData} to {@link XjcRdeDomainTransferDataType}. */
|
||||
|
@ -264,8 +263,8 @@ final class DomainBaseToXjcConverter {
|
|||
XjcRdeDomainTransferDataType bean = new XjcRdeDomainTransferDataType();
|
||||
bean.setTrStatus(
|
||||
XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName()));
|
||||
bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingClientId()));
|
||||
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId()));
|
||||
bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingRegistrarId()));
|
||||
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingRegistrarId()));
|
||||
bean.setReDate(model.getTransferRequestTime());
|
||||
bean.setAcDate(model.getPendingTransferExpirationTime());
|
||||
bean.setExDate(model.getTransferredRegistrationExpirationTime());
|
||||
|
|
|
@ -47,9 +47,10 @@ final class HostResourceToXjcConverter {
|
|||
|
||||
/** Converts {@link HostResource} to {@link XjcRdeHost}. */
|
||||
static XjcRdeHost convertSubordinateHost(HostResource model, DomainBase superordinateDomain) {
|
||||
XjcRdeHost bean = convertHostCommon(
|
||||
XjcRdeHost bean =
|
||||
convertHostCommon(
|
||||
model,
|
||||
superordinateDomain.getCurrentSponsorClientId(),
|
||||
superordinateDomain.getCurrentSponsorRegistrarId(),
|
||||
model.computeLastTransferTime(superordinateDomain));
|
||||
if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
|
||||
bean.getStatuses().add(convertStatusValue(StatusValue.PENDING_TRANSFER));
|
||||
|
@ -60,22 +61,20 @@ final class HostResourceToXjcConverter {
|
|||
/** Converts {@link HostResource} to {@link XjcRdeHost}. */
|
||||
static XjcRdeHost convertExternalHost(HostResource model) {
|
||||
return convertHostCommon(
|
||||
model,
|
||||
model.getPersistedCurrentSponsorClientId(),
|
||||
model.getLastTransferTime());
|
||||
model, model.getPersistedCurrentSponsorRegistrarId(), model.getLastTransferTime());
|
||||
}
|
||||
|
||||
private static XjcRdeHost convertHostCommon(
|
||||
HostResource model, String clientId, DateTime lastTransferTime) {
|
||||
HostResource model, String registrarId, DateTime lastTransferTime) {
|
||||
XjcRdeHost bean = new XjcRdeHost();
|
||||
bean.setName(model.getHostName());
|
||||
bean.setRoid(model.getRepoId());
|
||||
bean.setCrDate(model.getCreationTime());
|
||||
bean.setUpDate(model.getLastEppUpdateTime());
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null));
|
||||
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null));
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null));
|
||||
bean.setClID(clientId);
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
|
||||
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null));
|
||||
bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
|
||||
bean.setClID(registrarId);
|
||||
bean.setTrDate(lastTransferTime);
|
||||
for (StatusValue status : model.getStatusValues()) {
|
||||
// TODO(b/34844887): Remove when PENDING_TRANSFER is not persisted on host resources.
|
||||
|
|
|
@ -88,9 +88,9 @@ public final class RdeStagingMapper extends Mapper<EppResource, PendingDeposit,
|
|||
}
|
||||
|
||||
// Skip prober data.
|
||||
if (nullToEmpty(resource.getCreationClientId()).startsWith("prober-")
|
||||
|| nullToEmpty(resource.getPersistedCurrentSponsorClientId()).startsWith("prober-")
|
||||
|| nullToEmpty(resource.getLastEppUpdateClientId()).startsWith("prober-")) {
|
||||
if (nullToEmpty(resource.getCreationRegistrarId()).startsWith("prober-")
|
||||
|| nullToEmpty(resource.getPersistedCurrentSponsorRegistrarId()).startsWith("prober-")
|
||||
|| nullToEmpty(resource.getLastEppUpdateRegistrarId()).startsWith("prober-")) {
|
||||
getContext().incrementCounter("prober data skipped");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -83,9 +83,9 @@ public final class RdeUtil {
|
|||
return BaseEncoding.base32().omitPadding().encode(bytes);
|
||||
}
|
||||
|
||||
static XjcRdeRrType makeXjcRdeRrType(String clientId) {
|
||||
static XjcRdeRrType makeXjcRdeRrType(String registrarId) {
|
||||
XjcRdeRrType bean = new XjcRdeRrType();
|
||||
bean.setValue(clientId);
|
||||
bean.setValue(registrarId);
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ final class RegistrarToXjcConverter {
|
|||
// the registrar object. This <id> has a superordinate relationship
|
||||
// to a subordinate <clID>, <crRr> or <upRr> of domain, contact and
|
||||
// host objects.
|
||||
bean.setId(model.getClientId());
|
||||
bean.setId(model.getRegistrarId());
|
||||
|
||||
// o An <name> element that contains the name of the registrar.
|
||||
bean.setName(model.getRegistrarName());
|
||||
|
|
|
@ -103,7 +103,7 @@ public final class CopyDetailReportsAction implements Runnable {
|
|||
// The standard report format is "invoice_details_yyyy-MM_registrarId_tld.csv
|
||||
// TODO(larryruili): Determine a safer way of enforcing this.
|
||||
String registrarId = Iterables.get(Splitter.on('_').split(detailReportName), 3);
|
||||
Optional<Registrar> registrar = Registrar.loadByClientId(registrarId);
|
||||
Optional<Registrar> registrar = Registrar.loadByRegistrarId(registrarId);
|
||||
if (!registrar.isPresent()) {
|
||||
logger.atWarning().log(
|
||||
"Registrar %s not found in database for file %s", registrar, detailReportName);
|
||||
|
|
|
@ -207,14 +207,15 @@ public class Spec11EmailUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private InternetAddress getEmailAddressForRegistrar(String clientId) throws MessagingException {
|
||||
private InternetAddress getEmailAddressForRegistrar(String registrarId)
|
||||
throws MessagingException {
|
||||
// Attempt to use the registrar's WHOIS abuse contact, then fall back to the regular address.
|
||||
Registrar registrar =
|
||||
Registrar.loadByClientIdCached(clientId)
|
||||
Registrar.loadByRegistrarIdCached(registrarId)
|
||||
.orElseThrow(
|
||||
() ->
|
||||
new IllegalArgumentException(
|
||||
String.format("Could not find registrar %s", clientId)));
|
||||
String.format("Could not find registrar %s", registrarId)));
|
||||
return new InternetAddress(
|
||||
registrar
|
||||
.getWhoisAbuseContact()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue