AWS Java SDK手动设置签名版本 [英] AWS java SDK manually set signature version

查看:547
本文介绍了AWS Java SDK手动设置签名版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问AWS S3之上的Blob存储服务.它支持AWS开发工具包及其签名版本2.

I'm trying to access a blob store service which is on top of AWS S3. It supports AWS SDK and it's signature version 2.

我正在使用此处的代码访问此服务.

I'm using code here to access the this service.

是否可以手动设置AWS开发工具包发出的请求的签名版本?

根据此页面

AWS当前支持两个签名版本:签名版本2和签名版本4,本节将对此进行介绍.大多数服务支持版本4,如果服务支持版本4,我们强烈建议您使用该版本.
AWS currently supports two signature versions: signature version 2 and signature version 4, which are covered in this section. Most services support version 4, and if a service supports version 4, we strongly recommend that you use that version.

我无法找到如何手动将签名版本设置为2或4.

I'm unable to find how to set the signature version to 2 or 4 manually.

推荐答案

来自S3开发人员指南-

From the S3 Developer Guide - Specifying Signature Version in Request Authentication:

Java SDK

在代码中添加以下内容.

Add the following in your code.

System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY, "true");

或者,在命令行上,指定以下内容.

Or, on the command line, specify the following.

-Dcom.amazonaws.services.s3.enableV4

v2以前似乎是AWS开发工具包中的默认设置,但v4现在是从 SDK v1.11.0(2016年5月).

It looks like v2 was the default in the AWS SDK previously, but v4 is now the default starting in SDK v1.11.0 (May, 2016).

这篇关于AWS Java SDK手动设置签名版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆