我们正在编写一个程序,使用Drive API在Google云端硬盘中发布电子表格。请参阅以下创建Drive.Builder实例的代码示例。我们的IT安全团队想知道使用此方法发布文件的通信协议是否为HTTPS(SSL / TLS)。你能确认一下吗?
/** Global instance of the HTTP transport. */
private static HttpTransport httpTransport;
/** Global instance of the JSON factory. */
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
try {
httpTransport = GoogleNetHttpTransport.newTrustedTransport();
} catch (GeneralSecurityException | IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
InputStream credentialsJSON = GoogleDrive.class.getResourceAsStream("Path to Json File of the Service Account");
GoogleCredential gcFromJson = GoogleCredential.fromStream(credentialsJSON, httpTransport, JSON_FACTORY)
.createScoped(Collections.singleton(DriveScopes.DRIVE));
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(gcFromJson.getTransport())
.setJsonFactory(gcFromJson.getJsonFactory())
.setServiceAccountId(gcFromJson.getServiceAccountId())
.setServiceAccountUser(userEmail)
.setServiceAccountPrivateKey(gcFromJson.getServiceAccountPrivateKey())
.setServiceAccountScopes(gcFromJson.getServiceAccountScopes())
.build();
// set up the global Drive instance
return new Drive.Builder(httpTransport, JSON_FACTORY, Utilities.setHttpTimeout(credential)).setApplicationName(
APPLICATION_NAME).build();
}