-
Notifications
You must be signed in to change notification settings - Fork 947
V4a async payload signing #6475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
966149f
to
ef5d53f
Compare
d4f0f87
to
5ac3968
Compare
import software.amazon.awssdk.utils.async.ByteBufferStoringSubscriber.TransferResult; | ||
|
||
@SdkInternalApi | ||
public final class CrtRequestBodyAdapter implements HttpRequestBodyStream { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this existing class https://github.com/aws/aws-sdk-java-v2/blob/master/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/request/CrtRequestBodyAdapter.java to crt-core
and use it directly? I understand this means we'd need to make it protected APIs, but the API surface area seems small enough...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense!
|
||
@ParameterizedTest(name = "{index} {3}") | ||
@MethodSource("streamingInputChecksumCalculationParams") | ||
public void asyncStreamingInput_checksumCalculation(RequestChecksumCalculation requestChecksumCalculation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an integ test as well?
SdkHttpRequest.Builder request, Publisher<ByteBuffer> payload, String checksum) { | ||
|
||
return SignerUtils.moveContentLength(request, payload) | ||
.thenApply(p -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: is there any difference between sigv4a and sigv4 for this logic here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, we can consolidate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually nm, they're slightly different that it's a bit annoying to consolidate the two. The normal V4a version doesn't have a checksum
parameter
...ava/software/amazon/awssdk/http/auth/aws/crt/internal/signer/AwsChunkedV4aPayloadSigner.java
Show resolved
Hide resolved
...ava/software/amazon/awssdk/http/auth/aws/crt/internal/signer/AwsChunkedV4aPayloadSigner.java
Show resolved
Hide resolved
...ava/software/amazon/awssdk/http/auth/aws/crt/internal/signer/AwsChunkedV4aPayloadSigner.java
Outdated
Show resolved
Hide resolved
...ava/software/amazon/awssdk/http/auth/aws/crt/internal/signer/DefaultAwsCrtV4aHttpSigner.java
Outdated
Show resolved
Hide resolved
5ac3968
to
802f635
Compare
|
Motivation and Context
This PR adds support for async payload signing in the V4a signer. Note an important difference to the V4 implementation: This supports the fallback to signing the payload when the request is sent over
http
. This is because calling thesignAsync()
method previously always threwUnsupportedOperationException
, so there is no risk of performance regression for existing users.Modifications
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License