use of org.dataportabilityproject.spi.cloud.storage.AppCredentialStore in project data-transfer-project by google.
the class MicrosoftAuthServiceExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
mapper = context.getTypeManager().getMapper();
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
okHttpClient = clientBuilder.build();
AppCredentialStore appCredentialStore = context.getService(AppCredentialStore.class);
try {
AppCredentials credentials = appCredentialStore.getAppCredentials("MICROSOFT_KEY", "MICROSOFT_SECRET");
if (credentials == null) {
throw new IllegalStateException("Microsoft Graph API credentials not found");
}
} catch (IOException e) {
throw new IllegalStateException("Error retrieving Microsoft Graph API credentials - Were they set?", e);
}
importAuthDataGenerators = new HashMap<>();
exportAuthDataGenerators = new HashMap<>();
initialized = true;
}
use of org.dataportabilityproject.spi.cloud.storage.AppCredentialStore in project data-transfer-project by google.
the class FlickrAuthServiceExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
AppCredentialStore appCredentialStore = context.getService(AppCredentialStore.class);
try {
flickrAuthDataGenerator = new FlickrAuthDataGenerator(appCredentialStore.getAppCredentials(FLICKR_KEY, FLICKR_SECRET));
initialized = true;
} catch (IOException e) {
logger.debug("Error retrieving Flickr Credentials. Did you set {} and {}?", FLICKR_KEY, FLICKR_SECRET);
}
}
use of org.dataportabilityproject.spi.cloud.storage.AppCredentialStore in project data-transfer-project by google.
the class WorkerMain method initialize.
public void initialize() {
SettingsExtension settingsExtension = getSettingsExtension();
settingsExtension.initialize(null);
WorkerExtensionContext extensionContext = new WorkerExtensionContext(settingsExtension);
// TODO this should be moved into a service extension
extensionContext.registerService(HttpTransport.class, new NetHttpTransport());
ServiceLoader.load(ServiceExtension.class).iterator().forEachRemaining(serviceExtension -> serviceExtension.initialize(extensionContext));
// TODO: verify that this is the cloud extension that is specified in the configuration
CloudExtension cloudExtension = getCloudExtension();
cloudExtension.initialize(extensionContext);
logger.info("Using CloudExtension: {} ", cloudExtension.getClass().getName());
JobStore jobStore = cloudExtension.getJobStore();
extensionContext.registerService(JobStore.class, jobStore);
AppCredentialStore appCredentialStore = cloudExtension.getAppCredentialStore();
extensionContext.registerService(AppCredentialStore.class, appCredentialStore);
List<TransferExtension> transferExtensions = getTransferExtensions();
// TODO: make configurable
SymmetricKeyGenerator symmetricKeyGenerator = new AesSymmetricKeyGenerator();
AsymmetricKeyGenerator asymmetricKeyGenerator = new RsaSymmetricKeyGenerator();
Injector injector = Guice.createInjector(new WorkerModule(extensionContext, cloudExtension, transferExtensions, symmetricKeyGenerator, asymmetricKeyGenerator));
worker = injector.getInstance(Worker.class);
}
Aggregations