mirror of
https://github.com/google/nomulus
synced 2026-02-03 03:22:26 +00:00
Refactor DelegatedCredential provisioning for GSuite domains
Updated the registar contact group management, which is the only use case for this credential. Also updated GSuite domain delegated admin access config in admin dashboard for both sandbox (used by alpha and sandbox) and prod. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=212320157
This commit is contained in:
@@ -16,12 +16,10 @@ package google.registry.groups;
|
||||
|
||||
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
|
||||
import com.google.api.services.admin.directory.Directory;
|
||||
import com.google.api.services.admin.directory.DirectoryScopes;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import google.registry.config.CredentialModule.DelegatedCredential;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import javax.inject.Named;
|
||||
|
||||
/** Dagger module for the Google {@link Directory} service. */
|
||||
@Module
|
||||
@@ -29,15 +27,8 @@ public final class DirectoryModule {
|
||||
|
||||
@Provides
|
||||
static Directory provideDirectory(
|
||||
@Named("delegatedAdmin") GoogleCredential credential,
|
||||
@Config("projectId") String projectId) {
|
||||
return new Directory.Builder(
|
||||
credential.getTransport(),
|
||||
credential.getJsonFactory(),
|
||||
credential.createScoped(
|
||||
ImmutableSet.of(
|
||||
DirectoryScopes.ADMIN_DIRECTORY_GROUP_MEMBER,
|
||||
DirectoryScopes.ADMIN_DIRECTORY_GROUP)))
|
||||
@DelegatedCredential GoogleCredential credential, @Config("projectId") String projectId) {
|
||||
return new Directory.Builder(credential.getTransport(), credential.getJsonFactory(), credential)
|
||||
.setApplicationName(projectId)
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user