-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support audit headers in request (#204)
## Description of change Support audit headers in request #### Relevant issues <!-- Please add issue numbers. --> <!-- Please also link them to this PR. --> #### Does this contribution introduce any breaking changes to the existing APIs or behaviors? <!-- Please explain why this was necessary. --> #### Does this contribution introduce any new public APIs or behaviors? <!-- Please describe them and explain what scenarios they target. --> #### How was the contribution tested? <!-- Please describe how this contribution was tested. --> #### Does this contribution need a changelog entry? - [ ] I have updated the CHANGELOG or README if appropriate --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the [Developer Certificate of Origin (DCO)](https://developercertificate.org/).
- Loading branch information
Showing
16 changed files
with
414 additions
and
46 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
54 changes: 54 additions & 0 deletions
54
common/src/main/java/software/amazon/s3/analyticsaccelerator/request/StreamContext.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,54 @@ | ||
/* | ||
* 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License 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.s3.analyticsaccelerator.request; | ||
/** | ||
* The StreamContext interface provides methods for modifying and building referrer header which | ||
* will then be attached to subsequent HTTP requests. | ||
*/ | ||
public interface StreamContext { | ||
|
||
/** | ||
* Modifies and builds the referrer header string for a given request context. | ||
* | ||
* <p>Implementation Note: To ensure thread safety, implementations should create and modify a | ||
* copy of the internal state rather than modifying the original object directly. This is crucial | ||
* as multiple threads may be accessing the same StreamContext instance concurrently. | ||
* | ||
* <p>Example implementation: | ||
* | ||
* <pre> | ||
* public class S3AStreamContext implements StreamContext { | ||
* private final HttpReferrerAuditHeader referrer; | ||
* | ||
* public S3AStreamContext(HttpReferrerAuditHeader referrer) { | ||
* this.referrer = referrer; | ||
* } | ||
* | ||
* @Override | ||
* public String modifyAndBuildReferrerHeader(GetRequest getRequestContext) { | ||
* // Create a copy to ensure thread safety | ||
* HttpReferrerAuditHeader copyReferrer = new HttpReferrerAuditHeader(this.referrer); | ||
* copyReferrer.set(AuditConstants.PARAM_RANGE, getRequestContext.getRange().toHttpString()); | ||
* return copyReferrer.buildHttpReferrer(); | ||
* } | ||
* } | ||
* </pre> | ||
* | ||
* @param getRequestContext the request context for building the referrer header | ||
* @return the modified and built referrer header as a String | ||
*/ | ||
public String modifyAndBuildReferrerHeader(GetRequest getRequestContext); | ||
} |
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
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
Oops, something went wrong.