mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 17:07:15 +02: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:
parent
1b3df82fb3
commit
5c1d9bd5c3
5 changed files with 30 additions and 57 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue