1
0
mirror of https://github.com/google/nomulus synced 2025-12-23 14:25:44 +00:00
Files
nomulus/docs/coding-faq.md
gbrodman c6868b771b Update RDAP response profile + tech impl guide versions (#2778)
This corresponds to the Feb 2024 response profile section 1.2 and
implementation guide 1.3 respectively, now that we comply (or are, at
least closer to complying), with the Feb 2024 versions.

This should probably depend on https://github.com/google/nomulus/pull/2771
because that includes a small change included in the Feb 2024 version

This also updates the documentation to reference the proper areas of the
specifications.
2025-07-09 21:02:33 +00:00

4.8 KiB

Coding FAQ

This file is a motley assortment of informational emails generated in response to questions from development partners.

How do I mock Google Cloud Storage in tests?

AppEngine's GCS client automatically switches over to a local implementation, GcsServiceFactory, for tests.

So rather than mocking GCS-related stuff at all, just use the fake local implementation. This is what our tests should be doing; see ExportCommitLogDiffActionTest.

Very rarely there have been cases where we've needed something beyond that (e.g. to test against GCS being eventually consistent). In that case, rather than mocking GcsUtils, you'd need to create a real instance of it but pass in a mocked-out GcsService instance. Those are a bit of a pain to make since GcsServiceImpl itself is also final (and not code we control), but you could roll your own implementation by hand, or cheat and use a reflective proxy, as we do in GcsDiffFileListerTest.

How do I test authentication on the SDK Development Server?

Can someone explain how GaeUserIdConverter.convertEmailAddressToGaeUserId() actually does the conversion? I see it's doing a save/load(/delete) of a GaeUserIdConverter, which contains a User. Does Objectify do some magic on load to look up the real GAE user ID from the email address? In trying to get the registry to run in the SDK Development Server, I am seeing the wrong user ID when adding a new RegistryContact using the command line tool.

The App Engine development server is not particularly robust; it appears that it always returns userId 185804764220139124118 for any authenticated user, as per this StackOverflow thread.

For testing purposes, it might suffice to just create a RegistrarContact with that userId by hand somehow, so that you can log in. In the longer term, if we switch to Google Sign-In, this specific problem would go away, but based on the above, it looks like OAuthService doesn't really work on the dev server either.

So for testing actual "real" authentication, you'd want to use an alpha instance rather than the development server. We don't use the development server very much internally for this reason.

Do you support RDAP?

We provide an implementation of the Registry Data Access Protocol (RDAP) which provides similar data to the outdated WHOIS protocol, but in a structured format. The standard is defined in STD 95 and its RFCs:

If you access this endpoint on a running Nomulus system:

https://{PROJECT-ID}.appspot.com/rdap/domains?name=ex*

it should search for all domains that start with "ex", returning the results in JSON format. This functionality is still under development, so it is quite possible that the format of returned data will change over time, but the basic structure should be the same, as defined by RFCs 7480 through 7484. Request paths which ought to mostly work (though no guarantees yet):

/rdap/domain/abc.tld
/rdap/nameserver/ns1.abc.tld
/rdap/entity/ROID
/rdap/entity/registrar-iana-identifier
/rdap/domains?name=abc.tld
/rdap/domains?name=abc*
/rdap/domains?name=abc*.tld
/rdap/domains?nsLdhName=ns1.abc.tld
/rdap/domains?nsLdhName=ns*
/rdap/domains?nsIp=1.2.3.4
/rdap/nameservers?name=ns*.abc.tld
/rdap/nameservers?ip=1.2.3.4
/rdap/entities?fn=John*
/rdap/entities?handle=ROI*
/rdap/entities?handle=registrar-iana-identifier

The wildcard searches allow only trailing wildcards, with the exception that you can specify a TLD after the domain name wildcard (e.g. abc*.tld), and you can specify .domain.tld after the nameserver wildcard (e.g. ns*.domain.tld). But you can't do anything else, like searching for nameservers with ns*.tld. When using a wildcard, we currently require a prefix of at least two characters, to avoid having someone search for *.