-
-
Notifications
You must be signed in to change notification settings - Fork 329
Introduce Client side S3EncryptionClient #1033
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
f7fa715
Initial commit
MatejNedic 69d96fb
Refactor integration with S3
MatejNedic cea4107
Spotless
MatejNedic be343df
Merge branch 'main' into S3-kms-support
MatejNedic f257ea8
Merge main into branch
MatejNedic 78ef972
Merge main into branch
MatejNedic 932ffa0
Merge branch 'main' into S3-kms-support
MatejNedic c9beff0
revert
MatejNedic 240f228
Change if statement
MatejNedic 3734206
Change if statement
MatejNedic 3d9e73d
Add docs
MatejNedic edd077e
Add docs
MatejNedic a54f02e
remove throw that does not exist
MatejNedic 64d1b1d
Merge branch 'awspring:main' into S3-kms-support
MatejNedic 1156163
Merge branch 'main' into S3-kms-support
MatejNedic 1a2219f
Merge branch 'main' into S3-kms-support
MatejNedic 230889f
Merge main
MatejNedic 6265023
Align to current strategy
MatejNedic 399cc3c
Test
MatejNedic edd803c
Remove unused classes
MatejNedic 125a19d
Modify tests
MatejNedic 2968e66
refactor
MatejNedic 2aef40b
Amend PR comments and refactor
MatejNedic 960af29
Format
MatejNedic bfe0fe5
Merge branch 'main' into S3-kms-support
MatejNedic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
35 changes: 35 additions & 0 deletions
35
...oud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3AesProvider.java
This file contains hidden or 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,35 @@ | ||
/* | ||
* Copyright 2013-2024 the original author or authors. | ||
* | ||
* 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 | ||
* | ||
* https://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 io.awspring.cloud.autoconfigure.s3; | ||
|
||
import javax.crypto.SecretKey; | ||
|
||
/** | ||
* Interface for providing {@link SecretKey} when configuring {@link software.amazon.encryption.s3.S3EncryptionClient}. | ||
* Required when encrypting files server side with AES. Secret Key should be stored in secure storage, for example AWS | ||
* Secrets Manager. | ||
* @author Matej Nedic | ||
* @since 3.3.0 | ||
*/ | ||
public interface S3AesProvider { | ||
MatejNedic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Provides SecretKey that will be used to configure {@link software.amazon.encryption.s3.S3EncryptionClient}. | ||
* Advised to fetch and return SecretKey in this method from Secured Storage. | ||
* @return KeyPair that will be used for encryption/decryption. | ||
*/ | ||
SecretKey generateSecretKey(); | ||
} |
This file contains hidden or 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
29 changes: 29 additions & 0 deletions
29
...figure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3EncryptionClientCustomizer.java
This file contains hidden or 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,29 @@ | ||
/* | ||
* Copyright 2013-2024 the original author or authors. | ||
* | ||
* 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 | ||
* | ||
* https://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 io.awspring.cloud.autoconfigure.s3; | ||
|
||
import io.awspring.cloud.autoconfigure.AwsClientCustomizer; | ||
import software.amazon.encryption.s3.S3EncryptionClient; | ||
|
||
/** | ||
* Callback interface that can be used to customize a {@link S3EncryptionClient.Builder}. | ||
* | ||
* @author Matej Nedic | ||
* @since 3.3.0 | ||
*/ | ||
@FunctionalInterface | ||
public interface S3EncryptionClientCustomizer extends AwsClientCustomizer<S3EncryptionClient.Builder> { | ||
} |
44 changes: 44 additions & 0 deletions
44
...toconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3EncryptionConditional.java
This file contains hidden or 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 2013-2024 the original author or authors. | ||
* | ||
* 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 | ||
* | ||
* https://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 io.awspring.cloud.autoconfigure.s3; | ||
|
||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
|
||
/** | ||
* Conditional for creating {@link software.amazon.encryption.s3.S3EncryptionClient}. Will only create | ||
* S3EncryptionClient if one of following is true. | ||
* @author Matej Nedic | ||
* @since 3.3.0 | ||
*/ | ||
public class S3EncryptionConditional extends AnyNestedCondition { | ||
public S3EncryptionConditional() { | ||
super(ConfigurationPhase.REGISTER_BEAN); | ||
} | ||
|
||
@ConditionalOnBean(S3RsaProvider.class) | ||
static class RSAProviderCondition { | ||
} | ||
|
||
@ConditionalOnBean(S3AesProvider.class) | ||
static class AESProviderCondition { | ||
} | ||
|
||
@ConditionalOnProperty(name = "spring.cloud.aws.s3.encryption.keyId") | ||
static class KmsKeyProperty { | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...oud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3RsaProvider.java
This file contains hidden or 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,35 @@ | ||
/* | ||
* Copyright 2013-2024 the original author or authors. | ||
* | ||
* 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 | ||
* | ||
* https://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 io.awspring.cloud.autoconfigure.s3; | ||
|
||
import java.security.KeyPair; | ||
|
||
/** | ||
* Interface for providing {@link KeyPair} when configuring {@link software.amazon.encryption.s3.S3EncryptionClient}. | ||
* Required for encrypting/decrypting files server side with RSA. Key pair should be stored in secure storage, for | ||
* example AWS Secrets Manager. | ||
* @author Matej Nedic | ||
* @since 3.3.0 | ||
*/ | ||
public interface S3RsaProvider { | ||
|
||
/** | ||
* Provides KeyPair that will be used to configure {@link software.amazon.encryption.s3.S3EncryptionClient}. Advised | ||
* to fetch and return KeyPair in this method from Secured Storage. | ||
* @return KeyPair that will be used for encryption/decryption. | ||
*/ | ||
KeyPair generateKeyPair(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.