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

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

问题描述

我正在尝试访问位于 AWS S3 之上的 blob 存储服务.它支持 AWS SDK 及其签名版本 2.

我正在使用代码来访问这个服务.

是否可以手动设置 AWS SDK 发出的请求的签名版本?

根据本页

<块引用>AWS 当前支持两种签名版本:签名版本 2 和签名版本 4,本节将介绍它们.大多数服务支持版本 4,如果服务支持版本 4,我们强烈建议您使用该版本.

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

解决方案

来自 S3 开发人员指南 - 在请求认证中指定签名版本:

<块引用>

Java SDK

在您的代码中添加以下内容.

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

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

-Dcom.amazonaws.services.s3.enableV4

看起来 v2 是之前 AWS SDK 中的默认值,但 v4 现在是默认值,从 SDK v1.11.0(2016 年 5 月).

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.

Is it possible to manually set the signature version of the request made by AWS SDK ?

According to this page

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.

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

解决方案

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

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天全站免登陆