Move RDAP boilerplate from remarks to notices

This is in response to decisions made by the RDAP working group regarding the
Operational Profile document:

https://docs.google.com/document/d/1h1E99GLY-8I0PfYBuANzVc3iJD1R38E6xayDYGK0pCw/edit?usp=sharing

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195251639
This commit is contained in:
mountford 2018-05-03 07:56:38 -07:00 committed by jianglai
parent d3bb808c5f
commit 3eb82ad647
27 changed files with 152 additions and 202 deletions

View file

@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableMap;
public class RdapIcannStandardInformation {
/** Required by ICANN RDAP Profile section 1.4.10. */
private static final ImmutableMap<String, Object> CONFORMANCE_REMARK =
private static final ImmutableMap<String, Object> CONFORMANCE_NOTICE =
ImmutableMap.of(
"description",
ImmutableList.of(
@ -34,7 +34,7 @@ public class RdapIcannStandardInformation {
+ " Registrars version 1.0"));
/** Required by ICANN RDAP Profile section 1.5.18. */
private static final ImmutableMap<String, Object> DOMAIN_STATUS_CODES_REMARK =
private static final ImmutableMap<String, Object> DOMAIN_STATUS_CODES_NOTICE =
ImmutableMap.of(
"title",
"EPP Status Codes",
@ -50,7 +50,7 @@ public class RdapIcannStandardInformation {
"type", "text/html")));
/** Required by ICANN RDAP Profile section 1.5.20. */
private static final ImmutableMap<String, Object> INACCURACY_COMPLAINT_FORM_REMARK =
private static final ImmutableMap<String, Object> INACCURACY_COMPLAINT_FORM_NOTICE =
ImmutableMap.of(
"description",
ImmutableList.of(
@ -63,14 +63,14 @@ public class RdapIcannStandardInformation {
"href", "https://www.icann.org/wicf",
"type", "text/html")));
/** Boilerplate remarks required by domain responses. */
static final ImmutableList<ImmutableMap<String, Object>> domainBoilerplateRemarks =
/** Boilerplate notices required by domain responses. */
static final ImmutableList<ImmutableMap<String, Object>> domainBoilerplateNotices =
ImmutableList.of(
CONFORMANCE_REMARK, DOMAIN_STATUS_CODES_REMARK, INACCURACY_COMPLAINT_FORM_REMARK);
CONFORMANCE_NOTICE, DOMAIN_STATUS_CODES_NOTICE, INACCURACY_COMPLAINT_FORM_NOTICE);
/** Boilerplate remarks required by nameserver and entity responses. */
static final ImmutableList<ImmutableMap<String, Object>> nameserverAndEntityBoilerplateRemarks =
ImmutableList.of(CONFORMANCE_REMARK);
static final ImmutableList<ImmutableMap<String, Object>> nameserverAndEntityBoilerplateNotices =
ImmutableList.of(CONFORMANCE_NOTICE);
/**
* Required by ICANN RDAP Profile section 1.4.9, as corrected by Gustavo Lozano of ICANN.

View file

@ -321,7 +321,7 @@ public class RdapJsonFormatter {
* mandates extra boilerplate for domain objects
* @param notices a list of notices to be inserted before the boilerplate notices. If the TOS
* notice is in this list, the method avoids adding a second copy.
* @param remarks a list of remarks to be inserted before the boilerplate notices.
* @param remarks a list of remarks to be inserted.
* @param rdapLinkBase the base for link URLs
*/
void addTopLevelEntries(
@ -347,24 +347,20 @@ public class RdapJsonFormatter {
if (!tosNoticeFound) {
noticesBuilder.add(tosNotice);
}
jsonBuilder.put(NOTICES, noticesBuilder.build());
ImmutableList.Builder<ImmutableMap<String, Object>> remarksBuilder =
new ImmutableList.Builder<>();
remarksBuilder.addAll(remarks);
switch (boilerplateType) {
case DOMAIN:
remarksBuilder.addAll(RdapIcannStandardInformation.domainBoilerplateRemarks);
noticesBuilder.addAll(RdapIcannStandardInformation.domainBoilerplateNotices);
break;
case NAMESERVER:
case ENTITY:
remarksBuilder.addAll(RdapIcannStandardInformation.nameserverAndEntityBoilerplateRemarks);
noticesBuilder.addAll(RdapIcannStandardInformation.nameserverAndEntityBoilerplateNotices);
break;
default: // things other than domains, nameservers and entities cannot contain remarks
default: // things other than domains, nameservers and entities do not yet have boilerplate
break;
}
ImmutableList<ImmutableMap<String, Object>> remarksToAdd = remarksBuilder.build();
if (!remarksToAdd.isEmpty()) {
jsonBuilder.put(REMARKS, remarksToAdd);
jsonBuilder.put(NOTICES, noticesBuilder.build());
if (!remarks.isEmpty()) {
jsonBuilder.put(REMARKS, remarks);
}
}

View file

@ -393,14 +393,15 @@ public class RdapDomainActionTest {
RdapTestHelper.getBuilderExcluding(
map, ImmutableSet.of("rdapConformance", "notices", "remarks"));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addNotices(
RdapTestHelper.addDomainBoilerplateNotices(
builder,
"https://example.com/rdap/",
(contactRoids == null)
? RdapTestHelper.ContactNoticeType.DOMAIN
: RdapTestHelper.ContactNoticeType.NONE,
map.get("notices"));
RdapTestHelper.addDomainBoilerplateRemarks(builder, false, map.get("remarks"));
false,
RdapTestHelper.createNotices(
"https://example.com/rdap/",
(contactRoids == null)
? RdapTestHelper.ContactNoticeType.DOMAIN
: RdapTestHelper.ContactNoticeType.NONE,
map.get("notices")));
obj = new JSONObject(builder.build());
}
return obj;

View file

@ -560,8 +560,8 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("domainSearchResults", ImmutableList.of(obj));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addNotices(builder, "https://example.com/rdap/");
RdapTestHelper.addDomainBoilerplateRemarks(builder);
RdapTestHelper.addDomainBoilerplateNotices(
builder, RdapTestHelper.createNotices("https://example.com/rdap/"));
return new JSONObject(builder.build());
}

View file

@ -256,14 +256,14 @@ public class RdapEntityActionTest {
RdapTestHelper.getBuilderExcluding(
map, ImmutableSet.of("rdapConformance", "notices", "remarks"));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addNotices(
RdapTestHelper.addNonDomainBoilerplateNotices(
builder,
"https://example.com/rdap/",
addNoPersonalDataRemark
? RdapTestHelper.ContactNoticeType.CONTACT
: RdapTestHelper.ContactNoticeType.NONE,
map.get("notices"));
RdapTestHelper.addNonDomainBoilerplateRemarks(builder, map.get("remarks"));
RdapTestHelper.createNotices(
"https://example.com/rdap/",
addNoPersonalDataRemark
? RdapTestHelper.ContactNoticeType.CONTACT
: RdapTestHelper.ContactNoticeType.NONE,
map.get("notices")));
obj = builder.build();
}
return obj;

View file

@ -265,8 +265,8 @@ public class RdapEntitySearchActionTest extends RdapSearchActionTestCase {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("entitySearchResults", ImmutableList.of(obj));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addNotices(builder, "https://example.com/rdap/");
RdapTestHelper.addNonDomainBoilerplateRemarks(builder);
RdapTestHelper.addNonDomainBoilerplateNotices(
builder, RdapTestHelper.createNotices("https://example.com/rdap/"));
return new JSONObject(builder.build());
}

View file

@ -178,12 +178,12 @@ public class RdapNameserverActionTest {
RdapTestHelper.getBuilderExcluding(
map, ImmutableSet.of("rdapConformance", "notices", "remarks"));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addNotices(
RdapTestHelper.addNonDomainBoilerplateNotices(
builder,
"https://example.tld/rdap/",
RdapTestHelper.ContactNoticeType.NONE,
map.get("notices"));
RdapTestHelper.addNonDomainBoilerplateRemarks(builder, map.get("remarks"));
RdapTestHelper.createNotices(
"https://example.tld/rdap/",
RdapTestHelper.ContactNoticeType.NONE,
map.get("notices")));
obj = builder.build();
}
return obj;

View file

@ -263,8 +263,8 @@ public class RdapNameserverSearchActionTest extends RdapSearchActionTestCase {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
builder.put("nameserverSearchResults", ImmutableList.of(obj));
builder.put("rdapConformance", ImmutableList.of("rdap_level_0"));
RdapTestHelper.addNotices(builder, "https://example.tld/rdap/");
RdapTestHelper.addNonDomainBoilerplateRemarks(builder);
RdapTestHelper.addNonDomainBoilerplateNotices(
builder, RdapTestHelper.createNotices("https://example.tld/rdap/"));
return builder.build();
}

View file

@ -45,13 +45,11 @@ public class RdapTestHelper {
return builder;
}
static void addNotices(
ImmutableMap.Builder<String, Object> builder, String linkBase) {
addNotices(builder, linkBase, ContactNoticeType.NONE, null);
static ImmutableList<ImmutableMap<String, Object>> createNotices(String linkBase) {
return createNotices(linkBase, ContactNoticeType.NONE, null);
}
static void addNotices(
ImmutableMap.Builder<String, Object> builder,
static ImmutableList<ImmutableMap<String, Object>> createNotices(
String linkBase,
ContactNoticeType contactNoticeType,
@Nullable Object otherNotices) {
@ -123,51 +121,56 @@ public class RdapTestHelper {
"rel", "alternate",
"href", "https://www.registry.tld/about/rdap/tos.html",
"type", "text/html"))));
builder.put("notices", noticesBuilder.build());
return noticesBuilder.build();
}
static void addNonDomainBoilerplateRemarks(ImmutableMap.Builder<String, Object> builder) {
addNonDomainBoilerplateRemarks(builder, null);
static void addNonDomainBoilerplateNotices(ImmutableMap.Builder<String, Object> builder) {
addNonDomainBoilerplateNotices(builder, null);
}
static void addNonDomainBoilerplateRemarks(
ImmutableMap.Builder<String, Object> builder, @Nullable Object otherRemarks) {
ImmutableList.Builder<ImmutableMap<String, Object>> remarksBuilder =
getBuilderWithOthersAdded(otherRemarks);
remarksBuilder.add(
static void addNonDomainBoilerplateNotices(
ImmutableMap.Builder<String, Object> builder, @Nullable Object otherNotices) {
ImmutableList.Builder<ImmutableMap<String, Object>> noticesBuilder =
getBuilderWithOthersAdded(otherNotices);
noticesBuilder.add(
ImmutableMap.of(
"description",
ImmutableList.of(
"This response conforms to the RDAP Operational Profile for gTLD Registries and"
+ " Registrars version 1.0")));
builder.put("remarks", remarksBuilder.build());
builder.put("notices", noticesBuilder.build());
}
static void addDomainBoilerplateRemarks(ImmutableMap.Builder<String, Object> builder) {
addDomainBoilerplateRemarks(builder, false, null);
static void addDomainBoilerplateNotices(ImmutableMap.Builder<String, Object> builder) {
addDomainBoilerplateNotices(builder, false, null);
}
static void addDomainBoilerplateRemarks(
static void addDomainBoilerplateNotices(
ImmutableMap.Builder<String, Object> builder, @Nullable Object otherNotices) {
addDomainBoilerplateNotices(builder, false, otherNotices);
}
static void addDomainBoilerplateNotices(
ImmutableMap.Builder<String, Object> builder,
boolean addNoContactRemark,
@Nullable Object otherRemarks) {
ImmutableList.Builder<ImmutableMap<String, Object>> remarksBuilder =
getBuilderWithOthersAdded(otherRemarks);
@Nullable Object otherNotices) {
ImmutableList.Builder<ImmutableMap<String, Object>> noticesBuilder =
getBuilderWithOthersAdded(otherNotices);
if (addNoContactRemark) {
remarksBuilder.add(
noticesBuilder.add(
ImmutableMap.of(
"title", "Contacts Hidden",
"description",
ImmutableList.of("Domain contacts are visible only to the owning registrar."),
"type", "object truncated due to unexplainable reasons"));
}
remarksBuilder.add(
noticesBuilder.add(
ImmutableMap.of(
"description",
ImmutableList.of(
"This response conforms to the RDAP Operational Profile for gTLD Registries and"
+ " Registrars version 1.0")));
remarksBuilder.add(
noticesBuilder.add(
ImmutableMap.of(
"title",
"EPP Status Codes",
@ -182,7 +185,7 @@ public class RdapTestHelper {
"rel", "alternate",
"href", "https://icann.org/epp",
"type", "text/html"))));
remarksBuilder.add(
noticesBuilder.add(
ImmutableMap.of(
"description",
ImmutableList.of(
@ -194,7 +197,7 @@ public class RdapTestHelper {
"rel", "alternate",
"href", "https://www.icann.org/wicf",
"type", "text/html"))));
builder.put("remarks", remarksBuilder.build());
builder.put("notices", noticesBuilder.build());
}
private static ImmutableList.Builder<ImmutableMap<String, Object>> getBuilderWithOthersAdded(
@ -269,6 +272,9 @@ public class RdapTestHelper {
for (Object notice : (JSONArray) notices) {
assertThat(notice).isInstanceOf(JSONObject.class);
Object title = ((JSONObject) notice).get("title");
if (title == null) {
continue;
}
assertThat(title).isInstanceOf(String.class);
if (!title.equals("Navigation Links")) {
continue;

View file

@ -162,10 +162,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -143,10 +143,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -163,10 +163,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -86,10 +86,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -98,8 +98,41 @@
"objectClassName":"domain"
}
],
"remarks":
"notices":
[
{
"description":
[
"Search results may contain incomplete information due to first-stage query limits."
],
"title":"Search Policy",
"type":"result set truncated due to unexplainable reasons"
},
{
"description":
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links":
[
{
"rel":"alternate",
"href":"https://www.registry.tld/about/rdap/tos.html",
"value":"https://example.com/rdap/help/tos",
"type":"text/html"
}
],
"title":"RDAP Terms of Service"
},
{
"description":
[
@ -138,42 +171,6 @@
]
}
],
"notices":
[
{
"description":
[
"Search results may contain incomplete information due to first-stage query limits."
],
"title":"Search Policy",
"type":"result set truncated due to unexplainable reasons"
},
{
"description":
[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links":
[
{
"rel":"alternate",
"href":"https://www.registry.tld/about/rdap/tos.html",
"value":"https://example.com/rdap/help/tos",
"type":"text/html"
}
],
"title":"RDAP Terms of Service"
}
],
"rdapConformance":
[
"rdap_level_0"

View file

@ -57,7 +57,37 @@
"objectClassName":"domain"
}
],
"remarks":[
"notices":[
{
"title":"Search Policy",
"type":"result set truncated due to unexplainable reasons",
"description":[
"Search results may contain incomplete information due to first-stage query limits."
]
},
{
"title":"RDAP Terms of Service",
"description":[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links":[
{
"value":"https://example.com/rdap/help/tos",
"type":"text/html",
"rel":"alternate",
"href":"https://www.registry.tld/about/rdap/tos.html"
}
]
},
{
"description":[
"This response conforms to the RDAP Operational Profile for gTLD Registries and Registrars version 1.0"
@ -93,37 +123,5 @@
],
"rdapConformance":[
"rdap_level_0"
],
"notices":[
{
"title":"Search Policy",
"type":"result set truncated due to unexplainable reasons",
"description":[
"Search results may contain incomplete information due to first-stage query limits."
]
},
{
"title":"RDAP Terms of Service",
"description":[
"By querying our Domain Database, you are agreeing to comply with these terms so please read them carefully.",
"Any information provided is 'as is' without any guarantee of accuracy.",
"Please do not misuse the Domain Database. It is intended solely for query-based access.",
"Don't use the Domain Database to allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations.",
"Don't access our Domain Database through the use of high volume, automated electronic processes that send queries or data to the systems of any ICANN-accredited registrar.",
"You may only use the information contained in the Domain Database for lawful purposes.",
"Do not compile, repackage, disseminate, or otherwise use the information contained in the Domain Database in its entirety, or in any substantial portion, without our prior written permission.",
"We may retain certain details about queries to our Domain Database for the purposes of detecting and preventing misuse.",
"We reserve the right to restrict or deny your access to the database if we suspect that you have failed to comply with these terms.",
"We reserve the right to modify this agreement at any time."
],
"links":[
{
"value":"https://example.com/rdap/help/tos",
"type":"text/html",
"rel":"alternate",
"href":"https://www.registry.tld/about/rdap/tos.html"
}
]
}
]
}

View file

@ -128,10 +128,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -121,10 +121,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -86,10 +86,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -213,10 +213,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -142,10 +142,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -141,10 +141,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -241,10 +241,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -233,10 +233,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -162,9 +162,6 @@
}
]
},
],
"remarks" :
[
{
"description" :
[

View file

@ -240,10 +240,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -261,10 +261,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[

View file

@ -30,10 +30,7 @@
"type" : "text/html"
}
]
}
],
"remarks" :
[
},
{
"description" :
[