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:
Ben McIlwain 2021-09-16 12:57:43 -04:00 committed by GitHub
parent 0b6f18f6d4
commit d5a91e7218
268 changed files with 1897 additions and 1786 deletions

View file

@ -126,18 +126,18 @@ public final class AsyncTaskEnqueuer {
public void enqueueAsyncDelete( public void enqueueAsyncDelete(
EppResource resourceToDelete, EppResource resourceToDelete,
DateTime now, DateTime now,
String requestingClientId, String requestingRegistrarId,
Trid trid, Trid trid,
boolean isSuperuser) { boolean isSuperuser) {
Key<EppResource> resourceKey = Key.create(resourceToDelete); Key<EppResource> resourceKey = Key.create(resourceToDelete);
logger.atInfo().log( logger.atInfo().log(
"Enqueuing async deletion of %s on behalf of registrar %s.", "Enqueuing async deletion of %s on behalf of registrar %s.",
resourceKey, requestingClientId); resourceKey, requestingRegistrarId);
TaskOptions task = TaskOptions task =
TaskOptions.Builder.withMethod(Method.PULL) TaskOptions.Builder.withMethod(Method.PULL)
.countdownMillis(asyncDeleteDelay.getMillis()) .countdownMillis(asyncDeleteDelay.getMillis())
.param(PARAM_RESOURCE_KEY, resourceKey.getString()) .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_SERVER_TRANSACTION_ID, trid.getServerTransactionId())
.param(PARAM_IS_SUPERUSER, Boolean.toString(isSuperuser)) .param(PARAM_IS_SUPERUSER, Boolean.toString(isSuperuser))
.param(PARAM_REQUESTED_TIME, now.toString()); .param(PARAM_REQUESTED_TIME, now.toString());

View file

@ -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 // Contacts and external hosts have a direct client id. For subordinate hosts it needs to be
// read off of the superordinate domain. // read off of the superordinate domain.
String resourceClientId = resource.getPersistedCurrentSponsorClientId(); String resourceRegistrarId = resource.getPersistedCurrentSponsorRegistrarId();
if (resource instanceof HostResource && ((HostResource) resource).isSubordinate()) { if (resource instanceof HostResource && ((HostResource) resource).isSubordinate()) {
resourceClientId = resourceRegistrarId =
tm().loadByKey(((HostResource) resource).getSuperordinateDomain()) tm().loadByKey(((HostResource) resource).getSuperordinateDomain())
.cloneProjectedAtTime(now) .cloneProjectedAtTime(now)
.getCurrentSponsorClientId(); .getCurrentSponsorRegistrarId();
} }
boolean requestedByCurrentOwner = boolean requestedByCurrentOwner =
resourceClientId.equals(deletionRequest.requestingClientId()); resourceRegistrarId.equals(deletionRequest.requestingClientId());
boolean deleteAllowed = boolean deleteAllowed =
hasNoActiveReferences && (requestedByCurrentOwner || deletionRequest.isSuperuser()); hasNoActiveReferences && (requestedByCurrentOwner || deletionRequest.isSuperuser());
@ -371,14 +371,14 @@ public class DeleteContactsAndHostsAction implements Runnable {
HistoryEntry historyEntry = HistoryEntry historyEntry =
HistoryEntry.createBuilderForResource(resource) HistoryEntry.createBuilderForResource(resource)
.setClientId(deletionRequest.requestingClientId()) .setRegistrarId(deletionRequest.requestingClientId())
.setModificationTime(now) .setModificationTime(now)
.setType(getHistoryEntryType(resource, deleteAllowed)) .setType(getHistoryEntryType(resource, deleteAllowed))
.build(); .build();
PollMessage.OneTime pollMessage = PollMessage.OneTime pollMessage =
new PollMessage.OneTime.Builder() new PollMessage.OneTime.Builder()
.setClientId(deletionRequest.requestingClientId()) .setRegistrarId(deletionRequest.requestingClientId())
.setMsg(pollMessageText) .setMsg(pollMessageText)
.setParent(historyEntry) .setParent(historyEntry)
.setEventTime(now) .setEventTime(now)

View file

@ -135,7 +135,7 @@ public class DeleteLoadTestDataAction implements Runnable {
} }
private void deleteContact(ContactResource contact) { private void deleteContact(ContactResource contact) {
if (!LOAD_TEST_REGISTRARS.contains(contact.getPersistedCurrentSponsorClientId())) { if (!LOAD_TEST_REGISTRARS.contains(contact.getPersistedCurrentSponsorRegistrarId())) {
return; return;
} }
// We cannot remove contacts from domains in the general case, so we cannot delete contacts // 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) { private void deleteHost(HostResource host) {
if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorClientId())) { if (!LOAD_TEST_REGISTRARS.contains(host.getPersistedCurrentSponsorRegistrarId())) {
return; return;
} }
VKey<HostResource> hostVKey = host.createVKey(); VKey<HostResource> hostVKey = host.createVKey();
@ -198,7 +198,7 @@ public class DeleteLoadTestDataAction implements Runnable {
@Override @Override
public final void map(EppResource resource) { public final void map(EppResource resource) {
if (LOAD_TEST_REGISTRARS.contains(resource.getPersistedCurrentSponsorClientId())) { if (LOAD_TEST_REGISTRARS.contains(resource.getPersistedCurrentSponsorRegistrarId())) {
deleteResource(resource); deleteResource(resource);
getContext() getContext()
.incrementCounter( .incrementCounter(

View file

@ -291,7 +291,7 @@ public class DeleteProberDataAction implements Runnable {
.setModificationTime(tm().getTransactionTime()) .setModificationTime(tm().getTransactionTime())
.setBySuperuser(true) .setBySuperuser(true)
.setReason("Deletion of prober data") .setReason("Deletion of prober data")
.setClientId(registryAdminRegistrarId) .setRegistrarId(registryAdminRegistrarId)
.build(); .build();
// Note that we don't bother handling grace periods, billing events, pending transfers, poll // 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 // messages, or auto-renews because those will all be hard-deleted the next time the job runs

View file

@ -324,7 +324,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
DomainHistory historyEntry = DomainHistory historyEntry =
new DomainHistory.Builder() new DomainHistory.Builder()
.setBySuperuser(false) .setBySuperuser(false)
.setClientId(recurring.getClientId()) .setRegistrarId(recurring.getRegistrarId())
.setModificationTime(tm().getTransactionTime()) .setModificationTime(tm().getTransactionTime())
.setDomain(tm().loadByKey(domainKey)) .setDomain(tm().loadByKey(domainKey))
.setPeriod(Period.create(1, YEARS)) .setPeriod(Period.create(1, YEARS))
@ -354,7 +354,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
syntheticOneTimesBuilder.add( syntheticOneTimesBuilder.add(
new OneTime.Builder() new OneTime.Builder()
.setBillingTime(billingTime) .setBillingTime(billingTime)
.setClientId(recurring.getClientId()) .setRegistrarId(recurring.getRegistrarId())
.setCost(renewCost) .setCost(renewCost)
.setEventTime(eventTime) .setEventTime(eventTime)
.setFlags(union(recurring.getFlags(), Flag.SYNTHETIC)) .setFlags(union(recurring.getFlags(), Flag.SYNTHETIC))

View file

@ -203,11 +203,11 @@ public class RelockDomainAction implements Runnable {
"Domain %s has a pending transfer.", "Domain %s has a pending transfer.",
domainName); domainName);
checkArgument( 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.", "Domain %s has been transferred from registrar %s to registrar %s since the unlock.",
domainName, domainName,
oldLock.getRegistrarId(), oldLock.getRegistrarId(),
domain.getCurrentSponsorClientId()); domain.getCurrentSponsorRegistrarId());
} }
private void handleNonRetryableFailure(RegistryLock oldLock, Throwable t) { private void handleNonRetryableFailure(RegistryLock oldLock, Throwable t) {
@ -293,7 +293,7 @@ public class RelockDomainAction implements Runnable {
private ImmutableSet<InternetAddress> getEmailRecipients(String registrarId) { private ImmutableSet<InternetAddress> getEmailRecipients(String registrarId) {
Registrar registrar = Registrar registrar =
Registrar.loadByClientIdCached(registrarId) Registrar.loadByRegistrarIdCached(registrarId)
.orElseThrow( .orElseThrow(
() -> () ->
new IllegalStateException(String.format("Unknown registrar %s", registrarId))); new IllegalStateException(String.format("Unknown registrar %s", registrarId)));

View file

@ -172,7 +172,7 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
registrar.getRegistrarName(), registrar.getRegistrarName(),
certificateType, certificateType,
expirationDate, expirationDate,
registrar.getClientId())) registrar.getRegistrarId()))
.setRecipients(recipients) .setRecipients(recipients)
.setCcs(getEmailAddresses(registrar, Type.ADMIN)) .setCcs(getEmailAddresses(registrar, Type.ADMIN))
.build()); .build());

View file

@ -125,7 +125,7 @@ public class InvoicingPipeline implements Serializable {
oneTime.getId(), oneTime.getId(),
DateTimeUtils.toZonedDateTime(oneTime.getBillingTime(), ZoneId.of("UTC")), DateTimeUtils.toZonedDateTime(oneTime.getBillingTime(), ZoneId.of("UTC")),
DateTimeUtils.toZonedDateTime(oneTime.getEventTime(), ZoneId.of("UTC")), DateTimeUtils.toZonedDateTime(oneTime.getEventTime(), ZoneId.of("UTC")),
registrar.getClientId(), registrar.getRegistrarId(),
registrar.getBillingIdentifier().toString(), registrar.getBillingIdentifier().toString(),
registrar.getPoNumber().orElse(""), registrar.getPoNumber().orElse(""),
DomainNameUtils.getTldFromDomainName(oneTime.getTargetId()), DomainNameUtils.getTldFromDomainName(oneTime.getTargetId()),

View file

@ -151,7 +151,7 @@ public class Spec11Pipeline implements Serializable {
return DomainNameInfo.create( return DomainNameInfo.create(
domainBase.getDomainName(), domainBase.getDomainName(),
domainBase.getRepoId(), domainBase.getRepoId(),
domainBase.getCurrentSponsorClientId(), domainBase.getCurrentSponsorRegistrarId(),
emailAddress); emailAddress);
} }
@ -199,15 +199,15 @@ public class Spec11Pipeline implements Serializable {
MapElements.into(TypeDescriptors.strings()) MapElements.into(TypeDescriptors.strings())
.via( .via(
(KV<String, Iterable<EmailAndThreatMatch>> kv) -> { (KV<String, Iterable<EmailAndThreatMatch>> kv) -> {
String clientId = kv.getKey(); String registrarId = kv.getKey();
checkArgument( checkArgument(
kv.getValue().iterator().hasNext(), kv.getValue().iterator().hasNext(),
String.format( 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(); String email = kv.getValue().iterator().next().email();
JSONObject output = new JSONObject(); JSONObject output = new JSONObject();
try { try {
output.put(REGISTRAR_CLIENT_ID_FIELD, clientId); output.put(REGISTRAR_CLIENT_ID_FIELD, registrarId);
output.put(REGISTRAR_EMAIL_FIELD, email); output.put(REGISTRAR_EMAIL_FIELD, email);
JSONArray threatMatchArray = new JSONArray(); JSONArray threatMatchArray = new JSONArray();
for (EmailAndThreatMatch emailAndThreatMatch : kv.getValue()) { for (EmailAndThreatMatch emailAndThreatMatch : kv.getValue()) {

View file

@ -1138,8 +1138,8 @@ public final class RegistryConfig {
} }
/** /**
* Returns the clientId of the registrar that admins are automatically logged in as if they * Returns the ID of the registrar that admins are automatically logged in as if they aren't
* aren't otherwise associated with one. * otherwise associated with one.
*/ */
@Provides @Provides
@Config("registryAdminClientId") @Config("registryAdminClientId")

View file

@ -19,7 +19,7 @@ import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.request.Action.Method.POST; import static google.registry.request.Action.Method.POST;
import static google.registry.util.CollectionUtils.nullToEmpty; 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_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_OK; 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 * Returns the Google Groups email address for the given registrar ID and RegistrarContact.Type.
* RegistrarContact.Type
*/ */
public static String getGroupEmailAddressForContactType( public static String getGroupEmailAddressForContactType(
String clientId, RegistrarContact.Type type, String gSuiteDomainName) { String registrarId, RegistrarContact.Type type, String gSuiteDomainName) {
// Take the registrar's clientId, make it lowercase, and remove all characters that aren't // Take the registrar's ID, make it lowercase, and remove all characters that aren't
// alphanumeric, hyphens, or underscores. // alphanumeric, hyphens, or underscores.
return String.format( return String.format(
"%s-%s-contacts@%s", "%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 totalAdded = 0;
long totalRemoved = 0; long totalRemoved = 0;
for (final RegistrarContact.Type type : RegistrarContact.Type.values()) { for (final RegistrarContact.Type type : RegistrarContact.Type.values()) {
groupKey = getGroupEmailAddressForContactType( groupKey =
registrar.getClientId(), type, gSuiteDomainName); getGroupEmailAddressForContactType(registrar.getRegistrarId(), type, gSuiteDomainName);
Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey); Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey);
Set<String> desiredMembers = Set<String> desiredMembers =
registrarContacts registrarContacts
@ -196,11 +195,13 @@ public final class SyncGroupMembersAction implements Runnable {
} }
logger.atInfo().log( logger.atInfo().log(
"Successfully synced contacts for registrar %s: added %d and removed %d", "Successfully synced contacts for registrar %s: added %d and removed %d",
registrar.getClientId(), totalAdded, totalRemoved); registrar.getRegistrarId(), totalAdded, totalRemoved);
} catch (IOException e) { } catch (IOException e) {
// Package up exception and re-throw with attached additional relevant info. // 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", String msg =
registrar.getClientId(), groupKey); String.format(
"Couldn't sync contacts for registrar %s to group %s",
registrar.getRegistrarId(), groupKey);
throw new RuntimeException(msg, e); throw new RuntimeException(msg, e);
} }
} }

View file

@ -82,7 +82,7 @@ class SyncRegistrarsSheet {
new Ordering<Registrar>() { new Ordering<Registrar>() {
@Override @Override
public int compare(Registrar left, Registrar right) { public int compare(Registrar left, Registrar right) {
return left.getClientId().compareTo(right.getClientId()); return left.getRegistrarId().compareTo(right.getRegistrarId());
} }
}.immutableSortedCopy(Registrar.loadAllCached()).stream() }.immutableSortedCopy(Registrar.loadAllCached()).stream()
.filter( .filter(
@ -116,7 +116,7 @@ class SyncRegistrarsSheet {
// and you'll need to remove deleted columns probably like a week after // and you'll need to remove deleted columns probably like a week after
// deployment. // deployment.
// //
builder.put("clientIdentifier", convert(registrar.getClientId())); builder.put("clientIdentifier", convert(registrar.getRegistrarId()));
builder.put("registrarName", convert(registrar.getRegistrarName())); builder.put("registrarName", convert(registrar.getRegistrarName()));
builder.put("state", convert(registrar.getState())); builder.put("state", convert(registrar.getState()));
builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier())); builder.put("ianaIdentifier", convert(registrar.getIanaIdentifier()));

View file

@ -61,7 +61,7 @@ public final class EppController {
boolean isDryRun, boolean isDryRun,
boolean isSuperuser, boolean isSuperuser,
byte[] inputXmlBytes) { byte[] inputXmlBytes) {
eppMetricBuilder.setClientId(Optional.ofNullable(sessionMetadata.getClientId())); eppMetricBuilder.setRegistrarId(Optional.ofNullable(sessionMetadata.getRegistrarId()));
try { try {
EppInput eppInput; EppInput eppInput;
try { try {
@ -76,7 +76,7 @@ public final class EppController {
JSONValue.toJSONString( JSONValue.toJSONString(
ImmutableMap.<String, Object>of( ImmutableMap.<String, Object>of(
"clientId", "clientId",
nullToEmpty(sessionMetadata.getClientId()), nullToEmpty(sessionMetadata.getRegistrarId()),
"resultCode", "resultCode",
e.getResult().getCode().code, e.getResult().getCode().code,
"resultMessage", "resultMessage",

View file

@ -88,7 +88,7 @@ public class EppMetrics {
String eppStatusCode = String eppStatusCode =
metric.getStatus().isPresent() ? String.valueOf(metric.getStatus().get().code) : ""; metric.getStatus().isPresent() ? String.valueOf(metric.getStatus().get().code) : "";
eppRequestsByRegistrar.increment( eppRequestsByRegistrar.increment(
metric.getCommandName().orElse(""), metric.getClientId().orElse(""), eppStatusCode); metric.getCommandName().orElse(""), metric.getRegistrarId().orElse(""), eppStatusCode);
eppRequestsByTld.increment( eppRequestsByTld.increment(
metric.getCommandName().orElse(""), metric.getTld().orElse(""), eppStatusCode); metric.getCommandName().orElse(""), metric.getTld().orElse(""), eppStatusCode);
} }

View file

@ -38,7 +38,10 @@ public class EppToolAction implements Runnable {
public static final String PATH = "/_dr/epptool"; public static final String PATH = "/_dr/epptool";
@Inject @Parameter("clientId") String clientId; @Inject
@Parameter("clientId")
String registrarId;
@Inject @Parameter("superuser") boolean isSuperuser; @Inject @Parameter("superuser") boolean isSuperuser;
@Inject @Parameter("dryRun") boolean isDryRun; @Inject @Parameter("dryRun") boolean isDryRun;
@Inject @Parameter("xml") String xml; @Inject @Parameter("xml") String xml;
@ -49,8 +52,7 @@ public class EppToolAction implements Runnable {
public void run() { public void run() {
eppRequestHandler.executeEpp( eppRequestHandler.executeEpp(
new StatelessRequestSessionMetadata( new StatelessRequestSessionMetadata(
clientId, registrarId, ProtocolDefinition.getVisibleServiceExtensionUris()),
ProtocolDefinition.getVisibleServiceExtensionUris()),
new PasswordOnlyTransportCredentials(), new PasswordOnlyTransportCredentials(),
EppRequestSource.TOOL, EppRequestSource.TOOL,
isDryRun, isDryRun,

View file

@ -26,7 +26,7 @@ import com.google.common.flogger.FluentLogger;
import google.registry.flows.EppException.CommandUseErrorException; import google.registry.flows.EppException.CommandUseErrorException;
import google.registry.flows.EppException.SyntaxErrorException; import google.registry.flows.EppException.SyntaxErrorException;
import google.registry.flows.EppException.UnimplementedExtensionException; 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.FlowModule.Superuser;
import google.registry.flows.exceptions.OnlyToolCanPassMetadataException; import google.registry.flows.exceptions.OnlyToolCanPassMetadataException;
import google.registry.flows.exceptions.UnauthorizedForSuperuserExtensionException; import google.registry.flows.exceptions.UnauthorizedForSuperuserExtensionException;
@ -55,7 +55,7 @@ public final class ExtensionManager {
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject SessionMetadata sessionMetadata; @Inject SessionMetadata sessionMetadata;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject Class<? extends Flow> flowClass; @Inject Class<? extends Flow> flowClass;
@Inject EppRequestSource eppRequestSource; @Inject EppRequestSource eppRequestSource;
@ -101,7 +101,7 @@ public final class ExtensionManager {
} }
logger.atInfo().log( logger.atInfo().log(
"Client %s is attempting to run %s without declaring URIs %s on login", "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 = private static final ImmutableSet<EppRequestSource> ALLOWED_METADATA_EPP_REQUEST_SOURCES =

View file

@ -164,11 +164,11 @@ public class FlowModule {
@Provides @Provides
@FlowScope @FlowScope
@ClientId @RegistrarId
static String provideClientId(SessionMetadata sessionMetadata) { static String provideRegistrarId(SessionMetadata sessionMetadata) {
// Treat a missing clientId as null so we can always inject a non-null value. All we do with the // Treat a missing registrarId as null so we can always inject a non-null value. All we do with
// clientId is log it (as "") or detect its absence, both of which work fine with empty. // the registrarId is log it (as "") or detect its absence, both of which work fine with empty.
return Strings.nullToEmpty(sessionMetadata.getClientId()); return Strings.nullToEmpty(sessionMetadata.getRegistrarId());
} }
@Provides @Provides
@ -220,14 +220,14 @@ public class FlowModule {
Trid trid, Trid trid,
byte[] inputXmlBytes, byte[] inputXmlBytes,
boolean isSuperuser, boolean isSuperuser,
String clientId, String registrarId,
EppInput eppInput) { EppInput eppInput) {
builder builder
.setModificationTime(tm().getTransactionTime()) .setModificationTime(tm().getTransactionTime())
.setTrid(trid) .setTrid(trid)
.setXmlBytes(inputXmlBytes) .setXmlBytes(inputXmlBytes)
.setBySuperuser(isSuperuser) .setBySuperuser(isSuperuser)
.setClientId(clientId); .setRegistrarId(registrarId);
Optional<MetadataExtension> metadataExtension = Optional<MetadataExtension> metadataExtension =
eppInput.getSingleExtension(MetadataExtension.class); eppInput.getSingleExtension(MetadataExtension.class);
metadataExtension.ifPresent( metadataExtension.ifPresent(
@ -249,10 +249,10 @@ public class FlowModule {
Trid trid, Trid trid,
@InputXml byte[] inputXmlBytes, @InputXml byte[] inputXmlBytes,
@Superuser boolean isSuperuser, @Superuser boolean isSuperuser,
@ClientId String clientId, @RegistrarId String registrarId,
EppInput eppInput) { EppInput eppInput) {
return makeHistoryEntryBuilder( 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, Trid trid,
@InputXml byte[] inputXmlBytes, @InputXml byte[] inputXmlBytes,
@Superuser boolean isSuperuser, @Superuser boolean isSuperuser,
@ClientId String clientId, @RegistrarId String registrarId,
EppInput eppInput) { EppInput eppInput) {
return makeHistoryEntryBuilder( 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, Trid trid,
@InputXml byte[] inputXmlBytes, @InputXml byte[] inputXmlBytes,
@Superuser boolean isSuperuser, @Superuser boolean isSuperuser,
@ClientId String clientId, @RegistrarId String registrarId,
EppInput eppInput) { EppInput eppInput) {
return makeHistoryEntryBuilder( 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. */ /** Dagger qualifier for registrar client id. */
@Qualifier @Qualifier
@Documented @Documented
public @interface ClientId {} public @interface RegistrarId {}
/** Dagger qualifier for the target id (foreign key) for single resource flows. */ /** Dagger qualifier for the target id (foreign key) for single resource flows. */
@Qualifier @Qualifier

View file

@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Streams; import com.google.common.collect.Streams;
import com.google.common.flogger.FluentLogger; import com.google.common.flogger.FluentLogger;
import google.registry.flows.FlowModule.ClientId;
import google.registry.flows.FlowModule.InputXml; import google.registry.flows.FlowModule.InputXml;
import google.registry.flows.FlowModule.RegistrarId;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
import google.registry.model.eppinput.EppInput; import google.registry.model.eppinput.EppInput;
@ -45,7 +45,7 @@ public class FlowReporter {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Inject Trid trid; @Inject Trid trid;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @InputXml byte[] inputXmlBytes; @Inject @InputXml byte[] inputXmlBytes;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject Class<? extends Flow> flowClass; @Inject Class<? extends Flow> flowClass;
@ -64,7 +64,7 @@ public class FlowReporter {
JSONValue.toJSONString( JSONValue.toJSONString(
new ImmutableMap.Builder<String, Object>() new ImmutableMap.Builder<String, Object>()
.put("serverTrid", trid.getServerTransactionId()) .put("serverTrid", trid.getServerTransactionId())
.put("clientId", clientId) .put("clientId", registrarId)
.put("commandType", eppInput.getCommandType()) .put("commandType", eppInput.getCommandType())
.put("resourceType", eppInput.getResourceType().orElse("")) .put("resourceType", eppInput.getResourceType().orElse(""))
.put("flowClassName", flowClass.getSimpleName()) .put("flowClassName", flowClass.getSimpleName())

View file

@ -19,9 +19,9 @@ import static google.registry.xml.XmlTransformer.prettyPrint;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.flogger.FluentLogger; import com.google.common.flogger.FluentLogger;
import google.registry.flows.FlowModule.ClientId;
import google.registry.flows.FlowModule.DryRun; import google.registry.flows.FlowModule.DryRun;
import google.registry.flows.FlowModule.InputXml; import google.registry.flows.FlowModule.InputXml;
import google.registry.flows.FlowModule.RegistrarId;
import google.registry.flows.FlowModule.Superuser; import google.registry.flows.FlowModule.Superuser;
import google.registry.flows.FlowModule.Transactional; import google.registry.flows.FlowModule.Transactional;
import google.registry.flows.session.LoginFlow; import google.registry.flows.session.LoginFlow;
@ -38,7 +38,7 @@ public class FlowRunner {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject TransportCredentials credentials; @Inject TransportCredentials credentials;
@Inject EppRequestSource eppRequestSource; @Inject EppRequestSource eppRequestSource;
@Inject Provider<Flow> flowProvider; @Inject Provider<Flow> flowProvider;
@ -59,7 +59,7 @@ public class FlowRunner {
logger.atInfo().log( logger.atInfo().log(
COMMAND_LOG_FORMAT, COMMAND_LOG_FORMAT,
trid.getServerTransactionId(), trid.getServerTransactionId(),
clientId, registrarId,
sessionMetadata, sessionMetadata,
prettyXml.replace("\n", "\n\t"), prettyXml.replace("\n", "\n\t"),
credentials, credentials,
@ -74,8 +74,8 @@ public class FlowRunner {
if (!isTransactional) { if (!isTransactional) {
EppOutput eppOutput = EppOutput.create(flowProvider.get().run()); EppOutput eppOutput = EppOutput.create(flowProvider.get().run());
if (flowClass.equals(LoginFlow.class)) { if (flowClass.equals(LoginFlow.class)) {
// In LoginFlow, clientId isn't known until after the flow executes, so save it then. // In LoginFlow, registrarId isn't known until after the flow executes, so save it then.
eppMetricBuilder.setClientId(sessionMetadata.getClientId()); eppMetricBuilder.setRegistrarId(sessionMetadata.getRegistrarId());
} }
return eppOutput; return eppOutput;
} }

View file

@ -47,8 +47,8 @@ public final class FlowUtils {
private FlowUtils() {} private FlowUtils() {}
/** Validate that there is a logged in client. */ /** Validate that there is a logged in client. */
public static void validateClientIsLoggedIn(String clientId) throws EppException { public static void validateRegistrarIsLoggedIn(String registrarId) throws EppException {
if (clientId.isEmpty()) { if (registrarId.isEmpty()) {
throw new NotLoggedInException(); throw new NotLoggedInException();
} }
} }

View file

@ -25,7 +25,7 @@ import javax.servlet.http.HttpSession;
/** A metadata class that is a wrapper around {@link HttpSession}. */ /** A metadata class that is a wrapper around {@link HttpSession}. */
public class HttpSessionMetadata implements SessionMetadata { 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 SERVICE_EXTENSIONS = "SERVICE_EXTENSIONS";
private static final String FAILED_LOGIN_ATTEMPTS = "FAILED_LOGIN_ATTEMPTS"; private static final String FAILED_LOGIN_ATTEMPTS = "FAILED_LOGIN_ATTEMPTS";
@ -41,8 +41,8 @@ public class HttpSessionMetadata implements SessionMetadata {
} }
@Override @Override
public String getClientId() { public String getRegistrarId() {
return (String) session.getAttribute(CLIENT_ID); return (String) session.getAttribute(REGISTRAR_ID);
} }
@Override @Override
@ -57,8 +57,8 @@ public class HttpSessionMetadata implements SessionMetadata {
} }
@Override @Override
public void setClientId(String clientId) { public void setRegistrarId(String registrarId) {
session.setAttribute(CLIENT_ID, clientId); session.setAttribute(REGISTRAR_ID, registrarId);
} }
@Override @Override
@ -79,7 +79,7 @@ public class HttpSessionMetadata implements SessionMetadata {
@Override @Override
public String toString() { public String toString() {
return toStringHelper(getClass()) return toStringHelper(getClass())
.add("clientId", getClientId()) .add("clientId", getRegistrarId())
.add("failedLoginAttempts", getFailedLoginAttempts()) .add("failedLoginAttempts", getFailedLoginAttempts())
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris()))) .add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
.toString(); .toString();

View file

@ -69,10 +69,10 @@ public final class ResourceFlowUtils {
*/ */
private static final int FAILFAST_CHECK_COUNT = 5; private static final int FAILFAST_CHECK_COUNT = 5;
/** Check that the given clientId corresponds to the owner of given resource. */ /** Check that the given registrarId corresponds to the owner of given resource. */
public static void verifyResourceOwnership(String myClientId, EppResource resource) public static void verifyResourceOwnership(String myRegistrarId, EppResource resource)
throws EppException { throws EppException {
if (!myClientId.equals(resource.getPersistedCurrentSponsorClientId())) { if (!myRegistrarId.equals(resource.getPersistedCurrentSponsorRegistrarId())) {
throw new ResourceNotOwnedException(); throw new ResourceNotOwnedException();
} }
} }
@ -138,8 +138,8 @@ public final class ResourceFlowUtils {
} }
public static <R extends EppResource & ResourceWithTransferData> void verifyTransferInitiator( public static <R extends EppResource & ResourceWithTransferData> void verifyTransferInitiator(
String clientId, R resource) throws NotTransferInitiatorException { String registrarId, R resource) throws NotTransferInitiatorException {
if (!resource.getTransferData().getGainingClientId().equals(clientId)) { if (!resource.getTransferData().getGainingRegistrarId().equals(registrarId)) {
throw new NotTransferInitiatorException(); throw new NotTransferInitiatorException();
} }
} }
@ -155,12 +155,12 @@ public final class ResourceFlowUtils {
} }
public static <R extends EppResource> void verifyResourceDoesNotExist( 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); VKey<R> key = loadAndGetKey(clazz, targetId, now);
if (key != null) { if (key != null) {
R resource = tm().loadByKey(key); R resource = tm().loadByKey(key);
// These are similar exceptions, but we can track them internally as log-based metrics. // 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); throw new ResourceAlreadyExistsForThisClientException(targetId);
} else { } else {
throw new ResourceCreateContentionException(targetId); throw new ResourceCreateContentionException(targetId);

View file

@ -26,13 +26,13 @@ public interface SessionMetadata {
*/ */
void invalidate(); void invalidate();
String getClientId(); String getRegistrarId();
Set<String> getServiceExtensionUris(); Set<String> getServiceExtensionUris();
int getFailedLoginAttempts(); int getFailedLoginAttempts();
void setClientId(String clientId); void setRegistrarId(String registrarId);
void setServiceExtensionUris(Set<String> serviceExtensionUris); void setServiceExtensionUris(Set<String> serviceExtensionUris);

View file

@ -25,12 +25,12 @@ import java.util.Set;
/** A read-only {@link SessionMetadata} that doesn't support login/logout. */ /** A read-only {@link SessionMetadata} that doesn't support login/logout. */
public class StatelessRequestSessionMetadata implements SessionMetadata { public class StatelessRequestSessionMetadata implements SessionMetadata {
private final String clientId; private final String registrarId;
private final ImmutableSet<String> serviceExtensionUris; private final ImmutableSet<String> serviceExtensionUris;
public StatelessRequestSessionMetadata( public StatelessRequestSessionMetadata(
String clientId, ImmutableSet<String> serviceExtensionUris) { String registrarId, ImmutableSet<String> serviceExtensionUris) {
this.clientId = checkNotNull(clientId); this.registrarId = checkNotNull(registrarId);
this.serviceExtensionUris = checkNotNull(serviceExtensionUris); this.serviceExtensionUris = checkNotNull(serviceExtensionUris);
} }
@ -40,8 +40,8 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
} }
@Override @Override
public String getClientId() { public String getRegistrarId() {
return clientId; return registrarId;
} }
@Override @Override
@ -55,7 +55,7 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
} }
@Override @Override
public void setClientId(String clientId) { public void setRegistrarId(String registrarId) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -77,7 +77,7 @@ public class StatelessRequestSessionMetadata implements SessionMetadata {
@Override @Override
public String toString() { public String toString() {
return toStringHelper(getClass()) return toStringHelper(getClass())
.add("clientId", getClientId()) .add("clientId", getRegistrarId())
.add("failedLoginAttempts", getFailedLoginAttempts()) .add("failedLoginAttempts", getFailedLoginAttempts())
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris()))) .add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))
.toString(); .toString();

View file

@ -97,7 +97,7 @@ public class TlsCredentials implements TransportCredentials {
if (ipAddressAllowList.isEmpty()) { if (ipAddressAllowList.isEmpty()) {
logger.atInfo().log( logger.atInfo().log(
"Skipping IP allow list check because %s doesn't have an IP allow list.", "Skipping IP allow list check because %s doesn't have an IP allow list.",
registrar.getClientId()); registrar.getRegistrarId());
return; return;
} }
// In the rare unexpected case that the client inet address wasn't passed along at all, then // 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( logger.atInfo().log(
"Authentication error: IP address %s is not allow-listed for registrar %s; allow list is:" "Authentication error: IP address %s is not allow-listed for registrar %s; allow list is:"
+ " %s", + " %s",
clientInetAddr, registrar.getClientId(), ipAddressAllowList); clientInetAddr, registrar.getRegistrarId(), ipAddressAllowList);
throw new BadRegistrarIpAddressException(); throw new BadRegistrarIpAddressException();
} }
@ -132,7 +132,8 @@ public class TlsCredentials implements TransportCredentials {
// Check that the request included the certificate hash // Check that the request included the certificate hash
if (!clientCertificateHash.isPresent()) { if (!clientCertificateHash.isPresent()) {
logger.atInfo().log( 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(); throw new MissingRegistrarCertificateException();
} }
// Check if the certificate hash is equal to the one on file for the registrar. // 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( logger.atWarning().log(
"Non-matching certificate hash (%s) for %s, wanted either %s or %s.", "Non-matching certificate hash (%s) for %s, wanted either %s or %s.",
clientCertificateHash, clientCertificateHash,
registrar.getClientId(), registrar.getRegistrarId(),
registrar.getClientCertificateHash(), registrar.getClientCertificateHash(),
registrar.getFailoverClientCertificateHash()); registrar.getFailoverClientCertificateHash());
throw new BadRegistrarCertificateException(); throw new BadRegistrarCertificateException();
@ -156,7 +157,7 @@ public class TlsCredentials implements TransportCredentials {
} catch (InsecureCertificateException e) { } catch (InsecureCertificateException e) {
logger.atWarning().log( logger.atWarning().log(
"Registrar certificate used for %s does not meet certificate requirements: %s", "Registrar certificate used for %s does not meet certificate requirements: %s",
registrar.getClientId(), e.getMessage()); registrar.getRegistrarId(), e.getMessage());
throw new CertificateContainsSecurityViolationsException(e); throw new CertificateContainsSecurityViolationsException(e);
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.flows.ResourceFlowUtils.verifyTargetIdCount;
import static google.registry.model.EppResourceUtils.checkResourcesExist; 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.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.flows.annotations.ReportingSpec;
import google.registry.model.contact.ContactCommand.Check; import google.registry.model.contact.ContactCommand.Check;
import google.registry.model.contact.ContactResource; import google.registry.model.contact.ContactResource;
@ -47,7 +47,7 @@ import javax.inject.Inject;
public final class ContactCheckFlow implements Flow { public final class ContactCheckFlow implements Flow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Clock clock; @Inject Clock clock;
@Inject @Config("maxChecks") int maxChecks; @Inject @Config("maxChecks") int maxChecks;
@ -57,7 +57,7 @@ public final class ContactCheckFlow implements Flow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
ImmutableList<String> targetIds = ((Check) resourceCommand).getTargetIds(); ImmutableList<String> targetIds = ((Check) resourceCommand).getTargetIds();
verifyTargetIdCount(targetIds, maxChecks); verifyTargetIdCount(targetIds, maxChecks);
ImmutableSet<String> existingIds = ImmutableSet<String> existingIds =

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.ResourceFlowUtils.verifyResourceDoesNotExist;
import static google.registry.flows.contact.ContactFlowUtils.validateAsciiPostalInfo; import static google.registry.flows.contact.ContactFlowUtils.validateAsciiPostalInfo;
import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy; 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.config.RegistryConfig.Config;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -60,7 +60,7 @@ public final class ContactCreateFlow implements TransactionalFlow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject ContactHistory.Builder historyBuilder; @Inject ContactHistory.Builder historyBuilder;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -71,16 +71,16 @@ public final class ContactCreateFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
Create command = (Create) resourceCommand; Create command = (Create) resourceCommand;
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
verifyResourceDoesNotExist(ContactResource.class, targetId, now, clientId); verifyResourceDoesNotExist(ContactResource.class, targetId, now, registrarId);
ContactResource newContact = ContactResource newContact =
new ContactResource.Builder() new ContactResource.Builder()
.setContactId(targetId) .setContactId(targetId)
.setAuthInfo(command.getAuthInfo()) .setAuthInfo(command.getAuthInfo())
.setCreationClientId(clientId) .setCreationRegistrarId(registrarId)
.setPersistedCurrentSponsorClientId(clientId) .setPersistedCurrentSponsorRegistrarId(registrarId)
.setRepoId(createRepoId(allocateId(), roidSuffix)) .setRepoId(createRepoId(allocateId(), roidSuffix))
.setFaxNumber(command.getFax()) .setFaxNumber(command.getFax())
.setVoiceNumber(command.getVoice()) .setVoiceNumber(command.getVoice())

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.checkLinkedDomains;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; 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.batch.AsyncTaskEnqueuer;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -75,7 +75,7 @@ public final class ContactDeleteFlow implements TransactionalFlow {
StatusValue.SERVER_DELETE_PROHIBITED); StatusValue.SERVER_DELETE_PROHIBITED);
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Trid trid; @Inject Trid trid;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@ -91,21 +91,21 @@ public final class ContactDeleteFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
checkLinkedDomains(targetId, now, ContactResource.class, DomainBase::getReferencedContacts); checkLinkedDomains(targetId, now, ContactResource.class, DomainBase::getReferencedContacts);
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES); verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES);
verifyOptionalAuthInfo(authInfo, existingContact); verifyOptionalAuthInfo(authInfo, existingContact);
if (!isSuperuser) { if (!isSuperuser) {
verifyResourceOwnership(clientId, existingContact); verifyResourceOwnership(registrarId, existingContact);
} }
Type historyEntryType; Type historyEntryType;
Code resultCode; Code resultCode;
ContactResource newContact; ContactResource newContact;
if (tm().isOfy()) { if (tm().isOfy()) {
asyncTaskEnqueuer.enqueueAsyncDelete( asyncTaskEnqueuer.enqueueAsyncDelete(
existingContact, tm().getTransactionTime(), clientId, trid, isSuperuser); existingContact, tm().getTransactionTime(), registrarId, trid, isSuperuser);
newContact = existingContact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build(); newContact = existingContact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build();
historyEntryType = Type.CONTACT_PENDING_DELETE; historyEntryType = Type.CONTACT_PENDING_DELETE;
resultCode = SUCCESS_WITH_ACTION_PENDING; resultCode = SUCCESS_WITH_ACTION_PENDING;
@ -113,7 +113,7 @@ public final class ContactDeleteFlow implements TransactionalFlow {
// Handle pending transfers on contact deletion. // Handle pending transfers on contact deletion.
newContact = newContact =
existingContact.getStatusValues().contains(StatusValue.PENDING_TRANSFER) existingContact.getStatusValues().contains(StatusValue.PENDING_TRANSFER)
? denyPendingTransfer(existingContact, SERVER_CANCELLED, now, clientId) ? denyPendingTransfer(existingContact, SERVER_CANCELLED, now, registrarId)
: existingContact; : existingContact;
// Wipe out PII on contact deletion. // Wipe out PII on contact deletion.
newContact = newContact =

View file

@ -73,7 +73,7 @@ public class ContactFlowUtils {
DateTime now, DateTime now,
Key<ContactHistory> contactHistoryKey) { Key<ContactHistory> contactHistoryKey) {
return new PollMessage.OneTime.Builder() return new PollMessage.OneTime.Builder()
.setClientId(transferData.getGainingClientId()) .setRegistrarId(transferData.getGainingRegistrarId())
.setEventTime(transferData.getPendingTransferExpirationTime()) .setEventTime(transferData.getPendingTransferExpirationTime())
.setMsg(transferData.getTransferStatus().getMessage()) .setMsg(transferData.getTransferStatus().getMessage())
.setResponseData( .setResponseData(
@ -92,7 +92,7 @@ public class ContactFlowUtils {
static PollMessage createLosingTransferPollMessage( static PollMessage createLosingTransferPollMessage(
String targetId, TransferData transferData, Key<ContactHistory> contactHistoryKey) { String targetId, TransferData transferData, Key<ContactHistory> contactHistoryKey) {
return new PollMessage.OneTime.Builder() return new PollMessage.OneTime.Builder()
.setClientId(transferData.getLosingClientId()) .setRegistrarId(transferData.getLosingRegistrarId())
.setEventTime(transferData.getPendingTransferExpirationTime()) .setEventTime(transferData.getPendingTransferExpirationTime())
.setMsg(transferData.getTransferStatus().getMessage()) .setMsg(transferData.getTransferStatus().getMessage())
.setResponseData(ImmutableList.of(createTransferResponse(targetId, transferData))) .setResponseData(ImmutableList.of(createTransferResponse(targetId, transferData)))
@ -105,8 +105,8 @@ public class ContactFlowUtils {
String targetId, TransferData transferData) { String targetId, TransferData transferData) {
return new ContactTransferResponse.Builder() return new ContactTransferResponse.Builder()
.setContactId(targetId) .setContactId(targetId)
.setGainingClientId(transferData.getGainingClientId()) .setGainingRegistrarId(transferData.getGainingRegistrarId())
.setLosingClientId(transferData.getLosingClientId()) .setLosingRegistrarId(transferData.getLosingRegistrarId())
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime()) .setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
.setTransferRequestTime(transferData.getTransferRequestTime()) .setTransferRequestTime(transferData.getTransferRequestTime())
.setTransferStatus(transferData.getTransferStatus()) .setTransferStatus(transferData.getTransferStatus())

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership; import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.model.EppResourceUtils.isLinked; 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.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -54,7 +54,7 @@ public final class ContactInfoFlow implements Flow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Clock clock; @Inject Clock clock;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@ -67,13 +67,13 @@ public final class ContactInfoFlow implements Flow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
DateTime now = clock.nowUtc(); DateTime now = clock.nowUtc();
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
ContactResource contact = loadAndVerifyExistence(ContactResource.class, targetId, now); ContactResource contact = loadAndVerifyExistence(ContactResource.class, targetId, now);
if (!isSuperuser) { if (!isSuperuser) {
verifyResourceOwnership(clientId, contact); verifyResourceOwnership(registrarId, contact);
} }
boolean includeAuthInfo = boolean includeAuthInfo =
clientId.equals(contact.getCurrentSponsorClientId()) || authInfo.isPresent(); registrarId.equals(contact.getCurrentSponsorRegistrarId()) || authInfo.isPresent();
ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>(); ImmutableSet.Builder<StatusValue> statusValues = new ImmutableSet.Builder<>();
statusValues.addAll(contact.getStatusValues()); statusValues.addAll(contact.getStatusValues());
if (isLinked(contact.createVKey(), now)) { if (isLinked(contact.createVKey(), now)) {
@ -89,10 +89,10 @@ public final class ContactInfoFlow implements Flow {
.setVoiceNumber(contact.getVoiceNumber()) .setVoiceNumber(contact.getVoiceNumber())
.setFaxNumber(contact.getFaxNumber()) .setFaxNumber(contact.getFaxNumber())
.setEmailAddress(contact.getEmailAddress()) .setEmailAddress(contact.getEmailAddress())
.setCurrentSponsorClientId(contact.getCurrentSponsorClientId()) .setCurrentSponsorClientId(contact.getCurrentSponsorRegistrarId())
.setCreationClientId(contact.getCreationClientId()) .setCreationClientId(contact.getCreationRegistrarId())
.setCreationTime(contact.getCreationTime()) .setCreationTime(contact.getCreationTime())
.setLastEppUpdateClientId(contact.getLastEppUpdateClientId()) .setLastEppUpdateClientId(contact.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(contact.getLastEppUpdateTime()) .setLastEppUpdateTime(contact.getLastEppUpdateTime())
.setLastTransferTime(contact.getLastTransferTime()) .setLastTransferTime(contact.getLastTransferTime())
.setAuthInfo(includeAuthInfo ? contact.getAuthInfo() : null) .setAuthInfo(includeAuthInfo ? contact.getAuthInfo() : null)

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -64,7 +64,7 @@ public final class ContactTransferApproveFlow implements TransactionalFlow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject ContactHistory.Builder historyBuilder; @Inject ContactHistory.Builder historyBuilder;
@ -79,12 +79,12 @@ public final class ContactTransferApproveFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
verifyOptionalAuthInfo(authInfo, existingContact); verifyOptionalAuthInfo(authInfo, existingContact);
verifyHasPendingTransfer(existingContact); verifyHasPendingTransfer(existingContact);
verifyResourceOwnership(clientId, existingContact); verifyResourceOwnership(registrarId, existingContact);
ContactResource newContact = ContactResource newContact =
approvePendingTransfer(existingContact, TransferStatus.CLIENT_APPROVED, now); approvePendingTransfer(existingContact, TransferStatus.CLIENT_APPROVED, now);
ContactHistory contactHistory = ContactHistory contactHistory =

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -65,7 +65,7 @@ public final class ContactTransferCancelFlow implements TransactionalFlow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject ContactHistory.Builder historyBuilder; @Inject ContactHistory.Builder historyBuilder;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -75,14 +75,14 @@ public final class ContactTransferCancelFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
verifyOptionalAuthInfo(authInfo, existingContact); verifyOptionalAuthInfo(authInfo, existingContact);
verifyHasPendingTransfer(existingContact); verifyHasPendingTransfer(existingContact);
verifyTransferInitiator(clientId, existingContact); verifyTransferInitiator(registrarId, existingContact);
ContactResource newContact = ContactResource newContact =
denyPendingTransfer(existingContact, TransferStatus.CLIENT_CANCELLED, now, clientId); denyPendingTransfer(existingContact, TransferStatus.CLIENT_CANCELLED, now, registrarId);
ContactHistory contactHistory = ContactHistory contactHistory =
historyBuilder.setType(CONTACT_TRANSFER_CANCEL).setContact(newContact).build(); historyBuilder.setType(CONTACT_TRANSFER_CANCEL).setContact(newContact).build();
// Create a poll message for the losing client. // Create a poll message for the losing client.

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse; 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.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.FlowModule.TargetId;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
import google.registry.flows.exceptions.NoTransferHistoryToQueryException; import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
@ -55,7 +55,7 @@ public final class ContactTransferQueryFlow implements Flow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Clock clock; @Inject Clock clock;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -64,7 +64,7 @@ public final class ContactTransferQueryFlow implements Flow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
ContactResource contact = ContactResource contact =
loadAndVerifyExistence(ContactResource.class, targetId, clock.nowUtc()); loadAndVerifyExistence(ContactResource.class, targetId, clock.nowUtc());
verifyOptionalAuthInfo(authInfo, contact); 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 // Note that the authorization info on the command (if present) has already been verified. If
// it's present, then the other checks are unnecessary. // it's present, then the other checks are unnecessary.
if (!authInfo.isPresent() if (!authInfo.isPresent()
&& !clientId.equals(contact.getTransferData().getGainingClientId()) && !registrarId.equals(contact.getTransferData().getGainingRegistrarId())
&& !clientId.equals(contact.getTransferData().getLosingClientId())) { && !registrarId.equals(contact.getTransferData().getLosingRegistrarId())) {
throw new NotAuthorizedToViewTransferException(); throw new NotAuthorizedToViewTransferException();
} }
return responseBuilder return responseBuilder

View file

@ -14,7 +14,7 @@
package google.registry.flows.contact; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -63,7 +63,7 @@ public final class ContactTransferRejectFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject ContactHistory.Builder historyBuilder; @Inject ContactHistory.Builder historyBuilder;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -73,14 +73,14 @@ public final class ContactTransferRejectFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
verifyOptionalAuthInfo(authInfo, existingContact); verifyOptionalAuthInfo(authInfo, existingContact);
verifyHasPendingTransfer(existingContact); verifyHasPendingTransfer(existingContact);
verifyResourceOwnership(clientId, existingContact); verifyResourceOwnership(registrarId, existingContact);
ContactResource newContact = ContactResource newContact =
denyPendingTransfer(existingContact, TransferStatus.CLIENT_REJECTED, now, clientId); denyPendingTransfer(existingContact, TransferStatus.CLIENT_REJECTED, now, registrarId);
ContactHistory contactHistory = ContactHistory contactHistory =
historyBuilder.setType(CONTACT_TRANSFER_REJECT).setContact(newContact).build(); historyBuilder.setType(CONTACT_TRANSFER_REJECT).setContact(newContact).build();
PollMessage gainingPollMessage = PollMessage gainingPollMessage =

View file

@ -15,7 +15,7 @@
package google.registry.flows.contact; package google.registry.flows.contact;
import static google.registry.flows.FlowUtils.createHistoryKey; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo;
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfoPresentForResourceTransfer; 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.config.RegistryConfig.Config;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -80,7 +80,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String gainingClientId; @Inject @RegistrarId String gainingClientId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Config("contactAutomaticTransferLength") Duration automaticTransferLength; @Inject @Config("contactAutomaticTransferLength") Duration automaticTransferLength;
@ -93,7 +93,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(gainingClientId); validateRegistrarIsLoggedIn(gainingClientId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
verifyAuthInfoPresentForResourceTransfer(authInfo); verifyAuthInfoPresentForResourceTransfer(authInfo);
@ -102,7 +102,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
if (TransferStatus.PENDING.equals(existingContact.getTransferData().getTransferStatus())) { if (TransferStatus.PENDING.equals(existingContact.getTransferData().getTransferStatus())) {
throw new AlreadyPendingTransferException(targetId); throw new AlreadyPendingTransferException(targetId);
} }
String losingClientId = existingContact.getCurrentSponsorClientId(); String losingClientId = existingContact.getCurrentSponsorRegistrarId();
// Verify that this client doesn't already sponsor this resource. // Verify that this client doesn't already sponsor this resource.
if (gainingClientId.equals(losingClientId)) { if (gainingClientId.equals(losingClientId)) {
throw new ObjectAlreadySponsoredException(); throw new ObjectAlreadySponsoredException();
@ -114,8 +114,8 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
new ContactTransferData.Builder() new ContactTransferData.Builder()
.setTransferRequestTime(now) .setTransferRequestTime(now)
.setTransferRequestTrid(trid) .setTransferRequestTrid(trid)
.setGainingClientId(gainingClientId) .setGainingRegistrarId(gainingClientId)
.setLosingClientId(losingClientId) .setLosingRegistrarId(losingClientId)
.setPendingTransferExpirationTime(transferExpirationTime) .setPendingTransferExpirationTime(transferExpirationTime)
.setTransferStatus(TransferStatus.SERVER_APPROVED) .setTransferStatus(TransferStatus.SERVER_APPROVED)
.build(); .build();

View file

@ -15,7 +15,7 @@
package google.registry.flows.contact; package google.registry.flows.contact;
import static com.google.common.collect.Sets.union; 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.checkSameValuesNotAddedAndRemoved;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable; 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 com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -79,7 +79,7 @@ public final class ContactUpdateFlow implements TransactionalFlow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject ContactHistory.Builder historyBuilder; @Inject ContactHistory.Builder historyBuilder;
@ -90,7 +90,7 @@ public final class ContactUpdateFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
Update command = (Update) resourceCommand; Update command = (Update) resourceCommand;
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now); 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> statusToRemove = command.getInnerRemove().getStatusValues();
ImmutableSet<StatusValue> statusesToAdd = command.getInnerAdd().getStatusValues(); ImmutableSet<StatusValue> statusesToAdd = command.getInnerAdd().getStatusValues();
if (!isSuperuser) { // The superuser can update any contact and set any status. if (!isSuperuser) { // The superuser can update any contact and set any status.
verifyResourceOwnership(clientId, existingContact); verifyResourceOwnership(registrarId, existingContact);
verifyAllStatusesAreClientSettable(union(statusesToAdd, statusToRemove)); verifyAllStatusesAreClientSettable(union(statusesToAdd, statusToRemove));
} }
verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES); verifyNoDisallowedStatuses(existingContact, DISALLOWED_STATUSES);
@ -125,9 +125,10 @@ public final class ContactUpdateFlow implements TransactionalFlow {
builder.setInternationalizedPostalInfo(null); builder.setInternationalizedPostalInfo(null);
} }
} }
ContactResource newContact = builder ContactResource newContact =
builder
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(clientId) .setLastEppUpdateRegistrarId(registrarId)
.setAuthInfo(preferFirst(change.getAuthInfo(), existingContact.getAuthInfo())) .setAuthInfo(preferFirst(change.getAuthInfo(), existingContact.getAuthInfo()))
.setDisclose(preferFirst(change.getDisclose(), existingContact.getDisclose())) .setDisclose(preferFirst(change.getDisclose(), existingContact.getDisclose()))
.setEmailAddress(preferFirst(change.getEmail(), existingContact.getEmailAddress())) .setEmailAddress(preferFirst(change.getEmail(), existingContact.getEmailAddress()))

View file

@ -17,7 +17,7 @@ package google.registry.flows.domain;
import static com.google.common.base.Strings.emptyToNull; import static com.google.common.base.Strings.emptyToNull;
import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableMap.toImmutableMap; 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.ResourceFlowUtils.verifyTargetIdCount;
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld; import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
import static google.registry.flows.domain.DomainFlowUtils.getReservationTypes; 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.EppException.ParameterValuePolicyErrorException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.Superuser;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
import google.registry.flows.custom.DomainCheckFlowCustomLogic; import google.registry.flows.custom.DomainCheckFlowCustomLogic;
@ -113,7 +113,7 @@ public final class DomainCheckFlow implements Flow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @Inject
@Config("maxChecks") @Config("maxChecks")
@ -135,7 +135,7 @@ public final class DomainCheckFlow implements Flow {
FeeCheckCommandExtension.class, LaunchCheckExtension.class, AllocationTokenExtension.class); FeeCheckCommandExtension.class, LaunchCheckExtension.class, AllocationTokenExtension.class);
flowCustomLogic.beforeValidation(); flowCustomLogic.beforeValidation();
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
ImmutableList<String> domainNames = ((Check) resourceCommand).getTargetIds(); ImmutableList<String> domainNames = ((Check) resourceCommand).getTargetIds();
verifyTargetIdCount(domainNames, maxChecks); verifyTargetIdCount(domainNames, maxChecks);
DateTime now = clock.nowUtc(); DateTime now = clock.nowUtc();
@ -151,7 +151,7 @@ public final class DomainCheckFlow implements Flow {
String tld = parsedDomain.parent().toString(); String tld = parsedDomain.parent().toString();
boolean tldFirstTimeSeen = seenTlds.add(tld); boolean tldFirstTimeSeen = seenTlds.add(tld);
if (tldFirstTimeSeen && !isSuperuser) { if (tldFirstTimeSeen && !isSuperuser) {
checkAllowedAccessToTld(clientId, tld); checkAllowedAccessToTld(registrarId, tld);
verifyNotInPredelegation(Registry.get(tld), now); verifyNotInPredelegation(Registry.get(tld), now);
} }
} }
@ -172,7 +172,7 @@ public final class DomainCheckFlow implements Flow {
allocationTokenFlowUtils.checkDomainsWithToken( allocationTokenFlowUtils.checkDomainsWithToken(
ImmutableList.copyOf(parsedDomains.values()), ImmutableList.copyOf(parsedDomains.values()),
tokenExtension.getAllocationToken(), tokenExtension.getAllocationToken(),
clientId, registrarId,
now)); now));
ImmutableList.Builder<DomainCheck> checksBuilder = new ImmutableList.Builder<>(); ImmutableList.Builder<DomainCheck> checksBuilder = new ImmutableList.Builder<>();

View file

@ -14,7 +14,7 @@
package google.registry.flows.domain; 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.ResourceFlowUtils.verifyTargetIdCount;
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld; import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
import static google.registry.flows.domain.DomainFlowUtils.validateDomainName; 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.EppException.CommandUseErrorException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.Superuser;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.domain.DomainCommand.Check; import google.registry.model.domain.DomainCommand.Check;
@ -69,7 +69,7 @@ public final class DomainClaimsCheckFlow implements Flow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject Clock clock; @Inject Clock clock;
@Inject @Config("maxChecks") int maxChecks; @Inject @Config("maxChecks") int maxChecks;
@ -82,7 +82,7 @@ public final class DomainClaimsCheckFlow implements Flow {
public EppResponse run() throws EppException { public EppResponse run() throws EppException {
extensionManager.register(LaunchCheckExtension.class, AllocationTokenExtension.class); extensionManager.register(LaunchCheckExtension.class, AllocationTokenExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
if (eppInput.getSingleExtension(AllocationTokenExtension.class).isPresent()) { if (eppInput.getSingleExtension(AllocationTokenExtension.class).isPresent()) {
throw new DomainClaimsCheckNotAllowedWithAllocationTokens(); 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. // Only validate access to a TLD the first time it is encountered.
if (seenTlds.add(tld)) { if (seenTlds.add(tld)) {
if (!isSuperuser) { if (!isSuperuser) {
checkAllowedAccessToTld(clientId, tld); checkAllowedAccessToTld(registrarId, tld);
Registry registry = Registry.get(tld); Registry registry = Registry.get(tld);
DateTime now = clock.nowUtc(); DateTime now = clock.nowUtc();
verifyNotInPredelegation(registry, now); verifyNotInPredelegation(registry, now);

View file

@ -16,7 +16,7 @@ package google.registry.flows.domain;
import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static google.registry.flows.FlowUtils.persistEntityChanges; 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.ResourceFlowUtils.verifyResourceDoesNotExist;
import static google.registry.flows.domain.DomainFlowUtils.COLLISION_MESSAGE; import static google.registry.flows.domain.DomainFlowUtils.COLLISION_MESSAGE;
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld; 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.CommandUseErrorException;
import google.registry.flows.EppException.ParameterValuePolicyErrorException; import google.registry.flows.EppException.ParameterValuePolicyErrorException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -204,7 +204,7 @@ public class DomainCreateFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -226,15 +226,15 @@ public class DomainCreateFlow implements TransactionalFlow {
AllocationTokenExtension.class); AllocationTokenExtension.class);
flowCustomLogic.beforeValidation(); flowCustomLogic.beforeValidation();
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
verifyRegistrarIsActive(clientId); verifyRegistrarIsActive(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
DomainCommand.Create command = cloneAndLinkReferences((Create) resourceCommand, now); DomainCommand.Create command = cloneAndLinkReferences((Create) resourceCommand, now);
Period period = command.getPeriod(); Period period = command.getPeriod();
verifyUnitIsYears(period); verifyUnitIsYears(period);
int years = period.getValue(); int years = period.getValue();
validateRegistrationPeriod(years); 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. // Validate that this is actually a legal domain name on a TLD that the registrar has access to.
InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName()); InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName());
String domainLabel = domainName.parts().get(0); String domainLabel = domainName.parts().get(0);
@ -252,7 +252,7 @@ public class DomainCreateFlow implements TransactionalFlow {
} }
boolean isSunriseCreate = hasSignedMarks && (tldState == START_DATE_SUNRISE); boolean isSunriseCreate = hasSignedMarks && (tldState == START_DATE_SUNRISE);
Optional<AllocationToken> allocationToken = Optional<AllocationToken> allocationToken =
verifyAllocationTokenIfPresent(command, registry, clientId, now); verifyAllocationTokenIfPresent(command, registry, registrarId, now);
boolean isAnchorTenant = boolean isAnchorTenant =
isAnchorTenant( isAnchorTenant(
domainName, allocationToken, eppInput.getSingleExtension(MetadataExtension.class)); 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 // notice without specifying a claims key, ignore the registry phase, and override blocks on
// registering premium domains. // registering premium domains.
if (!isSuperuser) { if (!isSuperuser) {
checkAllowedAccessToTld(clientId, registry.getTldStr()); checkAllowedAccessToTld(registrarId, registry.getTldStr());
boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken); boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken);
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, isValidReservedCreate, hasSignedMarks); verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, isValidReservedCreate, hasSignedMarks);
if (launchCreate.isPresent()) { if (launchCreate.isPresent()) {
@ -276,7 +276,7 @@ public class DomainCreateFlow implements TransactionalFlow {
if (now.isBefore(registry.getClaimsPeriodEnd())) { if (now.isBefore(registry.getClaimsPeriodEnd())) {
verifyClaimsNoticeIfAndOnlyIfNeeded(domainName, hasSignedMarks, hasClaimsNotice); verifyClaimsNoticeIfAndOnlyIfNeeded(domainName, hasSignedMarks, hasClaimsNotice);
} }
verifyPremiumNameIsNotBlocked(targetId, now, clientId); verifyPremiumNameIsNotBlocked(targetId, now, registrarId);
verifySignedMarkOnlyInSunrise(hasSignedMarks, tldState); verifySignedMarkOnlyInSunrise(hasSignedMarks, tldState);
} }
String signedMarkId = null; String signedMarkId = null;
@ -338,8 +338,8 @@ public class DomainCreateFlow implements TransactionalFlow {
: ImmutableSet.of(); : ImmutableSet.of();
DomainBase domain = DomainBase domain =
new DomainBase.Builder() new DomainBase.Builder()
.setCreationClientId(clientId) .setCreationRegistrarId(registrarId)
.setPersistedCurrentSponsorClientId(clientId) .setPersistedCurrentSponsorRegistrarId(registrarId)
.setRepoId(repoId) .setRepoId(repoId)
.setIdnTableName(validateDomainNameWithIdnTables(domainName)) .setIdnTableName(validateDomainNameWithIdnTables(domainName))
.setRegistrationExpirationTime(registrationExpirationTime) .setRegistrationExpirationTime(registrationExpirationTime)
@ -361,7 +361,7 @@ public class DomainCreateFlow implements TransactionalFlow {
buildDomainHistory(domain, registry, now, period, registry.getAddGracePeriodLength()); buildDomainHistory(domain, registry, now, period, registry.getAddGracePeriodLength());
if (reservationTypes.contains(NAME_COLLISION)) { if (reservationTypes.contains(NAME_COLLISION)) {
entitiesToSave.add( entitiesToSave.add(
createNameCollisionOneTimePollMessage(targetId, domainHistory, clientId, now)); createNameCollisionOneTimePollMessage(targetId, domainHistory, registrarId, now));
} }
entitiesToSave.add( entitiesToSave.add(
domain, domain,
@ -472,14 +472,14 @@ public class DomainCreateFlow implements TransactionalFlow {
/** Verifies and returns the allocation token if one is specified, otherwise does nothing. */ /** Verifies and returns the allocation token if one is specified, otherwise does nothing. */
private Optional<AllocationToken> verifyAllocationTokenIfPresent( private Optional<AllocationToken> verifyAllocationTokenIfPresent(
DomainCommand.Create command, Registry registry, String clientId, DateTime now) DomainCommand.Create command, Registry registry, String registrarId, DateTime now)
throws EppException { throws EppException {
Optional<AllocationTokenExtension> extension = Optional<AllocationTokenExtension> extension =
eppInput.getSingleExtension(AllocationTokenExtension.class); eppInput.getSingleExtension(AllocationTokenExtension.class);
return Optional.ofNullable( return Optional.ofNullable(
extension.isPresent() extension.isPresent()
? allocationTokenFlowUtils.loadTokenAndValidateDomainCreate( ? allocationTokenFlowUtils.loadTokenAndValidateDomainCreate(
command, extension.get().getAllocationToken(), registry, clientId, now) command, extension.get().getAllocationToken(), registry, registrarId, now)
: null); : null);
} }
@ -524,7 +524,7 @@ public class DomainCreateFlow implements TransactionalFlow {
return new BillingEvent.OneTime.Builder() return new BillingEvent.OneTime.Builder()
.setReason(Reason.CREATE) .setReason(Reason.CREATE)
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(clientId) .setRegistrarId(registrarId)
.setPeriodYears(years) .setPeriodYears(years)
.setCost(feesAndCredits.getCreateCost()) .setCost(feesAndCredits.getCreateCost())
.setEventTime(now) .setEventTime(now)
@ -545,7 +545,7 @@ public class DomainCreateFlow implements TransactionalFlow {
.setReason(Reason.RENEW) .setReason(Reason.RENEW)
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(clientId) .setRegistrarId(registrarId)
.setEventTime(registrationExpirationTime) .setEventTime(registrationExpirationTime)
.setRecurrenceEndTime(END_OF_TIME) .setRecurrenceEndTime(END_OF_TIME)
.setParent(domainHistoryKey) .setParent(domainHistoryKey)
@ -556,7 +556,7 @@ public class DomainCreateFlow implements TransactionalFlow {
Key<DomainHistory> domainHistoryKey, DateTime registrationExpirationTime) { Key<DomainHistory> domainHistoryKey, DateTime registrationExpirationTime) {
return new PollMessage.Autorenew.Builder() return new PollMessage.Autorenew.Builder()
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(clientId) .setRegistrarId(registrarId)
.setEventTime(registrationExpirationTime) .setEventTime(registrationExpirationTime)
.setMsg("Domain was auto-renewed.") .setMsg("Domain was auto-renewed.")
.setParentKey(domainHistoryKey) .setParentKey(domainHistoryKey)
@ -568,7 +568,7 @@ public class DomainCreateFlow implements TransactionalFlow {
return new BillingEvent.OneTime.Builder() return new BillingEvent.OneTime.Builder()
.setReason(Reason.FEE_EARLY_ACCESS) .setReason(Reason.FEE_EARLY_ACCESS)
.setTargetId(createBillingEvent.getTargetId()) .setTargetId(createBillingEvent.getTargetId())
.setClientId(createBillingEvent.getClientId()) .setRegistrarId(createBillingEvent.getRegistrarId())
.setPeriodYears(1) .setPeriodYears(1)
.setCost(feesAndCredits.getEapCost()) .setCost(feesAndCredits.getEapCost())
.setEventTime(createBillingEvent.getEventTime()) .setEventTime(createBillingEvent.getEventTime())
@ -579,9 +579,12 @@ public class DomainCreateFlow implements TransactionalFlow {
} }
private static PollMessage.OneTime createNameCollisionOneTimePollMessage( 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() return new PollMessage.OneTime.Builder()
.setClientId(clientId) .setRegistrarId(registrarId)
.setEventTime(now) .setEventTime(now)
.setMsg(COLLISION_MESSAGE) // Remind the registrar of the name collision policy. .setMsg(COLLISION_MESSAGE) // Remind the registrar of the name collision policy.
.setResponseData( .setResponseData(

View file

@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.base.Strings.isNullOrEmpty;
import static google.registry.flows.FlowUtils.createHistoryKey; import static google.registry.flows.FlowUtils.createHistoryKey;
import static google.registry.flows.FlowUtils.persistEntityChanges; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; 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;
import google.registry.flows.EppException.AssociationProhibitsOperationException; import google.registry.flows.EppException.AssociationProhibitsOperationException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.SessionMetadata; import google.registry.flows.SessionMetadata;
@ -124,7 +124,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject SessionMetadata sessionMetadata; @Inject SessionMetadata sessionMetadata;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -141,7 +141,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
MetadataExtension.class, SecDnsCreateExtension.class, DomainDeleteSuperuserExtension.class); MetadataExtension.class, SecDnsCreateExtension.class, DomainDeleteSuperuserExtension.class);
flowCustomLogic.beforeValidation(); flowCustomLogic.beforeValidation();
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
// Loads the target resource if it exists // Loads the target resource if it exists
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
@ -153,12 +153,12 @@ public final class DomainDeleteFlow implements TransactionalFlow {
DomainBase.Builder builder; DomainBase.Builder builder;
if (existingDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { if (existingDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
builder = builder =
denyPendingTransfer(existingDomain, TransferStatus.SERVER_CANCELLED, now, clientId) denyPendingTransfer(existingDomain, TransferStatus.SERVER_CANCELLED, now, registrarId)
.asBuilder(); .asBuilder();
} else { } else {
builder = existingDomain.asBuilder(); builder = existingDomain.asBuilder();
} }
builder.setLastEppUpdateTime(now).setLastEppUpdateClientId(clientId); builder.setLastEppUpdateTime(now).setLastEppUpdateRegistrarId(registrarId);
Duration redemptionGracePeriodLength = registry.getRedemptionGracePeriodLength(); Duration redemptionGracePeriodLength = registry.getRedemptionGracePeriodLength();
Duration pendingDeleteLength = registry.getPendingDeleteLength(); Duration pendingDeleteLength = registry.getPendingDeleteLength();
Optional<DomainDeleteSuperuserExtension> domainDeleteSuperuserExtension = Optional<DomainDeleteSuperuserExtension> domainDeleteSuperuserExtension =
@ -199,7 +199,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
GracePeriodStatus.REDEMPTION, GracePeriodStatus.REDEMPTION,
existingDomain.getRepoId(), existingDomain.getRepoId(),
redemptionTime, redemptionTime,
clientId))); registrarId)));
// Note: The expiration time is unchanged, so if it's before the new deletion time, there will // 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 // 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 // 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 // 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). // registrar other than the sponsoring registrar (which will necessarily be a superuser).
if (durationUntilDelete.isLongerThan(Duration.ZERO) if (durationUntilDelete.isLongerThan(Duration.ZERO)
&& !clientId.equals(existingDomain.getPersistedCurrentSponsorClientId())) { && !registrarId.equals(existingDomain.getPersistedCurrentSponsorRegistrarId())) {
entitiesToSave.add( entitiesToSave.add(
createImmediateDeletePollMessage(existingDomain, domainHistoryKey, now, deletionTime)); createImmediateDeletePollMessage(existingDomain, domainHistoryKey, now, deletionTime));
} }
@ -292,9 +292,9 @@ public final class DomainDeleteFlow implements TransactionalFlow {
verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES); verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES);
verifyOptionalAuthInfo(authInfo, existingDomain); verifyOptionalAuthInfo(authInfo, existingDomain);
if (!isSuperuser) { if (!isSuperuser) {
verifyResourceOwnership(clientId, existingDomain); verifyResourceOwnership(registrarId, existingDomain);
verifyNotInPredelegation(registry, now); verifyNotInPredelegation(registry, now);
checkAllowedAccessToTld(clientId, registry.getTld().toString()); checkAllowedAccessToTld(registrarId, registry.getTld().toString());
} }
if (!existingDomain.getSubordinateHosts().isEmpty()) { if (!existingDomain.getSubordinateHosts().isEmpty()) {
throw new DomainToDeleteHasHostsException(); throw new DomainToDeleteHasHostsException();
@ -347,7 +347,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
: "Deleted by registry administrator.") : "Deleted by registry administrator.")
: "Domain deleted."; : "Domain deleted.";
return new PollMessage.OneTime.Builder() return new PollMessage.OneTime.Builder()
.setClientId(existingDomain.getCurrentSponsorClientId()) .setRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
.setEventTime(deletionTime) .setEventTime(deletionTime)
.setMsg(message) .setMsg(message)
.setResponseData( .setResponseData(
@ -364,7 +364,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
DateTime now, DateTime now,
DateTime deletionTime) { DateTime deletionTime) {
return new PollMessage.OneTime.Builder() return new PollMessage.OneTime.Builder()
.setClientId(existingDomain.getPersistedCurrentSponsorClientId()) .setRegistrarId(existingDomain.getPersistedCurrentSponsorRegistrarId())
.setEventTime(now) .setEventTime(now)
.setParentKey(domainHistoryKey) .setParentKey(domainHistoryKey)
.setMsg( .setMsg(

View file

@ -285,8 +285,8 @@ public class DomainFlowUtils {
} }
/** Check if the registrar running the flow has access to the TLD in question. */ /** Check if the registrar running the flow has access to the TLD in question. */
public static void checkAllowedAccessToTld(String clientId, String tld) throws EppException { public static void checkAllowedAccessToTld(String registrarId, String tld) throws EppException {
if (!Registrar.loadByClientIdCached(clientId).get().getAllowedTlds().contains(tld)) { if (!Registrar.loadByRegistrarIdCached(registrarId).get().getAllowedTlds().contains(tld)) {
throw new DomainFlowUtils.NotAuthorizedForTldException(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 * where it would not be allowed is if domain name is premium, and premium names are blocked by
* this registrar. * this registrar.
*/ */
static void verifyPremiumNameIsNotBlocked(String domainName, DateTime priceTime, String clientId) static void verifyPremiumNameIsNotBlocked(
throws EppException { String domainName, DateTime priceTime, String registrarId) throws EppException {
if (isDomainPremium(domainName, priceTime)) { if (isDomainPremium(domainName, priceTime)) {
if (Registrar.loadByClientIdCached(clientId).get().getBlockPremiumNames()) { if (Registrar.loadByRegistrarIdCached(registrarId).get().getBlockPremiumNames()) {
throw new PremiumNameBlockedException(); throw new PremiumNameBlockedException();
} }
} }
@ -495,7 +495,7 @@ public class DomainFlowUtils {
.setReason(Reason.RENEW) .setReason(Reason.RENEW)
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
.setTargetId(domain.getDomainName()) .setTargetId(domain.getDomainName())
.setClientId(domain.getCurrentSponsorClientId()) .setRegistrarId(domain.getCurrentSponsorRegistrarId())
.setEventTime(domain.getRegistrationExpirationTime()); .setEventTime(domain.getRegistrationExpirationTime());
} }
@ -506,7 +506,7 @@ public class DomainFlowUtils {
public static PollMessage.Autorenew.Builder newAutorenewPollMessage(DomainBase domain) { public static PollMessage.Autorenew.Builder newAutorenewPollMessage(DomainBase domain) {
return new PollMessage.Autorenew.Builder() return new PollMessage.Autorenew.Builder()
.setTargetId(domain.getDomainName()) .setTargetId(domain.getDomainName())
.setClientId(domain.getCurrentSponsorClientId()) .setRegistrarId(domain.getCurrentSponsorRegistrarId())
.setEventTime(domain.getRegistrationExpirationTime()) .setEventTime(domain.getRegistrationExpirationTime())
.setMsg("Domain was auto-renewed."); .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 * <p>Non-active registrars are not allowed to run operations that cost money, like domain creates
* or renews. * or renews.
*/ */
static void verifyRegistrarIsActive(String clientId) static void verifyRegistrarIsActive(String registrarId)
throws RegistrarMustBeActiveForThisOperationException { throws RegistrarMustBeActiveForThisOperationException {
Registrar registrar = Registrar.loadByClientIdCached(clientId).get(); Registrar registrar = Registrar.loadByRegistrarIdCached(registrarId).get();
if (registrar.getState() != State.ACTIVE) { if (registrar.getState() != State.ACTIVE) {
throw new RegistrarMustBeActiveForThisOperationException(); throw new RegistrarMustBeActiveForThisOperationException();
} }

View file

@ -14,7 +14,7 @@
package google.registry.flows.domain; 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.verifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
import static google.registry.flows.domain.DomainFlowUtils.addSecDnsExtensionIfPresent; 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.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.FlowModule.TargetId;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
import google.registry.flows.custom.DomainInfoFlowCustomLogic; import google.registry.flows.custom.DomainInfoFlowCustomLogic;
@ -79,7 +79,7 @@ public final class DomainInfoFlow implements Flow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Clock clock; @Inject Clock clock;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -94,7 +94,7 @@ public final class DomainInfoFlow implements Flow {
extensionManager.register(FeeInfoCommandExtensionV06.class); extensionManager.register(FeeInfoCommandExtensionV06.class);
flowCustomLogic.beforeValidation(); flowCustomLogic.beforeValidation();
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = clock.nowUtc(); DateTime now = clock.nowUtc();
DomainBase domain = verifyExistence( DomainBase domain = verifyExistence(
DomainBase.class, targetId, loadByForeignKey(DomainBase.class, targetId, now)); DomainBase.class, targetId, loadByForeignKey(DomainBase.class, targetId, now));
@ -112,12 +112,12 @@ public final class DomainInfoFlow implements Flow {
DomainInfoData.newBuilder() DomainInfoData.newBuilder()
.setFullyQualifiedDomainName(domain.getDomainName()) .setFullyQualifiedDomainName(domain.getDomainName())
.setRepoId(domain.getRepoId()) .setRepoId(domain.getRepoId())
.setCurrentSponsorClientId(domain.getCurrentSponsorClientId()) .setCurrentSponsorClientId(domain.getCurrentSponsorRegistrarId())
.setRegistrant( .setRegistrant(
transactIfJpaTm(() -> tm().loadByKey(domain.getRegistrant())).getContactId()); transactIfJpaTm(() -> tm().loadByKey(domain.getRegistrant())).getContactId());
// If authInfo is non-null, then the caller is authorized to see the full information since we // 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. // 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(); HostsRequest hostsRequest = ((Info) resourceCommand).getHostsRequest();
infoBuilder infoBuilder
.setStatusValues(domain.getStatusValues()) .setStatusValues(domain.getStatusValues())
@ -126,9 +126,9 @@ public final class DomainInfoFlow implements Flow {
.setNameservers(hostsRequest.requestDelegated() ? domain.loadNameserverHostNames() : null) .setNameservers(hostsRequest.requestDelegated() ? domain.loadNameserverHostNames() : null)
.setSubordinateHosts( .setSubordinateHosts(
hostsRequest.requestSubordinate() ? domain.getSubordinateHosts() : null) hostsRequest.requestSubordinate() ? domain.getSubordinateHosts() : null)
.setCreationClientId(domain.getCreationClientId()) .setCreationClientId(domain.getCreationRegistrarId())
.setCreationTime(domain.getCreationTime()) .setCreationTime(domain.getCreationTime())
.setLastEppUpdateClientId(domain.getLastEppUpdateClientId()) .setLastEppUpdateClientId(domain.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(domain.getLastEppUpdateTime()) .setLastEppUpdateTime(domain.getLastEppUpdateTime())
.setRegistrationExpirationTime(domain.getRegistrationExpirationTime()) .setRegistrationExpirationTime(domain.getRegistrationExpirationTime())
.setLastTransferTime(domain.getLastTransferTime()) .setLastTransferTime(domain.getLastTransferTime())

View file

@ -16,7 +16,7 @@ package google.registry.flows.domain;
import static google.registry.flows.FlowUtils.createHistoryKey; import static google.registry.flows.FlowUtils.createHistoryKey;
import static google.registry.flows.FlowUtils.persistEntityChanges; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; 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;
import google.registry.flows.EppException.ParameterValueRangeErrorException; import google.registry.flows.EppException.ParameterValueRangeErrorException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -123,7 +123,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -137,8 +137,8 @@ public final class DomainRenewFlow implements TransactionalFlow {
extensionManager.register(FeeRenewCommandExtension.class, MetadataExtension.class); extensionManager.register(FeeRenewCommandExtension.class, MetadataExtension.class);
flowCustomLogic.beforeValidation(); flowCustomLogic.beforeValidation();
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
verifyRegistrarIsActive(clientId); verifyRegistrarIsActive(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
Renew command = (Renew) resourceCommand; Renew command = (Renew) resourceCommand;
// Loads the target resource if it exists // Loads the target resource if it exists
@ -182,7 +182,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
existingDomain existingDomain
.asBuilder() .asBuilder()
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(clientId) .setLastEppUpdateRegistrarId(registrarId)
.setRegistrationExpirationTime(newExpirationTime) .setRegistrationExpirationTime(newExpirationTime)
.setAutorenewBillingEvent(newAutorenewEvent.createVKey()) .setAutorenewBillingEvent(newAutorenewEvent.createVKey())
.setAutorenewPollMessage(newAutorenewPollMessage.createVKey()) .setAutorenewPollMessage(newAutorenewPollMessage.createVKey())
@ -250,8 +250,8 @@ public final class DomainRenewFlow implements TransactionalFlow {
verifyOptionalAuthInfo(authInfo, existingDomain); verifyOptionalAuthInfo(authInfo, existingDomain);
verifyNoDisallowedStatuses(existingDomain, RENEW_DISALLOWED_STATUSES); verifyNoDisallowedStatuses(existingDomain, RENEW_DISALLOWED_STATUSES);
if (!isSuperuser) { if (!isSuperuser) {
verifyResourceOwnership(clientId, existingDomain); verifyResourceOwnership(registrarId, existingDomain);
checkAllowedAccessToTld(clientId, existingDomain.getTld()); checkAllowedAccessToTld(registrarId, existingDomain.getTld());
} }
verifyUnitIsYears(command.getPeriod()); verifyUnitIsYears(command.getPeriod());
// If the date they specify doesn't match the expiration, fail. (This is an idempotence check). // 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() return new BillingEvent.OneTime.Builder()
.setReason(Reason.RENEW) .setReason(Reason.RENEW)
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(clientId) .setRegistrarId(registrarId)
.setPeriodYears(years) .setPeriodYears(years)
.setCost(renewCost) .setCost(renewCost)
.setEventTime(now) .setEventTime(now)

View file

@ -15,7 +15,7 @@
package google.registry.flows.domain; package google.registry.flows.domain;
import static google.registry.flows.FlowUtils.createHistoryKey; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership; 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.CommandUseErrorException;
import google.registry.flows.EppException.StatusProhibitsOperationException; import google.registry.flows.EppException.StatusProhibitsOperationException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -116,7 +116,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -132,8 +132,8 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
MetadataExtension.class, MetadataExtension.class,
RgpUpdateExtension.class); RgpUpdateExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
verifyRegistrarIsActive(clientId); verifyRegistrarIsActive(registrarId);
Update command = (Update) resourceCommand; Update command = (Update) resourceCommand;
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
@ -174,7 +174,12 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
.build(); .build();
DomainBase newDomain = DomainBase newDomain =
performRestore( performRestore(
existingDomain, newExpirationTime, autorenewEvent, autorenewPollMessage, now, clientId); existingDomain,
newExpirationTime,
autorenewEvent,
autorenewPollMessage,
now,
registrarId);
updateForeignKeyIndexDeletionTime(newDomain); updateForeignKeyIndexDeletionTime(newDomain);
DomainHistory domainHistory = buildDomainHistory(newDomain, now); DomainHistory domainHistory = buildDomainHistory(newDomain, now);
entitiesToSave.add(newDomain, domainHistory, autorenewEvent, autorenewPollMessage); entitiesToSave.add(newDomain, domainHistory, autorenewEvent, autorenewPollMessage);
@ -205,10 +210,10 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
DateTime now) throws EppException { DateTime now) throws EppException {
verifyOptionalAuthInfo(authInfo, existingDomain); verifyOptionalAuthInfo(authInfo, existingDomain);
if (!isSuperuser) { if (!isSuperuser) {
verifyResourceOwnership(clientId, existingDomain); verifyResourceOwnership(registrarId, existingDomain);
verifyNotReserved(InternetDomainName.from(targetId), false); verifyNotReserved(InternetDomainName.from(targetId), false);
verifyPremiumNameIsNotBlocked(targetId, now, clientId); verifyPremiumNameIsNotBlocked(targetId, now, registrarId);
checkAllowedAccessToTld(clientId, existingDomain.getTld()); checkAllowedAccessToTld(registrarId, existingDomain.getTld());
} }
// No other changes can be specified on a restore request. // No other changes can be specified on a restore request.
if (!command.noChangesPresent()) { if (!command.noChangesPresent()) {
@ -227,7 +232,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
BillingEvent.Recurring autorenewEvent, BillingEvent.Recurring autorenewEvent,
PollMessage.Autorenew autorenewPollMessage, PollMessage.Autorenew autorenewPollMessage,
DateTime now, DateTime now,
String clientId) { String registrarId) {
return existingDomain return existingDomain
.asBuilder() .asBuilder()
.setRegistrationExpirationTime(newExpirationTime) .setRegistrationExpirationTime(newExpirationTime)
@ -241,7 +246,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
// it won't immediately be deleted again. // it won't immediately be deleted again.
.setAutorenewEndTime(Optional.empty()) .setAutorenewEndTime(Optional.empty())
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(clientId) .setLastEppUpdateRegistrarId(registrarId)
.build(); .build();
} }
@ -261,7 +266,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
Key<DomainHistory> domainHistoryKey, Money cost, DateTime now) { Key<DomainHistory> domainHistoryKey, Money cost, DateTime now) {
return new BillingEvent.OneTime.Builder() return new BillingEvent.OneTime.Builder()
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(clientId) .setRegistrarId(registrarId)
.setEventTime(now) .setEventTime(now)
.setBillingTime(now) .setBillingTime(now)
.setPeriodYears(1) .setPeriodYears(1)

View file

@ -16,7 +16,7 @@ package google.registry.flows.domain;
import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.getOnlyElement;
import static google.registry.flows.FlowUtils.createHistoryKey; 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.computeExDateForApprovalTime;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
@ -40,7 +40,7 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -89,7 +89,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -104,18 +104,18 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyOptionalAuthInfo(authInfo, existingDomain); verifyOptionalAuthInfo(authInfo, existingDomain);
verifyHasPendingTransfer(existingDomain); verifyHasPendingTransfer(existingDomain);
verifyResourceOwnership(clientId, existingDomain); verifyResourceOwnership(registrarId, existingDomain);
String tld = existingDomain.getTld(); String tld = existingDomain.getTld();
if (!isSuperuser) { if (!isSuperuser) {
checkAllowedAccessToTld(clientId, tld); checkAllowedAccessToTld(registrarId, tld);
} }
DomainTransferData transferData = existingDomain.getTransferData(); 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 // 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. // the transfer period to zero. There is not a transfer cost if the transfer period is zero.
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
@ -127,7 +127,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
new BillingEvent.OneTime.Builder() new BillingEvent.OneTime.Builder()
.setReason(Reason.TRANSFER) .setReason(Reason.TRANSFER)
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(gainingClientId) .setRegistrarId(gainingRegistrarId)
.setPeriodYears(1) .setPeriodYears(1)
.setCost(getDomainRenewCost(targetId, transferData.getTransferRequestTime(), 1)) .setCost(getDomainRenewCost(targetId, transferData.getTransferRequestTime(), 1))
.setEventTime(now) .setEventTime(now)
@ -162,7 +162,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
.setReason(Reason.RENEW) .setReason(Reason.RENEW)
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(gainingClientId) .setRegistrarId(gainingRegistrarId)
.setEventTime(newExpirationTime) .setEventTime(newExpirationTime)
.setRecurrenceEndTime(END_OF_TIME) .setRecurrenceEndTime(END_OF_TIME)
.setParent(domainHistoryKey) .setParent(domainHistoryKey)
@ -171,7 +171,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
PollMessage.Autorenew gainingClientAutorenewPollMessage = PollMessage.Autorenew gainingClientAutorenewPollMessage =
new PollMessage.Autorenew.Builder() new PollMessage.Autorenew.Builder()
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(gainingClientId) .setRegistrarId(gainingRegistrarId)
.setEventTime(newExpirationTime) .setEventTime(newExpirationTime)
.setAutorenewEndTime(END_OF_TIME) .setAutorenewEndTime(END_OF_TIME)
.setMsg("Domain was auto-renewed.") .setMsg("Domain was auto-renewed.")
@ -206,10 +206,10 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
oneTime))) oneTime)))
.orElseGet(ImmutableSet::of)) .orElseGet(ImmutableSet::of))
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(clientId) .setLastEppUpdateRegistrarId(registrarId)
.build(); .build();
Registry registry = Registry.get(existingDomain.getTld()); 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. // Create a poll message for the gaining client.
PollMessage gainingClientPollMessage = PollMessage gainingClientPollMessage =
createGainingTransferPollMessage( createGainingTransferPollMessage(
@ -232,7 +232,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
} }
private DomainHistory buildDomainHistory( private DomainHistory buildDomainHistory(
DomainBase newDomain, Registry registry, DateTime now, String gainingClientId) { DomainBase newDomain, Registry registry, DateTime now, String gainingRegistrarId) {
ImmutableSet<DomainTransactionRecord> cancelingRecords = ImmutableSet<DomainTransactionRecord> cancelingRecords =
createCancelingRecords( createCancelingRecords(
newDomain, newDomain,
@ -241,7 +241,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
ImmutableSet.of(TRANSFER_SUCCESSFUL)); ImmutableSet.of(TRANSFER_SUCCESSFUL));
return historyBuilder return historyBuilder
.setType(DOMAIN_TRANSFER_APPROVE) .setType(DOMAIN_TRANSFER_APPROVE)
.setOtherClientId(gainingClientId) .setOtherRegistrarId(gainingRegistrarId)
.setDomain(newDomain) .setDomain(newDomain)
.setDomainTransactionRecords( .setDomainTransactionRecords(
union( union(

View file

@ -15,7 +15,7 @@
package google.registry.flows.domain; package google.registry.flows.domain;
import static google.registry.flows.FlowUtils.createHistoryKey; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -76,7 +76,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -87,24 +87,24 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyOptionalAuthInfo(authInfo, existingDomain); verifyOptionalAuthInfo(authInfo, existingDomain);
verifyHasPendingTransfer(existingDomain); verifyHasPendingTransfer(existingDomain);
verifyTransferInitiator(clientId, existingDomain); verifyTransferInitiator(registrarId, existingDomain);
if (!isSuperuser) { if (!isSuperuser) {
checkAllowedAccessToTld(clientId, existingDomain.getTld()); checkAllowedAccessToTld(registrarId, existingDomain.getTld());
} }
Registry registry = Registry.get(existingDomain.getTld()); Registry registry = Registry.get(existingDomain.getTld());
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
historyBuilder historyBuilder
.setId(domainHistoryKey.getId()) .setId(domainHistoryKey.getId())
.setOtherClientId(existingDomain.getTransferData().getLosingClientId()); .setOtherRegistrarId(existingDomain.getTransferData().getLosingRegistrarId());
DomainBase newDomain = DomainBase newDomain =
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, clientId); denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, registrarId);
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now);
tm().putAll( tm().putAll(
newDomain, newDomain,

View file

@ -14,7 +14,7 @@
package google.registry.flows.domain; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse; 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.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.FlowModule.TargetId;
import google.registry.flows.ResourceFlowUtils; import google.registry.flows.ResourceFlowUtils;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -59,7 +59,7 @@ public final class DomainTransferQueryFlow implements Flow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Clock clock; @Inject Clock clock;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -68,7 +68,7 @@ public final class DomainTransferQueryFlow implements Flow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = clock.nowUtc(); DateTime now = clock.nowUtc();
DomainBase domain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase domain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyOptionalAuthInfo(authInfo, domain); 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 // Note that the authorization info on the command (if present) has already been verified. If
// it's present, then the other checks are unnecessary. // it's present, then the other checks are unnecessary.
if (!authInfo.isPresent() if (!authInfo.isPresent()
&& !clientId.equals(transferData.getGainingClientId()) && !registrarId.equals(transferData.getGainingRegistrarId())
&& !clientId.equals(transferData.getLosingClientId())) { && !registrarId.equals(transferData.getLosingRegistrarId())) {
throw new NotAuthorizedToViewTransferException(); throw new NotAuthorizedToViewTransferException();
} }
DateTime newExpirationTime = null; DateTime newExpirationTime = null;

View file

@ -15,7 +15,7 @@
package google.registry.flows.domain; package google.registry.flows.domain;
import static google.registry.flows.FlowUtils.createHistoryKey; 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.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer; import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -78,7 +78,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -89,23 +89,23 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
Registry registry = Registry.get(existingDomain.getTld()); Registry registry = Registry.get(existingDomain.getTld());
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
historyBuilder historyBuilder
.setId(domainHistoryKey.getId()) .setId(domainHistoryKey.getId())
.setOtherClientId(existingDomain.getTransferData().getGainingClientId()); .setOtherRegistrarId(existingDomain.getTransferData().getGainingRegistrarId());
verifyOptionalAuthInfo(authInfo, existingDomain); verifyOptionalAuthInfo(authInfo, existingDomain);
verifyHasPendingTransfer(existingDomain); verifyHasPendingTransfer(existingDomain);
verifyResourceOwnership(clientId, existingDomain); verifyResourceOwnership(registrarId, existingDomain);
if (!isSuperuser) { if (!isSuperuser) {
checkAllowedAccessToTld(clientId, existingDomain.getTld()); checkAllowedAccessToTld(registrarId, existingDomain.getTld());
} }
DomainBase newDomain = DomainBase newDomain =
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, clientId); denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, registrarId);
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now);
tm().putAll( tm().putAll(
newDomain, newDomain,

View file

@ -15,7 +15,7 @@
package google.registry.flows.domain; package google.registry.flows.domain;
import static google.registry.flows.FlowUtils.createHistoryKey; 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.computeExDateForApprovalTime;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo; import static google.registry.flows.ResourceFlowUtils.verifyAuthInfo;
@ -41,7 +41,7 @@ import com.googlecode.objectify.Key;
import google.registry.batch.AsyncTaskEnqueuer; import google.registry.batch.AsyncTaskEnqueuer;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -125,7 +125,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String gainingClientId; @Inject @RegistrarId String gainingClientId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -142,7 +142,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
FeeTransferCommandExtension.class, FeeTransferCommandExtension.class,
MetadataExtension.class); MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(gainingClientId); validateRegistrarIsLoggedIn(gainingClientId);
verifyRegistrarIsActive(gainingClientId); verifyRegistrarIsActive(gainingClientId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
@ -174,7 +174,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class); Key<DomainHistory> domainHistoryKey = createHistoryKey(existingDomain, DomainHistory.class);
historyBuilder historyBuilder
.setId(domainHistoryKey.getId()) .setId(domainHistoryKey.getId())
.setOtherClientId(existingDomain.getCurrentSponsorClientId()); .setOtherRegistrarId(existingDomain.getCurrentSponsorRegistrarId());
DateTime automaticTransferTime = DateTime automaticTransferTime =
superuserExtension.isPresent() superuserExtension.isPresent()
? now.plusDays(superuserExtension.get().getAutomaticTransferLength()) ? now.plusDays(superuserExtension.get().getAutomaticTransferLength())
@ -207,8 +207,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
new DomainTransferData.Builder() new DomainTransferData.Builder()
.setTransferRequestTrid(trid) .setTransferRequestTrid(trid)
.setTransferRequestTime(now) .setTransferRequestTime(now)
.setGainingClientId(gainingClientId) .setGainingRegistrarId(gainingClientId)
.setLosingClientId(existingDomain.getCurrentSponsorClientId()) .setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
.setPendingTransferExpirationTime(automaticTransferTime) .setPendingTransferExpirationTime(automaticTransferTime)
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime), .setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime),
serverApproveEntities, serverApproveEntities,
@ -231,7 +231,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
.setTransferData(pendingTransferData) .setTransferData(pendingTransferData)
.addStatusValue(StatusValue.PENDING_TRANSFER) .addStatusValue(StatusValue.PENDING_TRANSFER)
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(gainingClientId) .setLastEppUpdateRegistrarId(gainingClientId)
.build(); .build();
DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, period); DomainHistory domainHistory = buildDomainHistory(newDomain, registry, now, period);
@ -264,7 +264,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
throw new AlreadyPendingTransferException(targetId); throw new AlreadyPendingTransferException(targetId);
} }
// Verify that this client doesn't already sponsor this resource. // Verify that this client doesn't already sponsor this resource.
if (gainingClientId.equals(existingDomain.getCurrentSponsorClientId())) { if (gainingClientId.equals(existingDomain.getCurrentSponsorRegistrarId())) {
throw new ObjectAlreadySponsoredException(); throw new ObjectAlreadySponsoredException();
} }
verifyTransferPeriod(period, superuserExtension); verifyTransferPeriod(period, superuserExtension);

View file

@ -108,7 +108,7 @@ public final class DomainTransferUtils {
Key<DomainHistory> domainHistoryKey, Key<DomainHistory> domainHistoryKey,
DomainBase existingDomain, DomainBase existingDomain,
Trid trid, Trid trid,
String gainingClientId, String gainingRegistrarId,
Optional<Money> transferCost, Optional<Money> transferCost,
DateTime now) { DateTime now) {
String targetId = existingDomain.getDomainName(); String targetId = existingDomain.getDomainName();
@ -117,8 +117,8 @@ public final class DomainTransferUtils {
new DomainTransferData.Builder() new DomainTransferData.Builder()
.setTransferRequestTrid(trid) .setTransferRequestTrid(trid)
.setTransferRequestTime(now) .setTransferRequestTime(now)
.setGainingClientId(gainingClientId) .setGainingRegistrarId(gainingRegistrarId)
.setLosingClientId(existingDomain.getCurrentSponsorClientId()) .setLosingRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
.setPendingTransferExpirationTime(automaticTransferTime) .setPendingTransferExpirationTime(automaticTransferTime)
.setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime) .setTransferredRegistrationExpirationTime(serverApproveNewExpirationTime)
.setTransferStatus(TransferStatus.SERVER_APPROVED) .setTransferStatus(TransferStatus.SERVER_APPROVED)
@ -132,7 +132,7 @@ public final class DomainTransferUtils {
automaticTransferTime, automaticTransferTime,
domainHistoryKey, domainHistoryKey,
targetId, targetId,
gainingClientId, gainingRegistrarId,
registry, registry,
cost))); cost)));
createOptionalAutorenewCancellation( createOptionalAutorenewCancellation(
@ -141,10 +141,10 @@ public final class DomainTransferUtils {
return builder return builder
.add( .add(
createGainingClientAutorenewEvent( createGainingClientAutorenewEvent(
serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingClientId)) serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingRegistrarId))
.add( .add(
createGainingClientAutorenewPollMessage( createGainingClientAutorenewPollMessage(
serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingClientId)) serverApproveNewExpirationTime, domainHistoryKey, targetId, gainingRegistrarId))
.add( .add(
createGainingTransferPollMessage( createGainingTransferPollMessage(
targetId, targetId,
@ -169,7 +169,7 @@ public final class DomainTransferUtils {
DateTime now, DateTime now,
Key<DomainHistory> domainHistoryKey) { Key<DomainHistory> domainHistoryKey) {
return new PollMessage.OneTime.Builder() return new PollMessage.OneTime.Builder()
.setClientId(transferData.getGainingClientId()) .setRegistrarId(transferData.getGainingRegistrarId())
.setEventTime(transferData.getPendingTransferExpirationTime()) .setEventTime(transferData.getPendingTransferExpirationTime())
.setMsg(transferData.getTransferStatus().getMessage()) .setMsg(transferData.getTransferStatus().getMessage())
.setResponseData( .setResponseData(
@ -191,7 +191,7 @@ public final class DomainTransferUtils {
@Nullable DateTime extendedRegistrationExpirationTime, @Nullable DateTime extendedRegistrationExpirationTime,
Key<DomainHistory> domainHistoryKey) { Key<DomainHistory> domainHistoryKey) {
return new PollMessage.OneTime.Builder() return new PollMessage.OneTime.Builder()
.setClientId(transferData.getLosingClientId()) .setRegistrarId(transferData.getLosingRegistrarId())
.setEventTime(transferData.getPendingTransferExpirationTime()) .setEventTime(transferData.getPendingTransferExpirationTime())
.setMsg(transferData.getTransferStatus().getMessage()) .setMsg(transferData.getTransferStatus().getMessage())
.setResponseData( .setResponseData(
@ -208,8 +208,8 @@ public final class DomainTransferUtils {
@Nullable DateTime extendedRegistrationExpirationTime) { @Nullable DateTime extendedRegistrationExpirationTime) {
return new DomainTransferResponse.Builder() return new DomainTransferResponse.Builder()
.setFullyQualifiedDomainName(targetId) .setFullyQualifiedDomainName(targetId)
.setGainingClientId(transferData.getGainingClientId()) .setGainingRegistrarId(transferData.getGainingRegistrarId())
.setLosingClientId(transferData.getLosingClientId()) .setLosingRegistrarId(transferData.getLosingRegistrarId())
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime()) .setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
.setTransferRequestTime(transferData.getTransferRequestTime()) .setTransferRequestTime(transferData.getTransferRequestTime())
.setTransferStatus(transferData.getTransferStatus()) .setTransferStatus(transferData.getTransferStatus())
@ -221,10 +221,10 @@ public final class DomainTransferUtils {
DateTime serverApproveNewExpirationTime, DateTime serverApproveNewExpirationTime,
Key<DomainHistory> domainHistoryKey, Key<DomainHistory> domainHistoryKey,
String targetId, String targetId,
String gainingClientId) { String gainingRegistrarId) {
return new PollMessage.Autorenew.Builder() return new PollMessage.Autorenew.Builder()
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(gainingClientId) .setRegistrarId(gainingRegistrarId)
.setEventTime(serverApproveNewExpirationTime) .setEventTime(serverApproveNewExpirationTime)
.setAutorenewEndTime(END_OF_TIME) .setAutorenewEndTime(END_OF_TIME)
.setMsg("Domain was auto-renewed.") .setMsg("Domain was auto-renewed.")
@ -236,12 +236,12 @@ public final class DomainTransferUtils {
DateTime serverApproveNewExpirationTime, DateTime serverApproveNewExpirationTime,
Key<DomainHistory> domainHistoryKey, Key<DomainHistory> domainHistoryKey,
String targetId, String targetId,
String gainingClientId) { String gainingRegistrarId) {
return new BillingEvent.Recurring.Builder() return new BillingEvent.Recurring.Builder()
.setReason(Reason.RENEW) .setReason(Reason.RENEW)
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(gainingClientId) .setRegistrarId(gainingRegistrarId)
.setEventTime(serverApproveNewExpirationTime) .setEventTime(serverApproveNewExpirationTime)
.setRecurrenceEndTime(END_OF_TIME) .setRecurrenceEndTime(END_OF_TIME)
.setParent(domainHistoryKey) .setParent(domainHistoryKey)
@ -291,13 +291,13 @@ public final class DomainTransferUtils {
DateTime automaticTransferTime, DateTime automaticTransferTime,
Key<DomainHistory> domainHistoryKey, Key<DomainHistory> domainHistoryKey,
String targetId, String targetId,
String gainingClientId, String gainingRegistrarId,
Registry registry, Registry registry,
Money transferCost) { Money transferCost) {
return new BillingEvent.OneTime.Builder() return new BillingEvent.OneTime.Builder()
.setReason(Reason.TRANSFER) .setReason(Reason.TRANSFER)
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(gainingClientId) .setRegistrarId(gainingRegistrarId)
.setCost(transferCost) .setCost(transferCost)
.setPeriodYears(1) .setPeriodYears(1)
.setEventTime(automaticTransferTime) .setEventTime(automaticTransferTime)

View file

@ -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.symmetricDifference;
import static com.google.common.collect.Sets.union; import static com.google.common.collect.Sets.union;
import static google.registry.flows.FlowUtils.persistEntityChanges; 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.checkSameValuesNotAddedAndRemoved;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable; 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.dns.DnsQueue;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -139,7 +139,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject Optional<AuthInfo> authInfo; @Inject Optional<AuthInfo> authInfo;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject DomainHistory.Builder historyBuilder; @Inject DomainHistory.Builder historyBuilder;
@ -158,7 +158,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
DomainUpdateSuperuserExtension.class); DomainUpdateSuperuserExtension.class);
flowCustomLogic.beforeValidation(); flowCustomLogic.beforeValidation();
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
Update command = cloneAndLinkReferences((Update) resourceCommand, now); Update command = cloneAndLinkReferences((Update) resourceCommand, now);
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now); DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
@ -197,10 +197,10 @@ public final class DomainUpdateFlow implements TransactionalFlow {
String tld = existingDomain.getTld(); String tld = existingDomain.getTld();
if (!isSuperuser) { if (!isSuperuser) {
verifyNoDisallowedStatuses(existingDomain, UPDATE_DISALLOWED_STATUSES); verifyNoDisallowedStatuses(existingDomain, UPDATE_DISALLOWED_STATUSES);
verifyResourceOwnership(clientId, existingDomain); verifyResourceOwnership(registrarId, existingDomain);
verifyClientUpdateNotProhibited(command, existingDomain); verifyClientUpdateNotProhibited(command, existingDomain);
verifyAllStatusesAreClientSettable(union(add.getStatusValues(), remove.getStatusValues())); verifyAllStatusesAreClientSettable(union(add.getStatusValues(), remove.getStatusValues()));
checkAllowedAccessToTld(clientId, tld); checkAllowedAccessToTld(registrarId, tld);
} }
Registry registry = Registry.get(tld); Registry registry = Registry.get(tld);
Optional<FeeUpdateCommandExtension> feeUpdate = Optional<FeeUpdateCommandExtension> feeUpdate =
@ -244,7 +244,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
secDnsUpdate.get()) secDnsUpdate.get())
: domain.getDsData()) : domain.getDsData())
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(clientId) .setLastEppUpdateRegistrarId(registrarId)
.addStatusValues(add.getStatusValues()) .addStatusValues(add.getStatusValues())
.removeStatusValues(remove.getStatusValues()) .removeStatusValues(remove.getStatusValues())
.addNameservers(add.getNameservers().stream().collect(toImmutableSet())) .addNameservers(add.getNameservers().stream().collect(toImmutableSet()))
@ -291,10 +291,11 @@ public final class DomainUpdateFlow implements TransactionalFlow {
: symmetricDifference(existingDomain.getStatusValues(), newDomain.getStatusValues())) { : symmetricDifference(existingDomain.getStatusValues(), newDomain.getStatusValues())) {
if (statusValue.isChargedStatus()) { if (statusValue.isChargedStatus()) {
// Only charge once. // Only charge once.
return Optional.of(new BillingEvent.OneTime.Builder() return Optional.of(
new BillingEvent.OneTime.Builder()
.setReason(Reason.SERVER_STATUS) .setReason(Reason.SERVER_STATUS)
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(clientId) .setRegistrarId(registrarId)
.setCost(Registry.get(existingDomain.getTld()).getServerStatusChangeCost()) .setCost(Registry.get(existingDomain.getTld()).getServerStatusChangeCost())
.setEventTime(now) .setEventTime(now)
.setBillingTime(now) .setBillingTime(now)

View file

@ -36,7 +36,7 @@ public class AllocationTokenCustomLogic {
DomainCommand.Create command, DomainCommand.Create command,
AllocationToken token, AllocationToken token,
Registry registry, Registry registry,
String clientId, String registrarId,
DateTime now) DateTime now)
throws EppException { throws EppException {
// Do nothing. // Do nothing.
@ -47,7 +47,7 @@ public class AllocationTokenCustomLogic {
public ImmutableMap<InternetDomainName, String> checkDomainsWithToken( public ImmutableMap<InternetDomainName, String> checkDomainsWithToken(
ImmutableList<InternetDomainName> domainNames, ImmutableList<InternetDomainName> domainNames,
AllocationToken token, AllocationToken token,
String clientId, String registrarId,
DateTime now) { DateTime now) {
// Do nothing. // Do nothing.
return Maps.toMap(domainNames, k -> ""); return Maps.toMap(domainNames, k -> "");

View file

@ -58,12 +58,19 @@ public class AllocationTokenFlowUtils {
* for this request. * for this request.
*/ */
public AllocationToken loadTokenAndValidateDomainCreate( 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 { throws EppException {
AllocationToken tokenEntity = loadToken(token); AllocationToken tokenEntity = loadToken(token);
validateToken( validateToken(
InternetDomainName.from(command.getFullyQualifiedDomainName()), tokenEntity, clientId, now); InternetDomainName.from(command.getFullyQualifiedDomainName()),
return tokenCustomLogic.validateToken(command, tokenEntity, registry, clientId, now); 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). * validate have blank messages (i.e. no error).
*/ */
public AllocationTokenDomainCheckResults checkDomainsWithToken( 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 // If the token is completely invalid, return the error message for all domain names
AllocationToken tokenEntity; AllocationToken tokenEntity;
try { try {
@ -91,7 +98,7 @@ public class AllocationTokenFlowUtils {
ImmutableMap.Builder<InternetDomainName, String> resultsBuilder = new ImmutableMap.Builder<>(); ImmutableMap.Builder<InternetDomainName, String> resultsBuilder = new ImmutableMap.Builder<>();
for (InternetDomainName domainName : domainNames) { for (InternetDomainName domainName : domainNames) {
try { try {
validateToken(domainName, tokenEntity, clientId, now); validateToken(domainName, tokenEntity, registrarId, now);
validDomainNames.add(domainName); validDomainNames.add(domainName);
} catch (EppException e) { } catch (EppException e) {
resultsBuilder.put(domainName, e.getMessage()); 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 // For all valid domain names, run the custom logic and include the results
resultsBuilder.putAll( resultsBuilder.putAll(
tokenCustomLogic.checkDomainsWithToken( tokenCustomLogic.checkDomainsWithToken(
validDomainNames.build(), tokenEntity, clientId, now)); validDomainNames.build(), tokenEntity, registrarId, now));
return AllocationTokenDomainCheckResults.create( return AllocationTokenDomainCheckResults.create(
Optional.of(tokenEntity), resultsBuilder.build()); Optional.of(tokenEntity), resultsBuilder.build());
} }
@ -123,10 +130,10 @@ public class AllocationTokenFlowUtils {
* @throws EppException if the token is invalid in any way * @throws EppException if the token is invalid in any way
*/ */
private void validateToken( private void validateToken(
InternetDomainName domainName, AllocationToken token, String clientId, DateTime now) InternetDomainName domainName, AllocationToken token, String registrarId, DateTime now)
throws EppException { throws EppException {
if (!token.getAllowedRegistrarIds().isEmpty() if (!token.getAllowedRegistrarIds().isEmpty()
&& !token.getAllowedRegistrarIds().contains(clientId)) { && !token.getAllowedRegistrarIds().contains(registrarId)) {
throw new AllocationTokenNotValidForRegistrarException(); throw new AllocationTokenNotValidForRegistrarException();
} }
if (!token.getAllowedTlds().isEmpty() if (!token.getAllowedTlds().isEmpty()

View file

@ -14,7 +14,7 @@
package google.registry.flows.host; 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.flows.ResourceFlowUtils.verifyTargetIdCount;
import static google.registry.model.EppResourceUtils.checkResourcesExist; 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.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.flows.annotations.ReportingSpec;
import google.registry.model.eppinput.ResourceCommand; import google.registry.model.eppinput.ResourceCommand;
import google.registry.model.eppoutput.CheckData.HostCheck; import google.registry.model.eppoutput.CheckData.HostCheck;
@ -47,7 +47,7 @@ import javax.inject.Inject;
public final class HostCheckFlow implements Flow { public final class HostCheckFlow implements Flow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @Config("maxChecks") int maxChecks; @Inject @Config("maxChecks") int maxChecks;
@Inject Clock clock; @Inject Clock clock;
@ -57,7 +57,7 @@ public final class HostCheckFlow implements Flow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
ImmutableList<String> hostnames = ((Check) resourceCommand).getTargetIds(); ImmutableList<String> hostnames = ((Check) resourceCommand).getTargetIds();
verifyTargetIdCount(hostnames, maxChecks); verifyTargetIdCount(hostnames, maxChecks);
ImmutableSet<String> existingIds = ImmutableSet<String> existingIds =

View file

@ -14,7 +14,7 @@
package google.registry.flows.host; 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.ResourceFlowUtils.verifyResourceDoesNotExist;
import static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain; import static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain;
import static google.registry.flows.host.HostFlowUtils.validateHostName; 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.ParameterValueRangeErrorException;
import google.registry.flows.EppException.RequiredParameterMissingException; import google.registry.flows.EppException.RequiredParameterMissingException;
import google.registry.flows.ExtensionManager; 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.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
@ -84,7 +84,7 @@ public final class HostCreateFlow implements TransactionalFlow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject HostHistory.Builder historyBuilder; @Inject HostHistory.Builder historyBuilder;
@Inject DnsQueue dnsQueue; @Inject DnsQueue dnsQueue;
@ -101,17 +101,17 @@ public final class HostCreateFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
Create command = (Create) resourceCommand; Create command = (Create) resourceCommand;
DateTime now = tm().getTransactionTime(); 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 // 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 // creating an external host. This is looked up before we actually create the Host object so
// we can detect error conditions earlier. // we can detect error conditions earlier.
Optional<DomainBase> superordinateDomain = Optional<DomainBase> superordinateDomain =
lookupSuperordinateDomain(validateHostName(targetId), now); lookupSuperordinateDomain(validateHostName(targetId), now);
verifySuperordinateDomainNotInPendingDelete(superordinateDomain.orElse(null)); verifySuperordinateDomainNotInPendingDelete(superordinateDomain.orElse(null));
verifySuperordinateDomainOwnership(clientId, superordinateDomain.orElse(null)); verifySuperordinateDomainOwnership(registrarId, superordinateDomain.orElse(null));
boolean willBeSubordinate = superordinateDomain.isPresent(); boolean willBeSubordinate = superordinateDomain.isPresent();
boolean hasIpAddresses = !isNullOrEmpty(command.getInetAddresses()); boolean hasIpAddresses = !isNullOrEmpty(command.getInetAddresses());
if (willBeSubordinate != hasIpAddresses) { if (willBeSubordinate != hasIpAddresses) {
@ -122,8 +122,8 @@ public final class HostCreateFlow implements TransactionalFlow {
} }
HostResource newHost = HostResource newHost =
new HostResource.Builder() new HostResource.Builder()
.setCreationClientId(clientId) .setCreationRegistrarId(registrarId)
.setPersistedCurrentSponsorClientId(clientId) .setPersistedCurrentSponsorRegistrarId(registrarId)
.setHostName(targetId) .setHostName(targetId)
.setInetAddresses(command.getInetAddresses()) .setInetAddresses(command.getInetAddresses())
.setRepoId(createRepoId(allocateId(), roidSuffix)) .setRepoId(createRepoId(allocateId(), roidSuffix))

View file

@ -14,7 +14,7 @@
package google.registry.flows.host; 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.checkLinkedDomains;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses; import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
@ -29,7 +29,7 @@ import google.registry.batch.AsyncTaskEnqueuer;
import google.registry.dns.DnsQueue; import google.registry.dns.DnsQueue;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -78,7 +78,7 @@ public final class HostDeleteFlow implements TransactionalFlow {
private static final DnsQueue dnsQueue = DnsQueue.create(); private static final DnsQueue dnsQueue = DnsQueue.create();
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Trid trid; @Inject Trid trid;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@ -93,7 +93,7 @@ public final class HostDeleteFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
DateTime now = tm().getTransactionTime(); DateTime now = tm().getTransactionTime();
validateHostName(targetId); validateHostName(targetId);
checkLinkedDomains(targetId, now, HostResource.class, DomainBase::getNameservers); checkLinkedDomains(targetId, now, HostResource.class, DomainBase::getNameservers);
@ -106,14 +106,14 @@ public final class HostDeleteFlow implements TransactionalFlow {
existingHost.isSubordinate() existingHost.isSubordinate()
? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now) ? tm().loadByKey(existingHost.getSuperordinateDomain()).cloneProjectedAtTime(now)
: existingHost; : existingHost;
verifyResourceOwnership(clientId, owningResource); verifyResourceOwnership(registrarId, owningResource);
} }
HistoryEntry.Type historyEntryType; HistoryEntry.Type historyEntryType;
Result.Code resultCode; Result.Code resultCode;
HostResource newHost; HostResource newHost;
if (tm().isOfy()) { if (tm().isOfy()) {
asyncTaskEnqueuer.enqueueAsyncDelete( asyncTaskEnqueuer.enqueueAsyncDelete(
existingHost, tm().getTransactionTime(), clientId, trid, isSuperuser); existingHost, tm().getTransactionTime(), registrarId, trid, isSuperuser);
newHost = existingHost.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build(); newHost = existingHost.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build();
historyEntryType = Type.HOST_PENDING_DELETE; historyEntryType = Type.HOST_PENDING_DELETE;
resultCode = SUCCESS_WITH_ACTION_PENDING; resultCode = SUCCESS_WITH_ACTION_PENDING;

View file

@ -105,11 +105,11 @@ public class HostFlowUtils {
} }
} }
/** Ensure that the superordinate domain is sponsored by the provided clientId. */ /** Ensure that the superordinate domain is sponsored by the provided registrar ID. */
static void verifySuperordinateDomainOwnership( static void verifySuperordinateDomainOwnership(String registrarId, DomainBase superordinateDomain)
String clientId, DomainBase superordinateDomain) throws EppException { throws EppException {
if (superordinateDomain != null if (superordinateDomain != null
&& !clientId.equals(superordinateDomain.getCurrentSponsorClientId())) { && !registrarId.equals(superordinateDomain.getCurrentSponsorRegistrarId())) {
throw new HostDomainNotOwnedException(); throw new HostDomainNotOwnedException();
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.flows.host; 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.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.host.HostFlowUtils.validateHostName; import static google.registry.flows.host.HostFlowUtils.validateHostName;
import static google.registry.model.EppResourceUtils.isLinked; 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.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.FlowModule.TargetId;
import google.registry.flows.annotations.ReportingSpec; import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainBase;
@ -53,7 +53,7 @@ import org.joda.time.DateTime;
public final class HostInfoFlow implements Flow { public final class HostInfoFlow implements Flow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject Clock clock; @Inject Clock clock;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -62,7 +62,7 @@ public final class HostInfoFlow implements Flow {
@Override @Override
public EppResponse run() throws EppException { public EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
validateHostName(targetId); validateHostName(targetId);
DateTime now = clock.nowUtc(); DateTime now = clock.nowUtc();
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now); HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
@ -80,14 +80,14 @@ public final class HostInfoFlow implements Flow {
transactIfJpaTm( transactIfJpaTm(
() -> tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now)); () -> tm().loadByKey(host.getSuperordinateDomain()).cloneProjectedAtTime(now));
hostInfoDataBuilder hostInfoDataBuilder
.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId()) .setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorRegistrarId())
.setLastTransferTime(host.computeLastTransferTime(superordinateDomain)); .setLastTransferTime(host.computeLastTransferTime(superordinateDomain));
if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
statusValues.add(StatusValue.PENDING_TRANSFER); statusValues.add(StatusValue.PENDING_TRANSFER);
} }
} else { } else {
hostInfoDataBuilder hostInfoDataBuilder
.setCurrentSponsorClientId(host.getPersistedCurrentSponsorClientId()) .setCurrentSponsorClientId(host.getPersistedCurrentSponsorRegistrarId())
.setLastTransferTime(host.getLastTransferTime()); .setLastTransferTime(host.getLastTransferTime());
} }
return responseBuilder return responseBuilder
@ -97,9 +97,9 @@ public final class HostInfoFlow implements Flow {
.setRepoId(host.getRepoId()) .setRepoId(host.getRepoId())
.setStatusValues(statusValues.build()) .setStatusValues(statusValues.build())
.setInetAddresses(host.getInetAddresses()) .setInetAddresses(host.getInetAddresses())
.setCreationClientId(host.getCreationClientId()) .setCreationClientId(host.getCreationRegistrarId())
.setCreationTime(host.getCreationTime()) .setCreationTime(host.getCreationTime())
.setLastEppUpdateClientId(host.getLastEppUpdateClientId()) .setLastEppUpdateClientId(host.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(host.getLastEppUpdateTime()) .setLastEppUpdateTime(host.getLastEppUpdateTime())
.build()) .build())
.build(); .build();

View file

@ -16,7 +16,7 @@ package google.registry.flows.host;
import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.collect.Sets.union; 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.checkSameValuesNotAddedAndRemoved;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence; import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyAllStatusesAreClientSettable; 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.ParameterValueRangeErrorException;
import google.registry.flows.EppException.StatusProhibitsOperationException; import google.registry.flows.EppException.StatusProhibitsOperationException;
import google.registry.flows.ExtensionManager; 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.Superuser;
import google.registry.flows.FlowModule.TargetId; import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
@ -113,7 +113,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @TargetId String targetId; @Inject @TargetId String targetId;
@Inject @Superuser boolean isSuperuser; @Inject @Superuser boolean isSuperuser;
@Inject HostHistory.Builder historyBuilder; @Inject HostHistory.Builder historyBuilder;
@ -126,7 +126,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
Update command = (Update) resourceCommand; Update command = (Update) resourceCommand;
Change change = command.getInnerChange(); Change change = command.getInnerChange();
String suppliedNewHostName = change.getFullyQualifiedHostName(); 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 // 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 // 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. // non-superusers this is the flow clientId, but for superusers it might not be, so compute it.
String newPersistedClientId = String newPersistedRegistrarId =
newSuperordinateDomain.isPresent() newSuperordinateDomain.isPresent()
? newSuperordinateDomain.get().getCurrentSponsorClientId() ? newSuperordinateDomain.get().getCurrentSponsorRegistrarId()
: owningResource.getPersistedCurrentSponsorClientId(); : owningResource.getPersistedCurrentSponsorRegistrarId();
HostResource newHost = HostResource newHost =
existingHost existingHost
.asBuilder() .asBuilder()
@ -183,11 +183,11 @@ public final class HostUpdateFlow implements TransactionalFlow {
.addInetAddresses(add.getInetAddresses()) .addInetAddresses(add.getInetAddresses())
.removeInetAddresses(remove.getInetAddresses()) .removeInetAddresses(remove.getInetAddresses())
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(clientId) .setLastEppUpdateRegistrarId(registrarId)
.setSuperordinateDomain(newSuperordinateDomainKey) .setSuperordinateDomain(newSuperordinateDomainKey)
.setLastSuperordinateChange(lastSuperordinateChange) .setLastSuperordinateChange(lastSuperordinateChange)
.setLastTransferTime(lastTransferTime) .setLastTransferTime(lastTransferTime)
.setPersistedCurrentSponsorClientId(newPersistedClientId) .setPersistedCurrentSponsorRegistrarId(newPersistedRegistrarId)
.build(); .build();
verifyHasIpsIffIsExternal(command, existingHost, newHost); verifyHasIpsIffIsExternal(command, existingHost, newHost);
ImmutableSet.Builder<ImmutableObject> entitiesToInsert = new ImmutableSet.Builder<>(); ImmutableSet.Builder<ImmutableObject> entitiesToInsert = new ImmutableSet.Builder<>();
@ -217,12 +217,12 @@ public final class HostUpdateFlow implements TransactionalFlow {
if (!isSuperuser) { if (!isSuperuser) {
// Verify that the host belongs to this registrar, either directly or because it is currently // Verify that the host belongs to this registrar, either directly or because it is currently
// subordinate to a domain owned by this registrar. // subordinate to a domain owned by this registrar.
verifyResourceOwnership(clientId, owningResource); verifyResourceOwnership(registrarId, owningResource);
if (isHostRename && !existingHost.isSubordinate()) { if (isHostRename && !existingHost.isSubordinate()) {
throw new CannotRenameExternalHostException(); throw new CannotRenameExternalHostException();
} }
// Verify that the new superordinate domain belongs to this registrar. // Verify that the new superordinate domain belongs to this registrar.
verifySuperordinateDomainOwnership(clientId, newSuperordinateDomain); verifySuperordinateDomainOwnership(registrarId, newSuperordinateDomain);
ImmutableSet<StatusValue> statusesToAdd = command.getInnerAdd().getStatusValues(); ImmutableSet<StatusValue> statusesToAdd = command.getInnerAdd().getStatusValues();
ImmutableSet<StatusValue> statusesToRemove = command.getInnerRemove().getStatusValues(); ImmutableSet<StatusValue> statusesToRemove = command.getInnerRemove().getStatusValues();
// If the resource is marked with clientUpdateProhibited, and this update does not clear that // If the resource is marked with clientUpdateProhibited, and this update does not clear that

View file

@ -14,7 +14,7 @@
package google.registry.flows.poll; 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.ackPollMessage;
import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount; import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_NO_MESSAGES; 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.ParameterValueSyntaxErrorException;
import google.registry.flows.EppException.RequiredParameterMissingException; import google.registry.flows.EppException.RequiredParameterMissingException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.FlowModule.ClientId;
import google.registry.flows.FlowModule.PollMessageId; import google.registry.flows.FlowModule.PollMessageId;
import google.registry.flows.FlowModule.RegistrarId;
import google.registry.flows.TransactionalFlow; import google.registry.flows.TransactionalFlow;
import google.registry.model.eppoutput.EppResponse; import google.registry.model.eppoutput.EppResponse;
import google.registry.model.poll.MessageQueueInfo; import google.registry.model.poll.MessageQueueInfo;
@ -58,15 +58,16 @@ import org.joda.time.DateTime;
public class PollAckFlow implements TransactionalFlow { public class PollAckFlow implements TransactionalFlow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @PollMessageId String messageId; @Inject @PollMessageId String messageId;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@Inject PollAckFlow() {} @Inject PollAckFlow() {}
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
if (messageId.isEmpty()) { if (messageId.isEmpty()) {
throw new MissingMessageIdException(); 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 // Make sure this client is authorized to ack this message. It could be that the message is
// supposed to go to a different registrar. // supposed to go to a different registrar.
if (!clientId.equals(pollMessage.getClientId())) { if (!registrarId.equals(pollMessage.getRegistrarId())) {
throw new NotAuthorizedToAckMessageException(); 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 // acked, then we return a special status code indicating that. Note that the query will
// include the message being acked. // 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 // 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 // reduced by one thanks to the acked poll message). SQL will, however, so we shouldn't reduce
// the count in the SQL case. // the count in the SQL case.

View file

@ -14,7 +14,7 @@
package google.registry.flows.poll; 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.getFirstPollMessage;
import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount; import static google.registry.flows.poll.PollFlowUtils.getPollMessageCount;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACK_MESSAGE; 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.EppException.ParameterValueSyntaxErrorException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; import google.registry.flows.Flow;
import google.registry.flows.FlowModule.ClientId;
import google.registry.flows.FlowModule.PollMessageId; import google.registry.flows.FlowModule.PollMessageId;
import google.registry.flows.FlowModule.RegistrarId;
import google.registry.model.eppoutput.EppResponse; import google.registry.model.eppoutput.EppResponse;
import google.registry.model.poll.MessageQueueInfo; import google.registry.model.poll.MessageQueueInfo;
import google.registry.model.poll.PollMessage; import google.registry.model.poll.PollMessage;
@ -50,7 +50,7 @@ import org.joda.time.DateTime;
public class PollRequestFlow implements Flow { public class PollRequestFlow implements Flow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject @PollMessageId String messageId; @Inject @PollMessageId String messageId;
@Inject Clock clock; @Inject Clock clock;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@ -59,13 +59,13 @@ public class PollRequestFlow implements Flow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
if (!messageId.isEmpty()) { if (!messageId.isEmpty()) {
throw new UnexpectedMessageIdException(); throw new UnexpectedMessageIdException();
} }
// Return the oldest message from the queue. // Return the oldest message from the queue.
DateTime now = clock.nowUtc(); DateTime now = clock.nowUtc();
Optional<PollMessage> maybePollMessage = getFirstPollMessage(clientId, now); Optional<PollMessage> maybePollMessage = getFirstPollMessage(registrarId, now);
if (!maybePollMessage.isPresent()) { if (!maybePollMessage.isPresent()) {
return responseBuilder.setResultFromCode(SUCCESS_WITH_NO_MESSAGES).build(); return responseBuilder.setResultFromCode(SUCCESS_WITH_NO_MESSAGES).build();
} }
@ -76,7 +76,7 @@ public class PollRequestFlow implements Flow {
new MessageQueueInfo.Builder() new MessageQueueInfo.Builder()
.setQueueDate(pollMessage.getEventTime()) .setQueueDate(pollMessage.getEventTime())
.setMsg(pollMessage.getMsg()) .setMsg(pollMessage.getMsg())
.setQueueLength(getPollMessageCount(clientId, now)) .setQueueLength(getPollMessageCount(registrarId, now))
.setMessageId(makePollMessageExternalId(pollMessage)) .setMessageId(makePollMessageExternalId(pollMessage))
.build()) .build())
.setMultipleResData(pollMessage.getResponseData()) .setMultipleResData(pollMessage.getResponseData())

View file

@ -30,7 +30,7 @@ import google.registry.flows.EppException.UnimplementedObjectServiceException;
import google.registry.flows.EppException.UnimplementedOptionException; import google.registry.flows.EppException.UnimplementedOptionException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.SessionMetadata;
import google.registry.flows.TransportCredentials; import google.registry.flows.TransportCredentials;
import google.registry.model.eppcommon.ProtocolDefinition; 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.TlsCredentials.MissingRegistrarCertificateException}
* @error {@link google.registry.flows.TransportCredentials.BadRegistrarPasswordException} * @error {@link google.registry.flows.TransportCredentials.BadRegistrarPasswordException}
* @error {@link LoginFlow.AlreadyLoggedInException} * @error {@link LoginFlow.AlreadyLoggedInException}
* @error {@link LoginFlow.BadRegistrarClientIdException} * @error {@link BadRegistrarIdException}
* @error {@link LoginFlow.TooManyFailedLoginsException} * @error {@link LoginFlow.TooManyFailedLoginsException}
* @error {@link LoginFlow.PasswordChangesNotSupportedException} * @error {@link LoginFlow.PasswordChangesNotSupportedException}
* @error {@link LoginFlow.RegistrarAccountNotActiveException} * @error {@link LoginFlow.RegistrarAccountNotActiveException}
@ -73,8 +73,9 @@ public class LoginFlow implements Flow {
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject SessionMetadata sessionMetadata; @Inject SessionMetadata sessionMetadata;
@Inject TransportCredentials credentials; @Inject TransportCredentials credentials;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@Inject LoginFlow() {} @Inject LoginFlow() {}
/** Run the flow and log errors. */ /** Run the flow and log errors. */
@ -92,7 +93,7 @@ public class LoginFlow implements Flow {
public final EppResponse runWithoutLogging() throws EppException { public final EppResponse runWithoutLogging() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
Login login = (Login) eppInput.getCommandWrapper().getCommand(); Login login = (Login) eppInput.getCommandWrapper().getCommand();
if (!clientId.isEmpty()) { if (!registrarId.isEmpty()) {
throw new AlreadyLoggedInException(); throw new AlreadyLoggedInException();
} }
Options options = login.getOptions(); Options options = login.getOptions();
@ -114,9 +115,9 @@ public class LoginFlow implements Flow {
} }
serviceExtensionUrisBuilder.add(uri); serviceExtensionUrisBuilder.add(uri);
} }
Optional<Registrar> registrar = Registrar.loadByClientIdCached(login.getClientId()); Optional<Registrar> registrar = Registrar.loadByRegistrarIdCached(login.getClientId());
if (!registrar.isPresent()) { if (!registrar.isPresent()) {
throw new BadRegistrarClientIdException(login.getClientId()); throw new BadRegistrarIdException(login.getClientId());
} }
// AuthenticationErrorExceptions will propagate up through here. // AuthenticationErrorExceptions will propagate up through here.
@ -139,15 +140,15 @@ public class LoginFlow implements Flow {
// We are in! // We are in!
sessionMetadata.resetFailedLoginAttempts(); sessionMetadata.resetFailedLoginAttempts();
sessionMetadata.setClientId(login.getClientId()); sessionMetadata.setRegistrarId(login.getClientId());
sessionMetadata.setServiceExtensionUris(serviceExtensionUrisBuilder.build()); sessionMetadata.setServiceExtensionUris(serviceExtensionUrisBuilder.build());
return responseBuilder.setIsLoginResponse().build(); return responseBuilder.setIsLoginResponse().build();
} }
/** Registrar with this client ID could not be found. */ /** Registrar with this ID could not be found. */
static class BadRegistrarClientIdException extends AuthenticationErrorException { static class BadRegistrarIdException extends AuthenticationErrorException {
public BadRegistrarClientIdException(String clientId) { public BadRegistrarIdException(String registrarId) {
super("Registrar with this client ID could not be found: " + clientId); super("Registrar with this ID could not be found: " + registrarId);
} }
} }

View file

@ -14,13 +14,13 @@
package google.registry.flows.session; 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 static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
import google.registry.flows.Flow; 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.SessionMetadata;
import google.registry.model.eppoutput.EppResponse; import google.registry.model.eppoutput.EppResponse;
import javax.inject.Inject; import javax.inject.Inject;
@ -33,7 +33,7 @@ import javax.inject.Inject;
public class LogoutFlow implements Flow { public class LogoutFlow implements Flow {
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject @ClientId String clientId; @Inject @RegistrarId String registrarId;
@Inject SessionMetadata sessionMetadata; @Inject SessionMetadata sessionMetadata;
@Inject EppResponse.Builder responseBuilder; @Inject EppResponse.Builder responseBuilder;
@Inject LogoutFlow() {} @Inject LogoutFlow() {}
@ -41,7 +41,7 @@ public class LogoutFlow implements Flow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.validate(); // There are no legal extensions for this flow. extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId); validateRegistrarIsLoggedIn(registrarId);
sessionMetadata.invalidate(); sessionMetadata.invalidate();
return responseBuilder.setResultFromCode(SUCCESS_AND_CLOSE).build(); return responseBuilder.setResultFromCode(SUCCESS_AND_CLOSE).build();
} }

View file

@ -74,10 +74,10 @@ public class LoadTestAction implements Runnable {
public static final String PATH = "/_dr/loadtest"; 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 @Inject
@Parameter("loadtestClientId") @Parameter("loadtestClientId")
String clientId; String registrarId;
/** /**
* The number of seconds to delay the execution of the first load testing tasks by. Preparatory * 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, || hostInfosPerSecond > 0,
"You must specify at least one of the 'operations per second' parameters."); "You must specify at least one of the 'operations per second' parameters.");
logger.atInfo().log( 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, " + "runSeconds: %d, successful|failed domain creates/s: %d|%d, domain infos/s: %d, "
+ "domain checks/s: %d, successful|failed contact creates/s: %d|%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.", + "contact infos/s: %d, successful|failed host creates/s: %d|%d, host infos/s: %d.",
clientId, registrarId,
delaySeconds, delaySeconds,
runSeconds, runSeconds,
successfulDomainCreatesPerSecond, successfulDomainCreatesPerSecond,
@ -327,10 +327,11 @@ public class LoadTestAction implements Runnable {
for (int i = 0; i < xmls.size(); i++) { for (int i = 0; i < xmls.size(); i++) {
// Space tasks evenly within across a second. // Space tasks evenly within across a second.
int offsetMillis = (int) (1000.0 / xmls.size() * i); 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) .etaMillis(start.getMillis() + offsetMillis)
.header(X_CSRF_TOKEN, xsrfToken) .header(X_CSRF_TOKEN, xsrfToken)
.param("clientId", clientId) .param("clientId", registrarId)
.param("superuser", Boolean.FALSE.toString()) .param("superuser", Boolean.FALSE.toString())
.param("dryRun", Boolean.FALSE.toString()) .param("dryRun", Boolean.FALSE.toString())
.param("xml", xmls.get(i))); .param("xml", xmls.get(i)));

View file

@ -175,7 +175,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
return creationTime.getTimestamp(); return creationTime.getTimestamp();
} }
public String getCreationClientId() { public String getCreationRegistrarId() {
return creationClientId; return creationClientId;
} }
@ -183,7 +183,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
return lastEppUpdateTime; return lastEppUpdateTime;
} }
public String getLastEppUpdateClientId() { public String getLastEppUpdateRegistrarId() {
return lastEppUpdateClientId; 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 * <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. * 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; return currentSponsorClientId;
} }
@ -294,14 +294,14 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
} }
/** Set the current sponsoring registrar. */ /** Set the current sponsoring registrar. */
public B setPersistedCurrentSponsorClientId(String currentSponsorClientId) { public B setPersistedCurrentSponsorRegistrarId(String currentSponsorRegistrarId) {
getInstance().currentSponsorClientId = currentSponsorClientId; getInstance().currentSponsorClientId = currentSponsorRegistrarId;
return thisCastToDerived(); return thisCastToDerived();
} }
/** Set the registrar that created this resource. */ /** Set the registrar that created this resource. */
public B setCreationClientId(String creationClientId) { public B setCreationRegistrarId(String creationRegistrarId) {
getInstance().creationClientId = creationClientId; getInstance().creationClientId = creationRegistrarId;
return thisCastToDerived(); 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. */ /** Set the registrar who last performed a {@literal <update>} on this resource. */
public B setLastEppUpdateClientId(String lastEppUpdateClientId) { public B setLastEppUpdateRegistrarId(String lastEppUpdateRegistrarId) {
getInstance().lastEppUpdateClientId = lastEppUpdateClientId; getInstance().lastEppUpdateClientId = lastEppUpdateRegistrarId;
return thisCastToDerived(); return thisCastToDerived();
} }

View file

@ -240,7 +240,7 @@ public final class EppResourceUtils {
.removeStatusValue(StatusValue.PENDING_TRANSFER) .removeStatusValue(StatusValue.PENDING_TRANSFER)
.setTransferData((T) transferDataBuilder.build()) .setTransferData((T) transferDataBuilder.build())
.setLastTransferTime(transferData.getPendingTransferExpirationTime()) .setLastTransferTime(transferData.getPendingTransferExpirationTime())
.setPersistedCurrentSponsorClientId(transferData.getGainingClientId()); .setPersistedCurrentSponsorRegistrarId(transferData.getGainingRegistrarId());
} }
/** /**

View file

@ -63,7 +63,7 @@ import org.joda.time.Duration;
* <p>Usage example: * <p>Usage example:
* *
* <pre>{@code * <pre>{@code
* OteAccountBuilder.forClientId("example") * OteAccountBuilder.forRegistrarId("example")
* .addContact("contact@email.com") // OPTIONAL * .addContact("contact@email.com") // OPTIONAL
* .setPassword("password") // OPTIONAL * .setPassword("password") // OPTIONAL
* .setCertificateHash(certificateHash) // OPTIONAL * .setCertificateHash(certificateHash) // OPTIONAL
@ -111,7 +111,7 @@ public final class OteAccountBuilder {
DateTime.parse("2030-03-01T00:00:00Z"), DateTime.parse("2030-03-01T00:00:00Z"),
Money.of(CurrencyUnit.USD, 0)); Money.of(CurrencyUnit.USD, 0));
private final ImmutableMap<String, String> clientIdToTld; private final ImmutableMap<String, String> registrarIdToTld;
private final Registry sunriseTld; private final Registry sunriseTld;
private final Registry gaTld; private final Registry gaTld;
private final Registry eapTld; private final Registry eapTld;
@ -121,16 +121,16 @@ public final class OteAccountBuilder {
private ImmutableList<Registrar> registrars; private ImmutableList<Registrar> registrars;
private boolean replaceExisting = false; private boolean replaceExisting = false;
private OteAccountBuilder(String baseClientId) { private OteAccountBuilder(String baseRegistrarId) {
checkState( checkState(
RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION, RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION,
"Can't setup OT&E in production"); "Can't setup OT&E in production");
clientIdToTld = createClientIdToTldMap(baseClientId); registrarIdToTld = createRegistrarIdToTldMap(baseRegistrarId);
sunriseTld = createTld(baseClientId + "-sunrise", START_DATE_SUNRISE, false, 0); sunriseTld = createTld(baseRegistrarId + "-sunrise", START_DATE_SUNRISE, false, 0);
gaTld = createTld(baseClientId + "-ga", GENERAL_AVAILABILITY, false, 2); gaTld = createTld(baseRegistrarId + "-ga", GENERAL_AVAILABILITY, false, 2);
eapTld = createTld(baseClientId + "-eap", GENERAL_AVAILABILITY, true, 3); eapTld = createTld(baseRegistrarId + "-eap", GENERAL_AVAILABILITY, true, 3);
registrars = registrars =
clientIdToTld.keySet().stream() registrarIdToTld.keySet().stream()
.map(OteAccountBuilder::createRegistrar) .map(OteAccountBuilder::createRegistrar)
.collect(toImmutableList()); .collect(toImmutableList());
} }
@ -138,11 +138,11 @@ public final class OteAccountBuilder {
/** /**
* Creates an OteAccountBuilder for the given base client ID. * Creates an OteAccountBuilder for the given base client ID.
* *
* @param baseClientId the base clientId which will help name all the entities we create. Normally * @param baseRegistrarId the base registrar ID which will help name all the entities we create.
* is the same as the "prod" clientId designated for this registrar. * Normally is the same as the "prod" ID designated for this registrar.
*/ */
public static OteAccountBuilder forClientId(String baseClientId) { public static OteAccountBuilder forRegistrarId(String baseRegistrarId) {
return new OteAccountBuilder(baseClientId); return new OteAccountBuilder(baseRegistrarId);
} }
/** /**
@ -232,14 +232,15 @@ public final class OteAccountBuilder {
*/ */
public ImmutableMap<String, String> buildAndPersist() { public ImmutableMap<String, String> buildAndPersist() {
saveAllEntities(); saveAllEntities();
return clientIdToTld; return registrarIdToTld;
} }
/** /**
* Return map from the OT&amp;E clientIds we will create to the new TLDs they will have access to. * Return map from the OT&amp;E registrarIds we will create to the new TLDs they will have access
* to.
*/ */
public ImmutableMap<String, String> getClientIdToTldMap() { public ImmutableMap<String, String> getRegistrarIdToTldMap() {
return clientIdToTld; return registrarIdToTld;
} }
/** Saves all the OT&amp;E entities we created. */ /** Saves all the OT&amp;E entities we created. */
@ -279,7 +280,7 @@ public final class OteAccountBuilder {
} }
private Registrar addAllowedTld(Registrar registrar) { private Registrar addAllowedTld(Registrar registrar) {
String tld = clientIdToTld.get(registrar.getClientId()); String tld = registrarIdToTld.get(registrar.getRegistrarId());
if (registrar.getAllowedTlds().contains(tld)) { if (registrar.getAllowedTlds().contains(tld)) {
return registrar; return registrar;
} }
@ -324,7 +325,7 @@ public final class OteAccountBuilder {
*/ */
private static Registrar createRegistrar(String registrarName) { private static Registrar createRegistrar(String registrarName) {
return new Registrar.Builder() return new Registrar.Builder()
.setClientId(registrarName) .setRegistrarId(registrarName)
.setRegistrarName(registrarName) .setRegistrarName(registrarName)
.setType(Registrar.Type.OTE) .setType(Registrar.Type.OTE)
.setLocalizedAddress(DEFAULT_ADDRESS) .setLocalizedAddress(DEFAULT_ADDRESS)
@ -346,31 +347,31 @@ public final class OteAccountBuilder {
.build(); .build();
} }
/** Returns the ClientIds of the OT&amp;E, with the TLDs each has access to. */ /** Returns the registrar IDs of the OT&amp;E, with the TLDs each has access to. */
public static ImmutableMap<String, String> createClientIdToTldMap(String baseClientId) { public static ImmutableMap<String, String> createRegistrarIdToTldMap(String baseRegistrarId) {
checkArgument( checkArgument(
REGISTRAR_PATTERN.matcher(baseClientId).matches(), REGISTRAR_PATTERN.matcher(baseRegistrarId).matches(),
"Invalid registrar name: %s", "Invalid registrar name: %s",
baseClientId); baseRegistrarId);
return new ImmutableMap.Builder<String, String>() 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. // The -2 registrar no longer exists because landrush no longer exists.
.put(baseClientId + "-3", baseClientId + "-ga") .put(baseRegistrarId + "-3", baseRegistrarId + "-ga")
.put(baseClientId + "-4", baseClientId + "-ga") .put(baseRegistrarId + "-4", baseRegistrarId + "-ga")
.put(baseClientId + "-5", baseClientId + "-eap") .put(baseRegistrarId + "-5", baseRegistrarId + "-eap")
.build(); .build();
} }
/** Returns the base client ID that correspond to a given OT&amp;E client ID. */ /** Returns the base registrar ID that corresponds to a given OT&amp;E registrar ID. */
public static String getBaseClientId(String oteClientId) { public static String getBaseRegistrarId(String oteRegistrarId) {
int index = oteClientId.lastIndexOf('-'); int index = oteRegistrarId.lastIndexOf('-');
checkArgument(index > 0, "Invalid OT&E client ID: %s", oteClientId); checkArgument(index > 0, "Invalid OT&E registrar ID: %s", oteRegistrarId);
String baseClientId = oteClientId.substring(0, index); String baseRegistrarId = oteRegistrarId.substring(0, index);
checkArgument( checkArgument(
createClientIdToTldMap(baseClientId).containsKey(oteClientId), createRegistrarIdToTldMap(baseRegistrarId).containsKey(oteRegistrarId),
"ID %s is not one of the OT&E client IDs for base %s", "ID %s is not one of the OT&E registrar IDs for base %s",
oteClientId, oteRegistrarId,
baseClientId); baseRegistrarId);
return baseClientId; return baseRegistrarId;
} }
} }

View file

@ -196,7 +196,7 @@ public class OteStats {
*/ */
private OteStats recordRegistrarHistory(String registrarName) { private OteStats recordRegistrarHistory(String registrarName) {
ImmutableCollection<String> registrarIds = ImmutableCollection<String> registrarIds =
OteAccountBuilder.createClientIdToTldMap(registrarName).keySet(); OteAccountBuilder.createRegistrarIdToTldMap(registrarName).keySet();
for (HistoryEntry historyEntry : HistoryEntryDao.loadHistoryObjectsByRegistrars(registrarIds)) { for (HistoryEntry historyEntry : HistoryEntryDao.loadHistoryObjectsByRegistrars(registrarIds)) {
try { try {

View file

@ -72,8 +72,9 @@ public final class ResourceTransferUtils {
? domainTransferData.getTransferredRegistrationExpirationTime() ? domainTransferData.getTransferredRegistrationExpirationTime()
: null); : null);
} }
builder.setGainingClientId(transferData.getGainingClientId()) builder
.setLosingClientId(transferData.getLosingClientId()) .setGainingRegistrarId(transferData.getGainingRegistrarId())
.setLosingRegistrarId(transferData.getLosingRegistrarId())
.setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime()) .setPendingTransferExpirationTime(transferData.getPendingTransferExpirationTime())
.setTransferRequestTime(transferData.getTransferRequestTime()) .setTransferRequestTime(transferData.getTransferRequestTime())
.setTransferStatus(transferData.getTransferStatus()); .setTransferStatus(transferData.getTransferStatus());
@ -119,7 +120,7 @@ public final class ResourceTransferUtils {
tm().delete(oldTransferData.getServerApproveEntities()); tm().delete(oldTransferData.getServerApproveEntities());
tm().put( tm().put(
new PollMessage.OneTime.Builder() new PollMessage.OneTime.Builder()
.setClientId(oldTransferData.getGainingClientId()) .setRegistrarId(oldTransferData.getGainingRegistrarId())
.setEventTime(now) .setEventTime(now)
.setMsg(TransferStatus.SERVER_CANCELLED.getMessage()) .setMsg(TransferStatus.SERVER_CANCELLED.getMessage())
.setResponseData( .setResponseData(
@ -178,7 +179,7 @@ public final class ResourceTransferUtils {
B builder = resolvePendingTransfer(resource, transferStatus, now); B builder = resolvePendingTransfer(resource, transferStatus, now);
return builder return builder
.setLastTransferTime(now) .setLastTransferTime(now)
.setPersistedCurrentSponsorClientId(resource.getTransferData().getGainingClientId()) .setPersistedCurrentSponsorRegistrarId(resource.getTransferData().getGainingRegistrarId())
.build(); .build();
} }
@ -195,7 +196,7 @@ public final class ResourceTransferUtils {
checkArgument(transferStatus.isDenied(), "Not a denial transfer status"); checkArgument(transferStatus.isDenied(), "Not a denial transfer status");
return resolvePendingTransfer(resource, transferStatus, now) return resolvePendingTransfer(resource, transferStatus, now)
.setLastEppUpdateTime(now) .setLastEppUpdateTime(now)
.setLastEppUpdateClientId(lastEppUpdateClientId) .setLastEppUpdateRegistrarId(lastEppUpdateClientId)
.build(); .build();
} }
} }

View file

@ -163,7 +163,7 @@ public abstract class BillingEvent extends ImmutableObject
domainRepoId = parent.getParent().getName(); domainRepoId = parent.getParent().getName();
} }
public String getClientId() { public String getRegistrarId() {
return clientId; return clientId;
} }
@ -223,8 +223,8 @@ public abstract class BillingEvent extends ImmutableObject
return thisCastToDerived(); return thisCastToDerived();
} }
public B setClientId(String clientId) { public B setRegistrarId(String registrarId) {
getInstance().clientId = clientId; getInstance().clientId = registrarId;
return thisCastToDerived(); return thisCastToDerived();
} }
@ -660,7 +660,7 @@ public abstract class BillingEvent extends ImmutableObject
new BillingEvent.Cancellation.Builder() new BillingEvent.Cancellation.Builder()
.setReason(checkNotNull(GRACE_PERIOD_TO_REASON.get(gracePeriod.getType()))) .setReason(checkNotNull(GRACE_PERIOD_TO_REASON.get(gracePeriod.getType())))
.setTargetId(targetId) .setTargetId(targetId)
.setClientId(gracePeriod.getClientId()) .setRegistrarId(gracePeriod.getRegistrarId())
.setEventTime(eventTime) .setEventTime(eventTime)
// The charge being cancelled will take place at the grace period's expiration time. // The charge being cancelled will take place at the grace period's expiration time.
.setBillingTime(gracePeriod.getExpirationTime()) .setBillingTime(gracePeriod.getExpirationTime())
@ -778,7 +778,7 @@ public abstract class BillingEvent extends ImmutableObject
public static Modification createRefundFor( public static Modification createRefundFor(
OneTime billingEvent, DomainHistory historyEntry, String description) { OneTime billingEvent, DomainHistory historyEntry, String description) {
return new Builder() return new Builder()
.setClientId(billingEvent.getClientId()) .setRegistrarId(billingEvent.getRegistrarId())
.setFlags(billingEvent.getFlags()) .setFlags(billingEvent.getFlags())
.setReason(billingEvent.getReason()) .setReason(billingEvent.getReason())
.setTargetId(billingEvent.getTargetId()) .setTargetId(billingEvent.getTargetId())

View file

@ -237,8 +237,8 @@ public class ContactBase extends EppResource implements ResourceWithTransferData
return disclose; return disclose;
} }
public String getCurrentSponsorClientId() { public String getCurrentSponsorRegistrarId() {
return getPersistedCurrentSponsorClientId(); return getPersistedCurrentSponsorRegistrarId();
} }
@Override @Override

View file

@ -88,7 +88,7 @@ public class ContactResource extends ContactBase
public Builder copyFrom(ContactBase contactBase) { public Builder copyFrom(ContactBase contactBase) {
return this.setAuthInfo(contactBase.getAuthInfo()) return this.setAuthInfo(contactBase.getAuthInfo())
.setContactId(contactBase.getContactId()) .setContactId(contactBase.getContactId())
.setCreationClientId(contactBase.getCreationClientId()) .setCreationRegistrarId(contactBase.getCreationRegistrarId())
.setCreationTime(contactBase.getCreationTime()) .setCreationTime(contactBase.getCreationTime())
.setDeletionTime(contactBase.getDeletionTime()) .setDeletionTime(contactBase.getDeletionTime())
.setDisclose(contactBase.getDisclose()) .setDisclose(contactBase.getDisclose())
@ -96,10 +96,11 @@ public class ContactResource extends ContactBase
.setFaxNumber(contactBase.getFaxNumber()) .setFaxNumber(contactBase.getFaxNumber())
.setInternationalizedPostalInfo(contactBase.getInternationalizedPostalInfo()) .setInternationalizedPostalInfo(contactBase.getInternationalizedPostalInfo())
.setLastTransferTime(contactBase.getLastTransferTime()) .setLastTransferTime(contactBase.getLastTransferTime())
.setLastEppUpdateClientId(contactBase.getLastEppUpdateClientId()) .setLastEppUpdateRegistrarId(contactBase.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(contactBase.getLastEppUpdateTime()) .setLastEppUpdateTime(contactBase.getLastEppUpdateTime())
.setLocalizedPostalInfo(contactBase.getLocalizedPostalInfo()) .setLocalizedPostalInfo(contactBase.getLocalizedPostalInfo())
.setPersistedCurrentSponsorClientId(contactBase.getPersistedCurrentSponsorClientId()) .setPersistedCurrentSponsorRegistrarId(
contactBase.getPersistedCurrentSponsorRegistrarId())
.setRepoId(contactBase.getRepoId()) .setRepoId(contactBase.getRepoId())
.setStatusValues(contactBase.getStatusValues()) .setStatusValues(contactBase.getStatusValues())
.setTransferData(contactBase.getTransferData()) .setTransferData(contactBase.getTransferData())

View file

@ -194,7 +194,7 @@ public class DomainBase extends DomainContent
.setAutorenewBillingEvent(domainContent.getAutorenewBillingEvent()) .setAutorenewBillingEvent(domainContent.getAutorenewBillingEvent())
.setAutorenewEndTime(domainContent.getAutorenewEndTime()) .setAutorenewEndTime(domainContent.getAutorenewEndTime())
.setContacts(domainContent.getContacts()) .setContacts(domainContent.getContacts())
.setCreationClientId(domainContent.getCreationClientId()) .setCreationRegistrarId(domainContent.getCreationRegistrarId())
.setCreationTime(domainContent.getCreationTime()) .setCreationTime(domainContent.getCreationTime())
.setDomainName(domainContent.getDomainName()) .setDomainName(domainContent.getDomainName())
.setDeletePollMessage(domainContent.getDeletePollMessage()) .setDeletePollMessage(domainContent.getDeletePollMessage())
@ -204,10 +204,11 @@ public class DomainBase extends DomainContent
.setIdnTableName(domainContent.getIdnTableName()) .setIdnTableName(domainContent.getIdnTableName())
.setLastTransferTime(domainContent.getLastTransferTime()) .setLastTransferTime(domainContent.getLastTransferTime())
.setLaunchNotice(domainContent.getLaunchNotice()) .setLaunchNotice(domainContent.getLaunchNotice())
.setLastEppUpdateClientId(domainContent.getLastEppUpdateClientId()) .setLastEppUpdateRegistrarId(domainContent.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(domainContent.getLastEppUpdateTime()) .setLastEppUpdateTime(domainContent.getLastEppUpdateTime())
.setNameservers(domainContent.getNameservers()) .setNameservers(domainContent.getNameservers())
.setPersistedCurrentSponsorClientId(domainContent.getPersistedCurrentSponsorClientId()) .setPersistedCurrentSponsorRegistrarId(
domainContent.getPersistedCurrentSponsorRegistrarId())
.setRegistrant(domainContent.getRegistrant()) .setRegistrant(domainContent.getRegistrant())
.setRegistrationExpirationTime(domainContent.getRegistrationExpirationTime()) .setRegistrationExpirationTime(domainContent.getRegistrationExpirationTime())
.setRepoId(domainContent.getRepoId()) .setRepoId(domainContent.getRepoId())

View file

@ -520,8 +520,8 @@ public class DomainContent extends EppResource
this.dsData = dsData; this.dsData = dsData;
} }
public final String getCurrentSponsorClientId() { public final String getCurrentSponsorRegistrarId() {
return getPersistedCurrentSponsorClientId(); return getPersistedCurrentSponsorRegistrarId();
} }
/** Returns true if DNS information should be published for the given domain. */ /** Returns true if DNS information should be published for the given domain. */
@ -617,7 +617,7 @@ public class DomainContent extends EppResource
domain.getRepoId(), domain.getRepoId(),
transferExpirationTime.plus( transferExpirationTime.plus(
Registry.get(domain.getTld()).getTransferGracePeriodLength()), Registry.get(domain.getTld()).getTransferGracePeriodLength()),
transferData.getGainingClientId(), transferData.getGainingRegistrarId(),
transferData.getServerApproveBillingEvent()))); transferData.getServerApproveBillingEvent())));
} else { } else {
// There won't be a billing event, so we don't need a grace period // 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); setAutomaticTransferSuccessProperties(builder, transferData);
builder builder
.setLastEppUpdateTime(transferExpirationTime) .setLastEppUpdateTime(transferExpirationTime)
.setLastEppUpdateClientId(transferData.getGainingClientId()); .setLastEppUpdateRegistrarId(transferData.getGainingRegistrarId());
// Finish projecting to now. // Finish projecting to now.
return (T) builder.build().cloneProjectedAtTime(now); return (T) builder.build().cloneProjectedAtTime(now);
} }
@ -653,7 +653,7 @@ public class DomainContent extends EppResource
domain.getRepoId(), domain.getRepoId(),
lastAutorenewTime.plus( lastAutorenewTime.plus(
Registry.get(domain.getTld()).getAutoRenewGracePeriodLength()), Registry.get(domain.getTld()).getAutoRenewGracePeriodLength()),
domain.getCurrentSponsorClientId(), domain.getCurrentSponsorRegistrarId(),
domain.getAutorenewBillingEvent())); domain.getAutorenewBillingEvent()));
newLastEppUpdateTime = Optional.of(lastAutorenewTime); newLastEppUpdateTime = Optional.of(lastAutorenewTime);
} }
@ -679,7 +679,7 @@ public class DomainContent extends EppResource
|| newLastEppUpdateTime.get().isAfter(domain.getLastEppUpdateTime())) { || newLastEppUpdateTime.get().isAfter(domain.getLastEppUpdateTime())) {
builder builder
.setLastEppUpdateTime(newLastEppUpdateTime.get()) .setLastEppUpdateTime(newLastEppUpdateTime.get())
.setLastEppUpdateClientId(domain.getCurrentSponsorClientId()); .setLastEppUpdateRegistrarId(domain.getCurrentSponsorRegistrarId());
} }
} }

View file

@ -176,8 +176,9 @@ public class DomainHistory extends HistoryEntry implements SqlEntity {
@Nullable @Nullable
@Access(AccessType.PROPERTY) @Access(AccessType.PROPERTY)
@Column(name = "historyOtherRegistrarId") @Column(name = "historyOtherRegistrarId")
@Override
public String getOtherRegistrarId() { public String getOtherRegistrarId() {
return super.getOtherClientId(); return super.getOtherRegistrarId();
} }
/** /**

View file

@ -58,7 +58,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
GracePeriodStatus type, GracePeriodStatus type,
String domainRepoId, String domainRepoId,
DateTime expirationTime, DateTime expirationTime,
String clientId, String registrarId,
@Nullable VKey<BillingEvent.OneTime> billingEventOneTime, @Nullable VKey<BillingEvent.OneTime> billingEventOneTime,
@Nullable VKey<BillingEvent.Recurring> billingEventRecurring, @Nullable VKey<BillingEvent.Recurring> billingEventRecurring,
@Nullable Long gracePeriodId) { @Nullable Long gracePeriodId) {
@ -72,7 +72,7 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
instance.type = checkArgumentNotNull(type); instance.type = checkArgumentNotNull(type);
instance.domainRepoId = checkArgumentNotNull(domainRepoId); instance.domainRepoId = checkArgumentNotNull(domainRepoId);
instance.expirationTime = checkArgumentNotNull(expirationTime); instance.expirationTime = checkArgumentNotNull(expirationTime);
instance.clientId = checkArgumentNotNull(clientId); instance.clientId = checkArgumentNotNull(registrarId);
instance.billingEventOneTime = BillingEventVKey.create(billingEventOneTime); instance.billingEventOneTime = BillingEventVKey.create(billingEventOneTime);
instance.billingEventRecurring = BillingRecurrenceVKey.create(billingEventRecurring); instance.billingEventRecurring = BillingRecurrenceVKey.create(billingEventRecurring);
return instance; return instance;
@ -89,10 +89,10 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
GracePeriodStatus type, GracePeriodStatus type,
String domainRepoId, String domainRepoId,
DateTime expirationTime, DateTime expirationTime,
String clientId, String registrarId,
@Nullable VKey<BillingEvent.OneTime> billingEventOneTime) { @Nullable VKey<BillingEvent.OneTime> billingEventOneTime) {
return createInternal( 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, GracePeriodStatus type,
String domainRepoId, String domainRepoId,
DateTime expirationTime, DateTime expirationTime,
String clientId, String registrarId,
@Nullable VKey<BillingEvent.OneTime> billingEventOneTime, @Nullable VKey<BillingEvent.OneTime> billingEventOneTime,
@Nullable Long gracePeriodId) { @Nullable Long gracePeriodId) {
return createInternal( return createInternal(
type, domainRepoId, expirationTime, clientId, billingEventOneTime, null, gracePeriodId); type, domainRepoId, expirationTime, registrarId, billingEventOneTime, null, gracePeriodId);
} }
public static GracePeriod createFromHistory(GracePeriodHistory history) { public static GracePeriod createFromHistory(GracePeriodHistory history) {
@ -131,11 +131,11 @@ public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntit
GracePeriodStatus type, GracePeriodStatus type,
String domainRepoId, String domainRepoId,
DateTime expirationTime, DateTime expirationTime,
String clientId, String registrarId,
VKey<Recurring> billingEventRecurring) { VKey<Recurring> billingEventRecurring) {
checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null"); checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null");
return createInternal( 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}. */ /** 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, GracePeriodStatus type,
String domainRepoId, String domainRepoId,
DateTime expirationTime, DateTime expirationTime,
String clientId, String registrarId,
VKey<Recurring> billingEventRecurring, VKey<Recurring> billingEventRecurring,
@Nullable Long gracePeriodId) { @Nullable Long gracePeriodId) {
checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null"); checkArgumentNotNull(billingEventRecurring, "billingEventRecurring cannot be null");
return createInternal( return createInternal(
type, domainRepoId, expirationTime, clientId, null, billingEventRecurring, gracePeriodId); type,
domainRepoId,
expirationTime,
registrarId,
null,
billingEventRecurring,
gracePeriodId);
} }
/** Creates a GracePeriod with no billing event. */ /** Creates a GracePeriod with no billing event. */
public static GracePeriod createWithoutBillingEvent( public static GracePeriod createWithoutBillingEvent(
GracePeriodStatus type, String domainRepoId, DateTime expirationTime, String clientId) { GracePeriodStatus type, String domainRepoId, DateTime expirationTime, String registrarId) {
return createInternal(type, domainRepoId, expirationTime, clientId, null, null, null); return createInternal(type, domainRepoId, expirationTime, registrarId, null, null, null);
} }
/** Constructs a GracePeriod of the given type from the provided one-time BillingEvent. */ /** 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, type,
domainRepoId, domainRepoId,
billingEvent.getBillingTime(), billingEvent.getBillingTime(),
billingEvent.getClientId(), billingEvent.getRegistrarId(),
billingEvent.createVKey()); 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. * <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); GracePeriod clone = clone(this);
clone.domainRepoId = checkArgumentNotNull(domainRepoId); clone.domainRepoId = checkArgumentNotNull(domainRepoId);
return clone; return clone;

View file

@ -91,7 +91,7 @@ public class GracePeriodBase extends ImmutableObject {
return expirationTime; return expirationTime;
} }
public String getClientId() { public String getRegistrarId() {
return clientId; return clientId;
} }

View file

@ -70,16 +70,16 @@ public class HostResource extends HostBase
} }
public Builder copyFrom(HostBase hostBase) { public Builder copyFrom(HostBase hostBase) {
return this.setCreationClientId(hostBase.getCreationClientId()) return this.setCreationRegistrarId(hostBase.getCreationRegistrarId())
.setCreationTime(hostBase.getCreationTime()) .setCreationTime(hostBase.getCreationTime())
.setDeletionTime(hostBase.getDeletionTime()) .setDeletionTime(hostBase.getDeletionTime())
.setHostName(hostBase.getHostName()) .setHostName(hostBase.getHostName())
.setInetAddresses(hostBase.getInetAddresses()) .setInetAddresses(hostBase.getInetAddresses())
.setLastTransferTime(hostBase.getLastTransferTime()) .setLastTransferTime(hostBase.getLastTransferTime())
.setLastSuperordinateChange(hostBase.getLastSuperordinateChange()) .setLastSuperordinateChange(hostBase.getLastSuperordinateChange())
.setLastEppUpdateClientId(hostBase.getLastEppUpdateClientId()) .setLastEppUpdateRegistrarId(hostBase.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(hostBase.getLastEppUpdateTime()) .setLastEppUpdateTime(hostBase.getLastEppUpdateTime())
.setPersistedCurrentSponsorClientId(hostBase.getPersistedCurrentSponsorClientId()) .setPersistedCurrentSponsorRegistrarId(hostBase.getPersistedCurrentSponsorRegistrarId())
.setRepoId(hostBase.getRepoId()) .setRepoId(hostBase.getRepoId())
.setSuperordinateDomain(hostBase.getSuperordinateDomain()) .setSuperordinateDomain(hostBase.getSuperordinateDomain())
.setStatusValues(hostBase.getStatusValues()); .setStatusValues(hostBase.getStatusValues());

View file

@ -142,7 +142,7 @@ public abstract class PollMessage extends ImmutableObject
return id; return id;
} }
public String getClientId() { public String getRegistrarId() {
return clientId; return clientId;
} }
@ -219,8 +219,8 @@ public abstract class PollMessage extends ImmutableObject
return thisCastToDerived(); return thisCastToDerived();
} }
public B setClientId(String clientId) { public B setRegistrarId(String registrarId) {
getInstance().clientId = clientId; getInstance().clientId = registrarId;
return thisCastToDerived(); return thisCastToDerived();
} }
@ -441,8 +441,8 @@ public abstract class PollMessage extends ImmutableObject
transferResponse = transferResponse =
new ContactTransferResponse.Builder() new ContactTransferResponse.Builder()
.setContactId(contactId) .setContactId(contactId)
.setGainingClientId(transferResponse.getGainingClientId()) .setGainingRegistrarId(transferResponse.getGainingRegistrarId())
.setLosingClientId(transferResponse.getLosingClientId()) .setLosingRegistrarId(transferResponse.getLosingRegistrarId())
.setTransferStatus(transferResponse.getTransferStatus()) .setTransferStatus(transferResponse.getTransferStatus())
.setTransferRequestTime(transferResponse.getTransferRequestTime()) .setTransferRequestTime(transferResponse.getTransferRequestTime())
.setPendingTransferExpirationTime( .setPendingTransferExpirationTime(
@ -453,8 +453,8 @@ public abstract class PollMessage extends ImmutableObject
transferResponse = transferResponse =
new DomainTransferResponse.Builder() new DomainTransferResponse.Builder()
.setFullyQualifiedDomainName(fullyQualifiedDomainName) .setFullyQualifiedDomainName(fullyQualifiedDomainName)
.setGainingClientId(transferResponse.getGainingClientId()) .setGainingRegistrarId(transferResponse.getGainingRegistrarId())
.setLosingClientId(transferResponse.getLosingClientId()) .setLosingRegistrarId(transferResponse.getLosingRegistrarId())
.setTransferStatus(transferResponse.getTransferStatus()) .setTransferStatus(transferResponse.getTransferStatus())
.setTransferRequestTime(transferResponse.getTransferRequestTime()) .setTransferRequestTime(transferResponse.getTransferRequestTime())
.setPendingTransferExpirationTime( .setPendingTransferExpirationTime(

View file

@ -222,14 +222,15 @@ public class Registrar extends ImmutableObject
comparing(RegistrarContact::getEmailAddress, String::compareTo); 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 * <p>The supplier's get() method enters a transactionless context briefly to avoid enrolling the
* query inside an unrelated client-affecting transaction. * 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( memoizeWithShortExpiration(
() -> tm().doTransactionless(() -> Maps.uniqueIndex(loadAll(), Registrar::getClientId))); () ->
tm().doTransactionless(() -> Maps.uniqueIndex(loadAll(), Registrar::getRegistrarId)));
@Parent @Transient Key<EntityGroupRoot> parent = getCrossTldKey(); @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. */ /** Whether or not registry lock is allowed for this registrar. */
boolean registryLockAllowed = false; boolean registryLockAllowed = false;
public String getClientId() { public String getRegistrarId() {
return clientIdentifier; return clientIdentifier;
} }
@ -764,13 +765,13 @@ public class Registrar extends ImmutableObject
super(instance); super(instance);
} }
public Builder setClientId(String clientId) { public Builder setRegistrarId(String registrarId) {
// Client id must be [3,16] chars long. See "clIDType" in the base EPP schema of RFC 5730. // 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.) // (Need to validate this here as there's no matching EPP XSD for validation.)
checkArgument( checkArgument(
Range.closed(3, 16).contains(clientId.length()), Range.closed(3, 16).contains(registrarId.length()),
"Client identifier must be 3-16 characters long."); "Registrar ID must be 3-16 characters long.");
getInstance().clientIdentifier = clientId; getInstance().clientIdentifier = registrarId;
return this; return this;
} }
@ -1026,40 +1027,40 @@ public class Registrar extends ImmutableObject
/** Loads all registrar entities using an in-memory cache. */ /** Loads all registrar entities using an in-memory cache. */
public static Iterable<Registrar> loadAllCached() { 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. */ /** Loads all registrar keys using an in-memory cache. */
public static ImmutableSet<VKey<Registrar>> loadAllKeysCached() { 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) .map(Registrar::createVKey)
.collect(toImmutableSet()); .collect(toImmutableSet());
} }
/** Loads and returns a registrar entity by its client id directly from Datastore. */ /** Loads and returns a registrar entity by its id directly from Datastore. */
public static Optional<Registrar> loadByClientId(String clientId) { public static Optional<Registrar> loadByRegistrarId(String registrarId) {
checkArgument(!Strings.isNullOrEmpty(clientId), "clientId must be specified"); checkArgument(!Strings.isNullOrEmpty(registrarId), "registrarId must be specified");
return transactIfJpaTm(() -> tm().loadByKeyIfPresent(createVKey(clientId))); 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. * <p>Returns empty if the registrar isn't found.
*/ */
public static Optional<Registrar> loadByClientIdCached(String clientId) { public static Optional<Registrar> loadByRegistrarIdCached(String registrarId) {
checkArgument(!Strings.isNullOrEmpty(clientId), "clientId must be specified"); checkArgument(!Strings.isNullOrEmpty(registrarId), "registrarId must be specified");
return Optional.ofNullable(CACHE_BY_CLIENT_ID.get().get(clientId)); 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. * <p>Throws if the registrar isn't found.
*/ */
public static Registrar loadRequiredRegistrarCached(String clientId) { public static Registrar loadRequiredRegistrarCached(String registrarId) {
Optional<Registrar> registrar = loadByClientIdCached(clientId); Optional<Registrar> registrar = loadByRegistrarIdCached(registrarId);
checkArgument(registrar.isPresent(), "couldn't find registrar '%s'", clientId); checkArgument(registrar.isPresent(), "couldn't find registrar '%s'", registrarId);
return registrar.get(); return registrar.get();
} }
} }

View file

@ -229,7 +229,7 @@ public class RegistrarContact extends ImmutableObject
.query( .query(
"DELETE FROM RegistrarPoc WHERE registrarId = :registrarId AND " "DELETE FROM RegistrarPoc WHERE registrarId = :registrarId AND "
+ "emailAddress NOT IN :emailAddressesToKeep") + "emailAddress NOT IN :emailAddressesToKeep")
.setParameter("registrarId", registrar.getClientId()) .setParameter("registrarId", registrar.getRegistrarId())
.setParameter("emailAddressesToKeep", emailAddressesToKeep) .setParameter("emailAddressesToKeep", emailAddressesToKeep)
.executeUpdate(); .executeUpdate();
} }

View file

@ -260,11 +260,11 @@ public class HistoryEntry extends ImmutableObject implements Buildable, Datastor
return modificationTime; return modificationTime;
} }
public String getClientId() { public String getRegistrarId() {
return clientId; return clientId;
} }
public String getOtherClientId() { public String getOtherRegistrarId() {
return otherClientId; return otherClientId;
} }
@ -489,13 +489,13 @@ public class HistoryEntry extends ImmutableObject implements Buildable, Datastor
return thisCastToDerived(); return thisCastToDerived();
} }
public B setClientId(String clientId) { public B setRegistrarId(String registrarId) {
getInstance().clientId = clientId; getInstance().clientId = registrarId;
return thisCastToDerived(); return thisCastToDerived();
} }
public B setOtherClientId(String otherClientId) { public B setOtherRegistrarId(String otherRegistrarId) {
getInstance().otherClientId = otherClientId; getInstance().otherClientId = otherRegistrarId;
return thisCastToDerived(); return thisCastToDerived();
} }

View file

@ -64,7 +64,7 @@ public abstract class BaseTransferObject extends ImmutableObject {
return transferStatus; return transferStatus;
} }
public String getGainingClientId() { public String getGainingRegistrarId() {
return gainingClientId; return gainingClientId;
} }
@ -72,7 +72,7 @@ public abstract class BaseTransferObject extends ImmutableObject {
return transferRequestTime; return transferRequestTime;
} }
public String getLosingClientId() { public String getLosingRegistrarId() {
return losingClientId; return losingClientId;
} }
@ -99,8 +99,8 @@ public abstract class BaseTransferObject extends ImmutableObject {
} }
/** Set the gaining registrar for a pending transfer on this resource. */ /** Set the gaining registrar for a pending transfer on this resource. */
public B setGainingClientId(String gainingClientId) { public B setGainingRegistrarId(String gainingRegistrarId) {
getInstance().gainingClientId = gainingClientId; getInstance().gainingClientId = gainingRegistrarId;
return thisCastToDerived(); return thisCastToDerived();
} }
@ -111,8 +111,8 @@ public abstract class BaseTransferObject extends ImmutableObject {
} }
/** Set the losing registrar for a pending transfer on this resource. */ /** Set the losing registrar for a pending transfer on this resource. */
public B setLosingClientId(String losingClientId) { public B setLosingRegistrarId(String losingRegistrarId) {
getInstance().losingClientId = losingClientId; getInstance().losingClientId = losingRegistrarId;
return thisCastToDerived(); return thisCastToDerived();
} }

View file

@ -142,8 +142,8 @@ public abstract class TransferData<
newBuilder newBuilder
.setTransferRequestTrid(this.transferRequestTrid) .setTransferRequestTrid(this.transferRequestTrid)
.setTransferRequestTime(this.transferRequestTime) .setTransferRequestTime(this.transferRequestTime)
.setGainingClientId(this.gainingClientId) .setGainingRegistrarId(this.gainingClientId)
.setLosingClientId(this.losingClientId); .setLosingRegistrarId(this.losingClientId);
return newBuilder; return newBuilder;
} }

View file

@ -35,7 +35,7 @@ public abstract class EppMetric {
public abstract Optional<String> getCommandName(); public abstract Optional<String> getCommandName();
public abstract Optional<String> getClientId(); public abstract Optional<String> getRegistrarId();
public abstract Optional<String> getTld(); public abstract Optional<String> getTld();
@ -78,9 +78,9 @@ public abstract class EppMetric {
return setCommandName(flowSimpleClassName.replaceFirst("Flow$", "")); 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); public abstract Builder setTld(String tld);

View file

@ -201,8 +201,8 @@ public abstract class RdapActionBase implements Runnable {
* eligible to see deleted information. Admins can see all deleted information, while * 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 * 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 * 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 * registrar request, the caller must still verify that the registrar can see each particular item
* item by calling {@link RdapAuthorization#isAuthorizedForClientId}. * by calling {@link RdapAuthorization#isAuthorizedForRegistrar}.
*/ */
boolean shouldIncludeDeleted() { boolean shouldIncludeDeleted() {
// If includeDeleted is not specified, or set to false, we don't need to go any further. // 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 // 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 // or have access to at least one registrar's data
return rdapAuthorization.role() == RdapAuthorization.Role.ADMINISTRATOR return rdapAuthorization.role() == RdapAuthorization.Role.ADMINISTRATOR
|| !rdapAuthorization.clientIds().isEmpty(); || !rdapAuthorization.registrarIds().isEmpty();
} }
DeletedItemHandling getDeletedItemHandling() { DeletedItemHandling getDeletedItemHandling() {
@ -228,8 +228,8 @@ public abstract class RdapActionBase implements Runnable {
boolean isAuthorized(EppResource eppResource) { boolean isAuthorized(EppResource eppResource) {
return getRequestTime().isBefore(eppResource.getDeletionTime()) return getRequestTime().isBefore(eppResource.getDeletionTime())
|| (shouldIncludeDeleted() || (shouldIncludeDeleted()
&& rdapAuthorization.isAuthorizedForClientId( && rdapAuthorization.isAuthorizedForRegistrar(
eppResource.getPersistedCurrentSponsorClientId())); eppResource.getPersistedCurrentSponsorRegistrarId()));
} }
/** /**
@ -241,7 +241,7 @@ public abstract class RdapActionBase implements Runnable {
boolean isAuthorized(Registrar registrar) { boolean isAuthorized(Registrar registrar) {
return (registrar.isLiveAndPubliclyVisible() return (registrar.isLiveAndPubliclyVisible()
|| (shouldIncludeDeleted() || (shouldIncludeDeleted()
&& rdapAuthorization.isAuthorizedForClientId(registrar.getClientId()))); && rdapAuthorization.isAuthorizedForRegistrar(registrar.getRegistrarId())));
} }
String canonicalizeName(String name) { String canonicalizeName(String name) {

View file

@ -32,22 +32,22 @@ public abstract class RdapAuthorization extends ImmutableObject {
public abstract Role role(); public abstract Role role();
/** The registrar client IDs for which access is granted (used only if the role is REGISTRAR. */ /** 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) { static RdapAuthorization create(Role role, String registrarId) {
return new AutoValue_RdapAuthorization(role, ImmutableSet.of(clientId)); return new AutoValue_RdapAuthorization(role, ImmutableSet.of(registrarId));
} }
static RdapAuthorization create(Role role, ImmutableSet<String> clientIds) { static RdapAuthorization create(Role role, ImmutableSet<String> clientIds) {
return new AutoValue_RdapAuthorization(role, clientIds); return new AutoValue_RdapAuthorization(role, clientIds);
} }
boolean isAuthorizedForClientId(String clientId) { boolean isAuthorizedForRegistrar(String registrarId) {
switch (role()) { switch (role()) {
case ADMINISTRATOR: case ADMINISTRATOR:
return true; return true;
case REGISTRAR: case REGISTRAR:
return clientIds().contains(clientId); return registrarIds().contains(registrarId);
default: default:
return false; return false;
} }

View file

@ -392,7 +392,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
partialStringQuery.getInitialString(), partialStringQuery.getInitialString(),
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime()); shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
return (!host.isPresent() return (!host.isPresent()
|| !desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorClientId())) || !desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorRegistrarId()))
? ImmutableList.of() ? ImmutableList.of()
: ImmutableList.of(host.get().createVKey()); : ImmutableList.of(host.get().createVKey());
} else { } else {
@ -434,7 +434,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
fqhn, fqhn,
shouldIncludeDeleted() ? START_OF_TIME : getRequestTime()); shouldIncludeDeleted() ? START_OF_TIME : getRequestTime());
if (host.isPresent() if (host.isPresent()
&& desiredRegistrar.get().equals(host.get().getPersistedCurrentSponsorClientId())) { && desiredRegistrar
.get()
.equals(host.get().getPersistedCurrentSponsorRegistrarId())) {
builder.add(host.get().createVKey()); builder.add(host.get().createVKey());
} }
} else { } else {

View file

@ -272,7 +272,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
DeletedItemHandling.EXCLUDE, DeletedItemHandling.EXCLUDE,
rdapResultSetMaxSize + 1); rdapResultSetMaxSize + 1);
if (!rdapAuthorization.role().equals(Role.ADMINISTRATOR)) { 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); resultSet = getMatchingResources(query, false, rdapResultSetMaxSize + 1);
} else { } else {
@ -290,7 +290,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
if (!rdapAuthorization.role().equals(Role.ADMINISTRATOR)) { if (!rdapAuthorization.role().equals(Role.ADMINISTRATOR)) {
builder = builder =
builder.whereFieldIsIn( builder.whereFieldIsIn(
"currentSponsorClientId", rdapAuthorization.clientIds()); "currentSponsorClientId", rdapAuthorization.registrarIds());
} }
return getMatchingResourcesSql(builder, false, rdapResultSetMaxSize + 1); return getMatchingResourcesSql(builder, false, rdapResultSetMaxSize + 1);
}); });

View file

@ -288,7 +288,7 @@ public class RdapJsonFormatter {
Event.builder() Event.builder()
.setEventAction(EventAction.REGISTRATION) .setEventAction(EventAction.REGISTRATION)
.setEventActor( .setEventActor(
Optional.ofNullable(domainBase.getCreationClientId()).orElse("(none)")) Optional.ofNullable(domainBase.getCreationRegistrarId()).orElse("(none)"))
.setEventDate(domainBase.getCreationTime()) .setEventDate(domainBase.getCreationTime())
.build(), .build(),
Event.builder() Event.builder()
@ -307,7 +307,7 @@ public class RdapJsonFormatter {
// //
// See {@link createRdapRegistrarEntity} for details of section 2.4 conformance // See {@link createRdapRegistrarEntity} for details of section 2.4 conformance
Registrar registrar = Registrar registrar =
Registrar.loadRequiredRegistrarCached(domainBase.getCurrentSponsorClientId()); Registrar.loadRequiredRegistrarCached(domainBase.getCurrentSponsorRegistrarId());
builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL)); builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL));
// RDAP Technical Implementation Guide 3.2: must have link to the registrar's RDAP URL for this // RDAP Technical Implementation Guide 3.2: must have link to the registrar's RDAP URL for this
// domain, with rel=related. // 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 // RDAP Response Profile 4.3 - Registrar member is optional, so we only set it for FULL
if (outputDataType == OutputDataType.FULL) { if (outputDataType == OutputDataType.FULL) {
Registrar registrar = Registrar registrar =
Registrar.loadRequiredRegistrarCached(hostResource.getPersistedCurrentSponsorClientId()); Registrar.loadRequiredRegistrarCached(
hostResource.getPersistedCurrentSponsorRegistrarId());
builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL)); builder.entitiesBuilder().add(createRdapRegistrarEntity(registrar, OutputDataType.INTERNAL));
} }
if (outputDataType != OutputDataType.INTERNAL) { if (outputDataType != OutputDataType.INTERNAL) {
@ -490,7 +491,7 @@ public class RdapJsonFormatter {
// //
// 2.8 allows for unredacted output for authorized people. // 2.8 allows for unredacted output for authorized people.
boolean isAuthorized = 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 // ROID needs to be redacted if we aren't authorized, so we can't have a self-link for
// unauthorized users // unauthorized users
@ -741,7 +742,7 @@ public class RdapJsonFormatter {
.noneMatch(contact -> contact.roles().contains(RdapEntity.Role.ABUSE))) { .noneMatch(contact -> contact.roles().contains(RdapEntity.Role.ABUSE))) {
logger.atWarning().log( logger.atWarning().log(
"Registrar '%s' (IANA ID %s) is missing ABUSE contact", "Registrar '%s' (IANA ID %s) is missing ABUSE contact",
registrar.getClientId(), registrar.getIanaIdentifier()); registrar.getRegistrarId(), registrar.getIanaIdentifier());
} }
builder.entitiesBuilder().addAll(registrarContacts); builder.entitiesBuilder().addAll(registrarContacts);
} }
@ -910,7 +911,7 @@ public class RdapJsonFormatter {
eventsBuilder.add( eventsBuilder.add(
Event.builder() Event.builder()
.setEventAction(rdapEventAction) .setEventAction(rdapEventAction)
.setEventActor(historyEntry.getClientId()) .setEventActor(historyEntry.getRegistrarId())
.setEventDate(modificationTime) .setEventDate(modificationTime)
.build()); .build());
// The last change time might not be the lastEppUpdateTime, since some changes happen without // The last change time might not be the lastEppUpdateTime, since some changes happen without

View file

@ -125,7 +125,7 @@ public abstract class RdapSearchActionBase extends RdapActionBase {
protected boolean shouldBeVisible(EppResource eppResource) { protected boolean shouldBeVisible(EppResource eppResource) {
return isAuthorized(eppResource) return isAuthorized(eppResource)
&& (!registrarParam.isPresent() && (!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) { protected boolean shouldBeVisible(Registrar registrar) {
return isAuthorized(registrar) return isAuthorized(registrar)
&& (!registrarParam.isPresent() || registrarParam.get().equals(registrar.getClientId())); && (!registrarParam.isPresent() || registrarParam.get().equals(registrar.getRegistrarId()));
} }
/** /**

View file

@ -216,12 +216,12 @@ public final class UpdateRegistrarRdapBaseUrlsAction implements Runnable {
if (registrar.getRdapBaseUrls().equals(baseUrls)) { if (registrar.getRdapBaseUrls().equals(baseUrls)) {
logger.atInfo().log( logger.atInfo().log(
"No change in RdapBaseUrls for registrar %s (ianaId %s)", "No change in RdapBaseUrls for registrar %s (ianaId %s)",
registrar.getClientId(), ianaId); registrar.getRegistrarId(), ianaId);
return; return;
} }
logger.atInfo().log( logger.atInfo().log(
"Updating RdapBaseUrls for registrar %s (ianaId %s) from %s to %s", "Updating RdapBaseUrls for registrar %s (ianaId %s) from %s to %s",
registrar.getClientId(), registrar.getRegistrarId(),
ianaId, ianaId,
registrar.getRdapBaseUrls(), registrar.getRdapBaseUrls(),
baseUrls); baseUrls);

View file

@ -63,9 +63,9 @@ final class ContactResourceToXjcConverter {
bean.getPostalInfos().add(convertPostalInfo(internationalizedPostalInfo)); bean.getPostalInfos().add(convertPostalInfo(internationalizedPostalInfo));
} }
bean.setId(model.getContactId()); bean.setId(model.getContactId());
bean.setClID(model.getCurrentSponsorClientId()); bean.setClID(model.getCurrentSponsorRegistrarId());
bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null)); bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null)); bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null));
bean.setCrDate(model.getCreationTime()); bean.setCrDate(model.getCreationTime());
bean.setUpDate(model.getLastEppUpdateTime()); bean.setUpDate(model.getLastEppUpdateTime());
bean.setTrDate(model.getLastTransferTime()); bean.setTrDate(model.getLastTransferTime());
@ -112,8 +112,8 @@ final class ContactResourceToXjcConverter {
private static XjcRdeContactTransferDataType convertTransferData(TransferData model) { private static XjcRdeContactTransferDataType convertTransferData(TransferData model) {
XjcRdeContactTransferDataType bean = new XjcRdeContactTransferDataType(); XjcRdeContactTransferDataType bean = new XjcRdeContactTransferDataType();
bean.setTrStatus(XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName())); bean.setTrStatus(XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName()));
bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingClientId())); bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingRegistrarId()));
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId())); bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingRegistrarId()));
bean.setReDate(model.getTransferRequestTime()); bean.setReDate(model.getTransferRequestTime());
bean.setAcDate(model.getPendingTransferExpirationTime()); bean.setAcDate(model.getPendingTransferExpirationTime());
return bean; return bean;

View file

@ -91,12 +91,12 @@ final class DomainBaseToXjcConverter {
// o A <clID> element that contains the identifier of the sponsoring // o A <clID> element that contains the identifier of the sponsoring
// registrar. // registrar.
bean.setClID(model.getCurrentSponsorClientId()); bean.setClID(model.getCurrentSponsorRegistrarId());
// o A <crRr> element that contains the identifier of the registrar // o A <crRr> element that contains the identifier of the registrar
// that created the domain name object. An OPTIONAL client attribute // that created the domain name object. An OPTIONAL client attribute
// is used to specify the client that performed the operation. // 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 // o An OPTIONAL <crDate> element that contains the date and time of
// the domain name object creation. This element MUST be present if // 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 // MUST NOT be present if the domain has never been modified. An
// OPTIONAL client attribute is used to specify the client that // OPTIONAL client attribute is used to specify the client that
// performed the operation. // 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 // o An OPTIONAL <trDate> element that contains the date and time of
// the most recent domain object successful transfer. This element // the most recent domain object successful transfer. This element
@ -254,9 +254,8 @@ final class DomainBaseToXjcConverter {
} }
private static boolean hasGainingAndLosingRegistrars(DomainBase model) { private static boolean hasGainingAndLosingRegistrars(DomainBase model) {
return return !Strings.isNullOrEmpty(model.getTransferData().getGainingRegistrarId())
!Strings.isNullOrEmpty(model.getTransferData().getGainingClientId()) && !Strings.isNullOrEmpty(model.getTransferData().getLosingRegistrarId());
&& !Strings.isNullOrEmpty(model.getTransferData().getLosingClientId());
} }
/** Converts {@link TransferData} to {@link XjcRdeDomainTransferDataType}. */ /** Converts {@link TransferData} to {@link XjcRdeDomainTransferDataType}. */
@ -264,8 +263,8 @@ final class DomainBaseToXjcConverter {
XjcRdeDomainTransferDataType bean = new XjcRdeDomainTransferDataType(); XjcRdeDomainTransferDataType bean = new XjcRdeDomainTransferDataType();
bean.setTrStatus( bean.setTrStatus(
XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName())); XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName()));
bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingClientId())); bean.setReRr(RdeUtil.makeXjcRdeRrType(model.getGainingRegistrarId()));
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId())); bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingRegistrarId()));
bean.setReDate(model.getTransferRequestTime()); bean.setReDate(model.getTransferRequestTime());
bean.setAcDate(model.getPendingTransferExpirationTime()); bean.setAcDate(model.getPendingTransferExpirationTime());
bean.setExDate(model.getTransferredRegistrationExpirationTime()); bean.setExDate(model.getTransferredRegistrationExpirationTime());

View file

@ -47,9 +47,10 @@ final class HostResourceToXjcConverter {
/** Converts {@link HostResource} to {@link XjcRdeHost}. */ /** Converts {@link HostResource} to {@link XjcRdeHost}. */
static XjcRdeHost convertSubordinateHost(HostResource model, DomainBase superordinateDomain) { static XjcRdeHost convertSubordinateHost(HostResource model, DomainBase superordinateDomain) {
XjcRdeHost bean = convertHostCommon( XjcRdeHost bean =
convertHostCommon(
model, model,
superordinateDomain.getCurrentSponsorClientId(), superordinateDomain.getCurrentSponsorRegistrarId(),
model.computeLastTransferTime(superordinateDomain)); model.computeLastTransferTime(superordinateDomain));
if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) { if (superordinateDomain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
bean.getStatuses().add(convertStatusValue(StatusValue.PENDING_TRANSFER)); bean.getStatuses().add(convertStatusValue(StatusValue.PENDING_TRANSFER));
@ -60,22 +61,20 @@ final class HostResourceToXjcConverter {
/** Converts {@link HostResource} to {@link XjcRdeHost}. */ /** Converts {@link HostResource} to {@link XjcRdeHost}. */
static XjcRdeHost convertExternalHost(HostResource model) { static XjcRdeHost convertExternalHost(HostResource model) {
return convertHostCommon( return convertHostCommon(
model, model, model.getPersistedCurrentSponsorRegistrarId(), model.getLastTransferTime());
model.getPersistedCurrentSponsorClientId(),
model.getLastTransferTime());
} }
private static XjcRdeHost convertHostCommon( private static XjcRdeHost convertHostCommon(
HostResource model, String clientId, DateTime lastTransferTime) { HostResource model, String registrarId, DateTime lastTransferTime) {
XjcRdeHost bean = new XjcRdeHost(); XjcRdeHost bean = new XjcRdeHost();
bean.setName(model.getHostName()); bean.setName(model.getHostName());
bean.setRoid(model.getRepoId()); bean.setRoid(model.getRepoId());
bean.setCrDate(model.getCreationTime()); bean.setCrDate(model.getCreationTime());
bean.setUpDate(model.getLastEppUpdateTime()); bean.setUpDate(model.getLastEppUpdateTime());
bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null)); bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateClientId(), null)); bean.setUpRr(RdeAdapter.convertRr(model.getLastEppUpdateRegistrarId(), null));
bean.setCrRr(RdeAdapter.convertRr(model.getCreationClientId(), null)); bean.setCrRr(RdeAdapter.convertRr(model.getCreationRegistrarId(), null));
bean.setClID(clientId); bean.setClID(registrarId);
bean.setTrDate(lastTransferTime); bean.setTrDate(lastTransferTime);
for (StatusValue status : model.getStatusValues()) { for (StatusValue status : model.getStatusValues()) {
// TODO(b/34844887): Remove when PENDING_TRANSFER is not persisted on host resources. // TODO(b/34844887): Remove when PENDING_TRANSFER is not persisted on host resources.

View file

@ -88,9 +88,9 @@ public final class RdeStagingMapper extends Mapper<EppResource, PendingDeposit,
} }
// Skip prober data. // Skip prober data.
if (nullToEmpty(resource.getCreationClientId()).startsWith("prober-") if (nullToEmpty(resource.getCreationRegistrarId()).startsWith("prober-")
|| nullToEmpty(resource.getPersistedCurrentSponsorClientId()).startsWith("prober-") || nullToEmpty(resource.getPersistedCurrentSponsorRegistrarId()).startsWith("prober-")
|| nullToEmpty(resource.getLastEppUpdateClientId()).startsWith("prober-")) { || nullToEmpty(resource.getLastEppUpdateRegistrarId()).startsWith("prober-")) {
getContext().incrementCounter("prober data skipped"); getContext().incrementCounter("prober data skipped");
return; return;
} }

View file

@ -83,9 +83,9 @@ public final class RdeUtil {
return BaseEncoding.base32().omitPadding().encode(bytes); return BaseEncoding.base32().omitPadding().encode(bytes);
} }
static XjcRdeRrType makeXjcRdeRrType(String clientId) { static XjcRdeRrType makeXjcRdeRrType(String registrarId) {
XjcRdeRrType bean = new XjcRdeRrType(); XjcRdeRrType bean = new XjcRdeRrType();
bean.setValue(clientId); bean.setValue(registrarId);
return bean; return bean;
} }

View file

@ -61,7 +61,7 @@ final class RegistrarToXjcConverter {
// the registrar object. This <id> has a superordinate relationship // the registrar object. This <id> has a superordinate relationship
// to a subordinate <clID>, <crRr> or <upRr> of domain, contact and // to a subordinate <clID>, <crRr> or <upRr> of domain, contact and
// host objects. // host objects.
bean.setId(model.getClientId()); bean.setId(model.getRegistrarId());
// o An <name> element that contains the name of the registrar. // o An <name> element that contains the name of the registrar.
bean.setName(model.getRegistrarName()); bean.setName(model.getRegistrarName());

View file

@ -103,7 +103,7 @@ public final class CopyDetailReportsAction implements Runnable {
// The standard report format is "invoice_details_yyyy-MM_registrarId_tld.csv // The standard report format is "invoice_details_yyyy-MM_registrarId_tld.csv
// TODO(larryruili): Determine a safer way of enforcing this. // TODO(larryruili): Determine a safer way of enforcing this.
String registrarId = Iterables.get(Splitter.on('_').split(detailReportName), 3); String registrarId = Iterables.get(Splitter.on('_').split(detailReportName), 3);
Optional<Registrar> registrar = Registrar.loadByClientId(registrarId); Optional<Registrar> registrar = Registrar.loadByRegistrarId(registrarId);
if (!registrar.isPresent()) { if (!registrar.isPresent()) {
logger.atWarning().log( logger.atWarning().log(
"Registrar %s not found in database for file %s", registrar, detailReportName); "Registrar %s not found in database for file %s", registrar, detailReportName);

View file

@ -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. // Attempt to use the registrar's WHOIS abuse contact, then fall back to the regular address.
Registrar registrar = Registrar registrar =
Registrar.loadByClientIdCached(clientId) Registrar.loadByRegistrarIdCached(registrarId)
.orElseThrow( .orElseThrow(
() -> () ->
new IllegalArgumentException( new IllegalArgumentException(
String.format("Could not find registrar %s", clientId))); String.format("Could not find registrar %s", registrarId)));
return new InternetAddress( return new InternetAddress(
registrar registrar
.getWhoisAbuseContact() .getWhoisAbuseContact()

Some files were not shown because too many files have changed in this diff Show more