From a955acb0dbc84e19639e8f99aca118c3addca2b9 Mon Sep 17 00:00:00 2001 From: Lauren Kemperman <117678574+lkemperman-cfa@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:29:13 -0600 Subject: [PATCH] Fix staging deployment (#675) --- .../app/cli/BasePGPEncrpytorImpl.java | 17 +++++++++++------ .../app/cli/PGPEceEncryptorImpl.java | 12 ++++++------ .../ladocuploader/app/cli/PGPEncryptorImpl.java | 11 +++++------ .../app/cli/PGPWicEncryptorImpl.java | 11 +++++------ 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/ladocuploader/app/cli/BasePGPEncrpytorImpl.java b/src/main/java/org/ladocuploader/app/cli/BasePGPEncrpytorImpl.java index 4fad3fdab..e1a7b3fc4 100644 --- a/src/main/java/org/ladocuploader/app/cli/BasePGPEncrpytorImpl.java +++ b/src/main/java/org/ladocuploader/app/cli/BasePGPEncrpytorImpl.java @@ -10,9 +10,7 @@ import org.bouncycastle.openpgp.jcajce.JcaPGPPublicKeyRingCollection; import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator; import org.bouncycastle.openpgp.operator.jcajce.*; -import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; import java.io.*; import java.security.SecureRandom; @@ -20,15 +18,12 @@ import java.util.Iterator; @Slf4j -@Component @Profile({"production", "staging"}) public class BasePGPEncrpytorImpl implements PGPEncryptor { - @Value("${form-flow.aws.access_key}") private String accessKey; - @Value("${form-flow.aws.secret_key}") private String secretKey; - @Value("${form-flow.aws.region}") + private String region; private PGPSecretKey signingKey; @@ -39,6 +34,16 @@ public class BasePGPEncrpytorImpl implements PGPEncryptor { protected String seckeyFilePath; protected String bucketName; + public BasePGPEncrpytorImpl(String sigkeyPassword, String seckeyFilePath, String pubkeyFilePath, String bucketName, String accessKey, String secretKey, String region) { + this.sigkeyPassword = sigkeyPassword; + this.seckeyFilePath = seckeyFilePath; + this.pubkeyFilePath = pubkeyFilePath; + this.bucketName = bucketName; + this.accessKey = accessKey; + this.secretKey = secretKey; + this.region = region; + } + @PostConstruct public void init() { log.info("Retrieving keys for signing and encryption"); diff --git a/src/main/java/org/ladocuploader/app/cli/PGPEceEncryptorImpl.java b/src/main/java/org/ladocuploader/app/cli/PGPEceEncryptorImpl.java index 9bc559592..b92d3141f 100644 --- a/src/main/java/org/ladocuploader/app/cli/PGPEceEncryptorImpl.java +++ b/src/main/java/org/ladocuploader/app/cli/PGPEceEncryptorImpl.java @@ -13,11 +13,11 @@ public class PGPEceEncryptorImpl extends BasePGPEncrpytorImpl { public PGPEceEncryptorImpl(@Value("${pgp.ece.sigkey-password}") String sigkeyPassword, @Value("${pgp.ece.seckey-file-path}") String seckeyFilePath, @Value("${pgp.ece.pubkey-file-path}") String pubkeyFilePath, - @Value("${pgp.ece.bucket-name}") String bucketName) { - super(); - this.sigkeyPassword = sigkeyPassword; - this.seckeyFilePath = seckeyFilePath; - this.pubkeyFilePath = pubkeyFilePath; - this.bucketName = bucketName; + @Value("${pgp.ece.bucket-name}") String bucketName, + @Value("${form-flow.aws.access_key}") String accessKey, + @Value("${form-flow.aws.secret_key}") String secretKey, + @Value("${form-flow.aws.region}") String region) { + super(sigkeyPassword, seckeyFilePath, pubkeyFilePath, bucketName, accessKey, secretKey, region); + } } diff --git a/src/main/java/org/ladocuploader/app/cli/PGPEncryptorImpl.java b/src/main/java/org/ladocuploader/app/cli/PGPEncryptorImpl.java index dda6443ed..e5f875a95 100644 --- a/src/main/java/org/ladocuploader/app/cli/PGPEncryptorImpl.java +++ b/src/main/java/org/ladocuploader/app/cli/PGPEncryptorImpl.java @@ -13,12 +13,11 @@ public class PGPEncryptorImpl extends BasePGPEncrpytorImpl { public PGPEncryptorImpl(@Value("${pgp.snap.sigkey-password}") String sigkeyPassword, @Value("${pgp.snap.seckey-file-path}") String seckeyFilePath, @Value("${pgp.snap.pubkey-file-path}") String pubkeyFilePath, - @Value("${pgp.snap.bucket-name}") String bucketName) { - super(); - this.sigkeyPassword = sigkeyPassword; - this.seckeyFilePath = seckeyFilePath; - this.pubkeyFilePath = pubkeyFilePath; - this.bucketName = bucketName; + @Value("${pgp.snap.bucket-name}") String bucketName, + @Value("${form-flow.aws.access_key}") String accessKey, + @Value("${form-flow.aws.secret_key}") String secretKey, + @Value("${form-flow.aws.region}") String region) { + super(sigkeyPassword, seckeyFilePath, pubkeyFilePath, bucketName, accessKey, secretKey, region); } } diff --git a/src/main/java/org/ladocuploader/app/cli/PGPWicEncryptorImpl.java b/src/main/java/org/ladocuploader/app/cli/PGPWicEncryptorImpl.java index 9a1f1c247..4b31550c1 100644 --- a/src/main/java/org/ladocuploader/app/cli/PGPWicEncryptorImpl.java +++ b/src/main/java/org/ladocuploader/app/cli/PGPWicEncryptorImpl.java @@ -13,11 +13,10 @@ public class PGPWicEncryptorImpl extends BasePGPEncrpytorImpl { public PGPWicEncryptorImpl(@Value("${pgp.wic.sigkey-password}") String sigkeyPassword, @Value("${pgp.wic.seckey-file-path}") String seckeyFilePath, @Value("${pgp.wic.pubkey-file-path}") String pubkeyFilePath, - @Value("${pgp.wic.bucket-name}") String bucketName) { - super(); - this.sigkeyPassword = sigkeyPassword; - this.seckeyFilePath = seckeyFilePath; - this.pubkeyFilePath = pubkeyFilePath; - this.bucketName = bucketName; + @Value("${pgp.wic.bucket-name}") String bucketName, + @Value("${form-flow.aws.access_key}") String accessKey, + @Value("${form-flow.aws.secret_key}") String secretKey, + @Value("${form-flow.aws.region}") String region) { + super(sigkeyPassword, seckeyFilePath, pubkeyFilePath, bucketName, accessKey, secretKey, region); } }