Add the ability to provide credential JSON file to the nomulus tool

This allows us to run nomulus tool programmatically on environments that do not
allow the 3-legged OAuth authentication flow.

The provided JSON file corresponds to a service account, which must have
GAE admin permission and whose client ID must be whitelisted in the config
file.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=226008337
This commit is contained in:
jianglai 2018-12-18 09:25:06 -08:00 committed by Michael Muller
parent 40b05ffb3c
commit 27b6231053
5 changed files with 76 additions and 20 deletions

View file

@ -19,7 +19,7 @@ import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.javanet.NetHttpTransport;
import dagger.Module;
import dagger.Provides;
import google.registry.config.CredentialModule.LocalCredential;
import google.registry.config.CredentialModule.DefaultCredential;
import google.registry.config.RegistryConfig;
/**
@ -35,7 +35,7 @@ class RequestFactoryModule {
@Provides
static HttpRequestFactory provideHttpRequestFactory(
@LocalCredential GoogleCredential credential) {
@DefaultCredential GoogleCredential credential) {
if (RegistryConfig.areServersLocal()) {
return new NetHttpTransport()
.createRequestFactory(