Class EncryptedS3RepositoryImpl

All Implemented Interfaces:
S3Repository, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service @ConditionalOnExpression("${application.service.vault.encryption.enabled}.equals(true) and \'${application.service.vault.storage.impl}\'.equals(\'s3\')") public class EncryptedS3RepositoryImpl extends S3RepositoryImpl
S3RepositoryImpl variant that transparently encrypts data before uploading to S3 and decrypts it when retrieved. Encryption is delegated to the provided CryptoService.

The bean becomes active only when application.service.vault.encryption.enabled is true and application.service.vault.storage.impl equals "s3".

  • Constructor Details

    • EncryptedS3RepositoryImpl

      public EncryptedS3RepositoryImpl(software.amazon.awssdk.services.s3.S3Client s3Client, CryptoService cryptoService)
      Creates a new repository instance using the given AWS client and cryptographic service.
      Parameters:
      s3Client - AWS S3 client
      cryptoService - service responsible for encryption and decryption
  • Method Details

    • putObject

      public void putObject(String bucketName, org.alfresco.core.model.Node node, Map<String,String> metadata, InputStream inputStream)
      Encrypts the provided content stream and stores it in S3. The object's metadata is updated to mark it as encrypted before delegating to the parent implementation.
      Specified by:
      putObject in interface S3Repository
      Overrides:
      putObject in class S3RepositoryImpl
      Parameters:
      bucketName - destination bucket
      node - node whose id acts as the key
      metadata - metadata key/value pairs to associate with the object
      inputStream - content stream to encrypt and upload
    • getObject

      public InputStream getObject(String bucketName, String nodeId)
      Retrieves the encrypted object content from S3 and returns a decrypted stream using the configured CryptoService.
      Specified by:
      getObject in interface S3Repository
      Overrides:
      getObject in class S3RepositoryImpl
      Parameters:
      bucketName - bucket containing the object
      nodeId - the node id / object key
      Returns:
      decrypted content stream