google-nomulus/java/google/registry
jianglai 6352b8a01a Use self-managed credential in remote api installer
RemoteApiOption has a package-private method that takes a Stream representing the content of a JSON and use a GoogleCredential created from it as its credential. This CL uses reflection to change the access modifier of that method in order to supply a credential stream that is self-managed. This is obviously not ideal and prone to breakage in case the getGoogleCredentialStream method is changed. Unfortunately upstream is not willing to make it public citing the reason that GoogleCredential.fromStream() (which getGoogleCredentialStream uses) is a @Beta annotated function (see https://groups.google.com[]forum/#!searchin/domain-registry-eng/remoteapioptions%7Csort:date/domain-registry-eng/Flsah6skszQ/CySZv2XEBwAJ). However this function is introduced 5 years ago as a public function (b857184bfa). I think at this point it is safe to assume that it is part of the widely used APIs and will not change without sufficient notice.

Note here that RemoteApiOptions creates its own copy of GoogleCredential to be used to call App Engine APIs locally, whereas communications to Nomulus endpoints use the Credential provided in AuthModule. Even though both credentials are created from the same client id, client secret and refresh token (the three elements needed to construct a GoogleCredential this way, see https://github.com/googleapis/google-api-java-client/blob/master/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java#L842), their refreshes cycles are independent of each other. I verified that refreshing one of the credential does not invalidate the access token of the other credential, as long as it is not expired yet.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224156131
2018-12-05 16:02:28 -05:00
..
backup Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
batch Update lastEppUpdateTime and lastEppUpdateClientId when necessary 2018-12-03 19:13:55 -05:00
beam Make BillingModule.OVERALL_INVOICE_PREFIX configurable 2018-11-16 17:00:38 -05:00
bigquery Account for GoogleJsonResponseException#getDetails returning null 2018-12-03 19:09:11 -05:00
builddefs Replace iteration over depsets with an explicit .to_list() call 2018-11-14 11:55:43 -05:00
config Use self-managed credential in remote api installer 2018-12-05 16:02:28 -05:00
cron Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
dns Account for GoogleJsonResponseException#getDetails returning null 2018-12-03 19:09:11 -05:00
env Remove the ability to download service account credentials 2018-12-05 16:00:51 -05:00
export Account for GoogleJsonResponseException#getDetails returning null 2018-12-03 19:09:11 -05:00
flows Update lastEppUpdateTime and lastEppUpdateClientId when necessary 2018-12-03 19:13:55 -05:00
gcs Clean up annotation imports in BUILD files 2018-06-27 15:28:53 -04:00
groups Account for GoogleJsonResponseException#getDetails returning null 2018-12-03 19:09:11 -05:00
idn Update IDN tables to comply with https://www.iana.org/help/idn-repository-procedure 2018-02-01 21:59:14 -05:00
keyring Remove the ability to download service account credentials 2018-12-05 16:00:51 -05:00
loadtest Clean up annotation imports in BUILD files 2018-06-27 15:28:53 -04:00
mapreduce Use locking on async mapreduces 2018-08-10 13:44:25 -04:00
model Clean up some areas in preparation for externalized codebase 2018-11-16 16:51:11 -05:00
module Remove the ability to download service account credentials 2018-12-05 16:00:51 -05:00
monitoring/whitebox Stop exporting EPP flow metrics to BigQuery 2018-10-08 16:59:29 -04:00
pricing Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
proxy Remove proxy's dependency on config 2018-11-16 16:57:30 -05:00
rdap Move AuthenticatedRegistrarAccessor to request/auth/ 2018-11-16 16:54:21 -05:00
rde Refactor StringGenerator bindings 2018-10-22 19:06:35 -04:00
reporting Make BillingModule.OVERALL_INVOICE_PREFIX configurable 2018-11-16 17:00:38 -05:00
request Remove unnecessary Dagger qualifier 2018-12-03 18:59:40 -05:00
security Improve internal build system speed 2018-06-27 15:28:52 -04:00
storage/drive Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
tldconfig/idn Remove the use of InjectRule in IdnLabelValidatorTest 2018-10-22 18:54:53 -04:00
tmch Refactor TmchCertificateAuthority 2018-10-25 14:40:38 -04:00
tools Use self-managed credential in remote api installer 2018-12-05 16:02:28 -05:00
ui Hide the edit/add buttons for fields the user can't update 2018-12-03 19:25:05 -05:00
util Clean up some areas in preparation for externalized codebase 2018-11-16 16:51:11 -05:00
whois Clean up annotation imports in BUILD files 2018-06-27 15:28:53 -04:00
xjc Run bazel installer as a argument to bash 2018-08-10 13:44:25 -04:00
xml Pretty-print actual XML in tests 2018-07-14 01:37:03 -04:00
BUILD Remove deprecated DNS subsystem 2018-09-14 12:01:08 -04:00
repositories.bzl Use self-managed credential in remote api installer 2018-12-05 16:02:28 -05:00