-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement v4a aws-chunked payload signer and s3-crt delegation (#4350)
* Add AwsChunkedV4aPayloadSigner and S3-CRT payload signing * Use joinLikeSync, split up conditionals * Use static constants * Move signer back to being protected * Update SignerLoader
- Loading branch information
1 parent
4aea043
commit 0034c78
Showing
21 changed files
with
1,504 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...rc/main/java/software/amazon/awssdk/http/auth/aws/crt/internal/chunkedencoding/Chunk.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.http.auth.aws.crt.internal.chunkedencoding; | ||
|
||
import java.io.InputStream; | ||
import software.amazon.awssdk.annotations.SdkInternalApi; | ||
import software.amazon.awssdk.utils.SdkAutoCloseable; | ||
|
||
/** | ||
* An interface which defines a "chunk" of data. | ||
*/ | ||
@SdkInternalApi | ||
public interface Chunk extends SdkAutoCloseable { | ||
/** | ||
* Get a default implementation of a chunk, which wraps a stream with a fixed size; | ||
*/ | ||
static Chunk create(InputStream data, int sizeInBytes) { | ||
return new DefaultChunk(new ChunkInputStream(data, sizeInBytes)); | ||
} | ||
|
||
/** | ||
* Get the underlying stream of data for a chunk. | ||
*/ | ||
InputStream stream(); | ||
|
||
/** | ||
* Whether the logical end of a chunk has been reached. | ||
*/ | ||
boolean hasRemaining(); | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...ware/amazon/awssdk/http/auth/aws/crt/internal/chunkedencoding/ChunkExtensionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.http.auth.aws.crt.internal.chunkedencoding; | ||
|
||
import software.amazon.awssdk.annotations.SdkInternalApi; | ||
import software.amazon.awssdk.utils.Pair; | ||
|
||
/** | ||
* A functional interface for defining an extension of a chunk, where the extension is a key-value pair. | ||
* <p> | ||
* An extension usually depends on the chunk-data itself (checksum, signature, etc.), but is not required to. | ||
* Per <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-4.1.1">RFC-7230</a> The chunk-extension is defined as: | ||
* <pre> | ||
* chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) | ||
* chunk-ext-name = token | ||
* chunk-ext-val = token / quoted-string | ||
* </pre> | ||
*/ | ||
@FunctionalInterface | ||
@SdkInternalApi | ||
public interface ChunkExtensionProvider { | ||
Pair<byte[], byte[]> get(byte[] chunk); | ||
} |
Oops, something went wrong.