Provide separate scopes list for delegated credentials

Scope changes in delegated credentials require coordinated external changes,
therefore should be separate from those used in the application default
credential.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212488389
This commit is contained in:
weiminyu 2018-09-11 11:28:13 -07:00 committed by Ben McIlwain
parent 5c1d9bd5c3
commit dbb1f1649d
4 changed files with 31 additions and 10 deletions

View file

@ -42,7 +42,7 @@ public abstract class CredentialModule {
@Provides
@Singleton
public static GoogleCredential provideDefaultCredential(
@Config("credentialOauthScopes") ImmutableList<String> requiredScopes) {
@Config("defaultCredentialOauthScopes") ImmutableList<String> requiredScopes) {
GoogleCredential credential;
try {
credential = GoogleCredential.getApplicationDefault();
@ -60,7 +60,7 @@ public abstract class CredentialModule {
@Provides
@Singleton
public static GoogleCredential provideJsonCredential(
@Config("credentialOauthScopes") ImmutableList<String> requiredScopes,
@Config("defaultCredentialOauthScopes") ImmutableList<String> requiredScopes,
@Key("jsonCredential") String jsonCredential) {
GoogleCredential credential;
try {
@ -89,7 +89,7 @@ public abstract class CredentialModule {
@Provides
@Singleton
public static GoogleCredential provideDelegatedCredential(
@Config("credentialOauthScopes") ImmutableList<String> requiredScopes,
@Config("delegatedCredentialOauthScopes") ImmutableList<String> requiredScopes,
@JsonCredential GoogleCredential googleCredential,
@Config("gSuiteAdminAccountEmailAddress") String gSuiteAdminAccountEmailAddress) {
return new GoogleCredential.Builder()