mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +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
|
@ -110,25 +110,29 @@ public class RdapJsonFormatterTest {
|
|||
"(◕‿◕)",
|
||||
"lol@cat.みんな",
|
||||
null,
|
||||
clock.nowUtc().minusYears(1));
|
||||
clock.nowUtc().minusYears(1),
|
||||
registrar);
|
||||
contactResourceAdmin = makeAndPersistContactResource(
|
||||
"8372808-IRL",
|
||||
"Santa Claus",
|
||||
null,
|
||||
ImmutableList.of("Santa Claus Tower", "41st floor", "Suite みんな"),
|
||||
clock.nowUtc().minusYears(2));
|
||||
clock.nowUtc().minusYears(2),
|
||||
registrar);
|
||||
contactResourceTech = makeAndPersistContactResource(
|
||||
"8372808-TRL",
|
||||
"The Raven",
|
||||
"bog@cat.みんな",
|
||||
ImmutableList.of("Chamber Door", "upper level"),
|
||||
clock.nowUtc().minusYears(3));
|
||||
clock.nowUtc().minusYears(3),
|
||||
registrar);
|
||||
contactResourceNotLinked = makeAndPersistContactResource(
|
||||
"8372808-QRL",
|
||||
"The Wizard",
|
||||
"dog@cat.みんな",
|
||||
ImmutableList.of("Somewhere", "Over the Rainbow"),
|
||||
clock.nowUtc().minusYears(4));
|
||||
clock.nowUtc().minusYears(4),
|
||||
registrar);
|
||||
hostResourceIpv4 = makeAndPersistHostResource(
|
||||
"ns1.cat.みんな", "1.2.3.4", clock.nowUtc().minusYears(1));
|
||||
hostResourceIpv6 = makeAndPersistHostResource(
|
||||
|
@ -365,7 +369,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_registrant.json"));
|
||||
}
|
||||
|
||||
|
@ -379,10 +384,26 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.SUMMARY))
|
||||
OutputDataType.SUMMARY,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_registrant_summary.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrant_loggedOut() throws Exception {
|
||||
assertThat(
|
||||
rdapJsonFormatter.makeRdapJsonForContact(
|
||||
contactResourceRegistrant,
|
||||
false,
|
||||
Optional.of(DesignatedContact.Type.REGISTRANT),
|
||||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL,
|
||||
Optional.<String>absent()))
|
||||
.isEqualTo(loadJson("rdapjson_registrant_logged_out.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegistrant_baseHasNoTrailingSlash() throws Exception {
|
||||
assertThat(
|
||||
|
@ -393,7 +414,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE_NO_TRAILING_SLASH,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_registrant.json"));
|
||||
}
|
||||
|
||||
|
@ -407,7 +429,8 @@ public class RdapJsonFormatterTest {
|
|||
null,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_registrant_nobase.json"));
|
||||
}
|
||||
|
||||
|
@ -421,7 +444,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_admincontact.json"));
|
||||
}
|
||||
|
||||
|
@ -435,7 +459,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_techcontact.json"));
|
||||
}
|
||||
|
||||
|
@ -449,7 +474,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_rolelesscontact.json"));
|
||||
}
|
||||
|
||||
|
@ -463,7 +489,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_unlinkedcontact.json"));
|
||||
}
|
||||
|
||||
|
@ -475,7 +502,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_domain_full.json"));
|
||||
}
|
||||
|
||||
|
@ -487,10 +515,24 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.SUMMARY))
|
||||
OutputDataType.SUMMARY,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_domain_summary.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomain_logged_out() throws Exception {
|
||||
assertThat(rdapJsonFormatter.makeRdapJsonForDomain(
|
||||
domainResourceFull,
|
||||
false,
|
||||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL,
|
||||
Optional.<String>absent()))
|
||||
.isEqualTo(loadJson("rdapjson_domain_logged_out.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomain_noNameservers() throws Exception {
|
||||
assertThat(rdapJsonFormatter.makeRdapJsonForDomain(
|
||||
|
@ -499,7 +541,8 @@ public class RdapJsonFormatterTest {
|
|||
LINK_BASE,
|
||||
WHOIS_SERVER,
|
||||
clock.nowUtc(),
|
||||
OutputDataType.FULL))
|
||||
OutputDataType.FULL,
|
||||
Optional.of("unicoderegistrar")))
|
||||
.isEqualTo(loadJson("rdapjson_domain_no_nameservers.json"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue