-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add support for EncryptionContext overrides to the DynamoDBEncryptor #60
Conversation
There are people asking for overrides, and it would be better if they didn't need to wait for longer term, internal refactors before they are able to use overrides. This adds optional operators that give the client the last say on the EncryptionContext's value. Note: I haven't tested the example, since I didn't figure out a way to run them. How are we running example code? If we don't have a suggested way yet, I can figure something out and document it.
shutdown must be called on ddb and kms to threads to exit when using mvn exec:java to run commands, otherwise maven will pause for a configurable (by default 15s) timeout to join daemon threads.
Figured out how to run examples.
|
@@ -81,7 +81,8 @@ | |||
private final String signingAlgorithmHeader; | |||
|
|||
public static final String DEFAULT_SIGNING_ALGORITHM_HEADER = DEFAULT_DESCRIPTION_BASE + "signingAlg"; | |||
|
|||
private Function<EncryptionContext, EncryptionContext> encryptionContextOverrideOperator; |
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.
This should be a UnaryOperator
here and throughout.
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.
I'd have liked UnaryOperator
as well, but the chaining methods inherited from Function<T,T>
returns a Function<T,T>
instead of an UnaryOperator. Ex. calling .andThen
on an UnaryOperator<T>
returns a Function<T, T>
.
I'm tempted to drop UnaryOperator
completely and instead use Function<T,T>
throughout, but also think that returning a more specific object from a helper class is acceptable. What do you think?
.../amazonaws/services/dynamodbv2/datamodeling/encryption/utils/EncryptionContextOperators.java
Show resolved
Hide resolved
examples/com/amazonaws/examples/EncryptionContextOverridesWithDynamoDBMapper.java
Outdated
Show resolved
Hide resolved
Update the AWS SDK to latest in order to get access to SaveBehavior.PUT for examples. Update tests to use the more general Function<T, T> instead of UnaryOperator<T>. Make it so EncryptionContextOperators can't be instantiated by adding a private constructor.
There are people asking for overrides, and it would be better if they didn't
need to wait for longer term, internal refactors before they are able to use
overrides. This adds optional operators that give the client the last say on the
EncryptionContext's value.
Note: I haven't tested the example, since I didn't figure out a way to run them.
How are we running example code? If we don't have a suggested way yet, I can
figure something out and document it.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.