Conform to RDAP Technical Implementation Guide

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=251864499
This commit is contained in:
guyben 2019-06-06 09:18:07 -07:00 committed by jianglai
parent 55dc735ba0
commit ca1d525e28
65 changed files with 869 additions and 709 deletions

View file

@ -47,6 +47,8 @@ public class RdapDomainAction extends RdapActionBase {
@Override
public RdapDomain getJsonObjectForResource(String pathSearchString, boolean isHeadRequest) {
// RDAP Technical Implementation Guide 2.1.1 - we must support A-label (Punycode) and U-label
// (Unicode) formats. canonicalizeName will transform Unicode to Punycode so we support both.
pathSearchString = canonicalizeName(pathSearchString);
try {
validateDomainName(pathSearchString);
@ -62,7 +64,12 @@ public class RdapDomainAction extends RdapActionBase {
DomainBase.class,
pathSearchString,
shouldIncludeDeleted() ? START_OF_TIME : rdapJsonFormatter.getRequestTime());
if (!shouldBeVisible(domainBase)) {
if (!domainBase.isPresent() || !isAuthorized(domainBase.get())) {
// RFC7480 5.3 - if the server wishes to respond that it doesn't have data satisfying the
// query, it MUST reply with 404 response code.
//
// Note we don't do RFC7480 5.3 - returning a different code if we wish to say "this info
// exists but we don't want to show it to you", because we DON'T wish to say that.
throw new NotFoundException(pathSearchString + " not found");
}
return rdapJsonFormatter.createRdapDomain(domainBase.get(), OutputDataType.FULL);