use of org.dataportabilityproject.types.transfer.auth.AppCredentials 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.types.transfer.auth.AppCredentials in project data-transfer-project by google.
the class GoogleAppCredentialStore method getAppCredentials.
public AppCredentials getAppCredentials(String keyName, String secretName) throws IOException {
String key;
String secret;
try {
key = keys.get(keyName);
} catch (ExecutionException e) {
throw new IOException("Couldn't lookup key: " + keyName, e);
}
try {
secret = secrets.get(secretName);
} catch (ExecutionException e) {
throw new IOException("Couldn't lookup secret: " + secretName, e);
}
return new AppCredentials(key, secret);
}
Aggregations