mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Avoid showing personal contact data in RDAP when not logged in
This CL changes the RDAP responses. When the requester asks for information about a domain, and is not logged in as the owning registrar, no contact information is shown. When the requester asks for information about a contact, and is not logged in as the owner registrar, the existence of the contact is shown, but not any personal data (the existence is shown to make things easier to test). The login uses the same functionality as the registrar console. For the most part, this CL does not include the necessary tests to make sure that data is not returned when not logged in. The CL is so large that I didn't want to burden it further. Those tests will be added in a follow-on CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=168022034
This commit is contained in:
parent
e892a2f0fe
commit
c85dc0c089
23 changed files with 853 additions and 266 deletions
|
@ -163,11 +163,21 @@ public final class FullFieldsTestEntityHelper {
|
|||
public static ContactResource makeContactResource(
|
||||
String id, String name, @Nullable String email) {
|
||||
return makeContactResource(
|
||||
id, name, email, ImmutableList.of("123 Example Boulevard <script>"));
|
||||
id, name, email, ImmutableList.of("123 Example Boulevard <script>"), null);
|
||||
}
|
||||
|
||||
public static ContactResource makeContactResource(
|
||||
String id, String name, @Nullable String email, @Nullable List<String> street) {
|
||||
String id, String name, @Nullable String email, @Nullable Registrar registrar) {
|
||||
return makeContactResource(
|
||||
id, name, email, ImmutableList.of("123 Example Boulevard <script>"), registrar);
|
||||
}
|
||||
|
||||
public static ContactResource makeContactResource(
|
||||
String id,
|
||||
String name,
|
||||
@Nullable String email,
|
||||
@Nullable List<String> street,
|
||||
@Nullable Registrar registrar) {
|
||||
PostalInfo.Builder postalBuilder = new PostalInfo.Builder()
|
||||
.setType(PostalInfo.Type.INTERNATIONALIZED)
|
||||
.setName(name)
|
||||
|
@ -197,13 +207,27 @@ public final class FullFieldsTestEntityHelper {
|
|||
if (email != null) {
|
||||
builder.setEmailAddress(email);
|
||||
}
|
||||
if (registrar != null) {
|
||||
builder
|
||||
.setCreationClientId(registrar.getClientId())
|
||||
.setPersistedCurrentSponsorClientId(registrar.getClientId());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static ContactResource makeAndPersistContactResource(
|
||||
String id, String name, @Nullable String email, @Nullable DateTime creationTime) {
|
||||
String id,
|
||||
String name,
|
||||
@Nullable String email,
|
||||
@Nullable DateTime creationTime,
|
||||
@Nullable Registrar registrar) {
|
||||
return makeAndPersistContactResource(
|
||||
id, name, email, ImmutableList.of("123 Example Boulevard <script>"), creationTime);
|
||||
id,
|
||||
name,
|
||||
email,
|
||||
ImmutableList.of("123 Example Boulevard <script>"),
|
||||
creationTime,
|
||||
registrar);
|
||||
}
|
||||
|
||||
public static ContactResource makeAndPersistContactResource(
|
||||
|
@ -212,7 +236,18 @@ public final class FullFieldsTestEntityHelper {
|
|||
@Nullable String email,
|
||||
@Nullable List<String> street,
|
||||
@Nullable DateTime creationTime) {
|
||||
ContactResource contactResource = persistResource(makeContactResource(id, name, email, street));
|
||||
return makeAndPersistContactResource(id, name, email, street, creationTime, null);
|
||||
}
|
||||
|
||||
public static ContactResource makeAndPersistContactResource(
|
||||
String id,
|
||||
String name,
|
||||
@Nullable String email,
|
||||
@Nullable List<String> street,
|
||||
@Nullable DateTime creationTime,
|
||||
@Nullable Registrar registrar) {
|
||||
ContactResource contactResource =
|
||||
persistResource(makeContactResource(id, name, email, street, registrar));
|
||||
if (creationTime != null) {
|
||||
persistResource(makeHistoryEntry(
|
||||
contactResource, HistoryEntry.Type.CONTACT_CREATE, null, "created", creationTime));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue