diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index cadb61a..8839ec7 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -29,9 +29,7 @@ jobs:
delete_old_snapshots:
runs-on: ubuntu-latest
- permissions:
- contents: read
- packages: write
+ permissions: write-all
steps:
@@ -40,6 +38,7 @@ jobs:
with:
organization: assimbly
type: maven
+ token: ${{ secrets.MAVEN_TOKEN }}
keep: 0
semver-pattern: "${{inputs.milestone}}"
names: |
@@ -53,7 +52,6 @@ jobs:
org.assimbly.camel-components
org.assimbly.utils
org.assimbly.extra
- org.assimbly.extra
release-jars:
needs: delete_old_snapshots
@@ -67,7 +65,7 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v4
with:
- repository: ${{ github.repository }}
+ repository: "assimbly/base"
ref: ${{ inputs.branch }}
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml
index 368e3b5..d16eee5 100644
--- a/.github/workflows/update-version.yml
+++ b/.github/workflows/update-version.yml
@@ -3,6 +3,10 @@ name: Update Version Number
on:
workflow_dispatch:
inputs:
+ branch:
+ description: 'Branch to use'
+ type: string
+ default: 'develop'
milestone:
description: 'Milestone to use as version'
type: string
@@ -10,6 +14,10 @@ on:
workflow_call:
inputs:
+ branch:
+ description: 'Branch to use'
+ type: string
+ default: 'develop'
milestone:
description: 'Milestone to use as version'
type: string
@@ -29,8 +37,8 @@ jobs:
- name: Checkout the code
uses: actions/checkout@v4
with:
- repository: ${{ github.repository }}
- ref: ${{ github.ref_name }}
+ repository: assimbly/base
+ ref: ${{ inputs.branch }}
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
@@ -47,12 +55,12 @@ jobs:
run: |
git config --local user.email "raymondmeester@gmail.com"
git config --local user.name "skin27"
- git commit -a -m "Update version to ${{inputs.milestone}}"
+ git diff-index --quiet HEAD || git commit -a -m "Update version to ${{inputs.milestone}}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.RELEASE_TOKEN }}
- repository: ${{ github.repository }}
- ref: ${{ github.ref_name }}
+ repository: assimbly/base
+ ref: ${{ inputs.branch }}
force_with_lease: true
diff --git a/activemqBase/pom.xml b/activemqBase/pom.xml
index 43cd3da..9aa5bd8 100644
--- a/activemqBase/pom.xml
+++ b/activemqBase/pom.xml
@@ -8,7 +8,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
activemq-base
diff --git a/camelBase/pom.xml b/camelBase/pom.xml
index ed8d229..9af10d1 100644
--- a/camelBase/pom.xml
+++ b/camelBase/pom.xml
@@ -8,7 +8,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
camel-base
@@ -106,10 +106,14 @@
org.apache.camel
camel-groovy
-
+
org.apache.camel
camel-joor
@@ -142,6 +146,10 @@
org.apache.camel
camel-metrics
+
+ org.apache.camel
+ camel-micrometer
+
org.apache.camel
camel-quartz
diff --git a/camelComponents/pom.xml b/camelComponents/pom.xml
index 86bbab6..1445890 100644
--- a/camelComponents/pom.xml
+++ b/camelComponents/pom.xml
@@ -8,7 +8,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
camel-components
diff --git a/commonBase/pom.xml b/commonBase/pom.xml
index e7f4686..cb3f8bf 100644
--- a/commonBase/pom.xml
+++ b/commonBase/pom.xml
@@ -8,7 +8,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
common-base
diff --git a/databaseDrivers/pom.xml b/databaseDrivers/pom.xml
index 09fa97b..5950d59 100644
--- a/databaseDrivers/pom.xml
+++ b/databaseDrivers/pom.xml
@@ -8,7 +8,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
database-drivers
diff --git a/extra/pom.xml b/extra/pom.xml
index 24d3333..e595a58 100644
--- a/extra/pom.xml
+++ b/extra/pom.xml
@@ -8,7 +8,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
extra
diff --git a/pom.xml b/pom.xml
index 74dbb82..ae1b014 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
pom
org.assimbly.camelconnector
http://maven.apache.org
- 5.0.0
+ 5.0.2-SNAPSHOT
activemqBase
@@ -41,12 +41,12 @@
1.0
1.4.0
- 5.0.0
+ 5.0.2-SNAPSHOT
6.1.3
- 2.37.0
+ 2.38.0
2.0.0
1.70
- 4.8.0
+ 4.8.1
1.9.4
1.9.0
1.17.1
@@ -62,14 +62,14 @@
1.12.0
db2jcc4
1.11.0
- 4.2.27
- 8.15.2
+ 4.2.28
+ 8.15.3
2.11.0
4.0.23
33.3.1-jre
- 9.4.0.5
+ 9.4.1.0
4.50.11
- 2.18.0
+ 2.18.1
2.1.3
3.0.0
2.1.3
@@ -81,30 +81,29 @@
20240303
1.5.3
2.9.0
- 5.11.1
+ 5.11.3
0.12.6
2.1.1
4.5.14
4.8.0
- 1.5.8
- 3.1.6
- 3.1.6
+ 1.5.12
+ 3.1.7
12.8.1.jre11
- 5.13.0
+ 5.14.2
5.15.0
3.12.11
- 9.0.0
- 4.1.113.Final
+ 9.1.0
+ 4.1.114.Final
23.5.0.24.07
42.7.4
2.0.9
0.34.1
2.0.16
12.0.2
- 6.1.13
- 3.3.4
+ 6.1.14
+ 3.3.5
2.6.0
- 3.46.1.3
+ 3.47.0.0
1.28.5
2.7.3
2.12.2
@@ -125,7 +124,7 @@
org.apache.maven.plugin-tools
maven-plugin-annotations
- 3.15.0
+ 3.15.1
provided
diff --git a/springBase/pom.xml b/springBase/pom.xml
index 797b9b9..7161700 100644
--- a/springBase/pom.xml
+++ b/springBase/pom.xml
@@ -8,7 +8,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
spring-base
diff --git a/testBase/pom.xml b/testBase/pom.xml
index 75ad591..5e9a2c2 100644
--- a/testBase/pom.xml
+++ b/testBase/pom.xml
@@ -5,7 +5,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
4.0.0
@@ -86,12 +86,12 @@
${mockito.version}
compile
-
+
diff --git a/utils/pom.xml b/utils/pom.xml
index 4e94d59..f6cdc30 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -4,7 +4,7 @@
base
org.assimbly
- 5.0.0
+ 5.0.2-SNAPSHOT
utils
diff --git a/utils/src/main/java/org/assimbly/util/EncryptionUtil.java b/utils/src/main/java/org/assimbly/util/EncryptionUtil.java
index 4772c18..bd12361 100644
--- a/utils/src/main/java/org/assimbly/util/EncryptionUtil.java
+++ b/utils/src/main/java/org/assimbly/util/EncryptionUtil.java
@@ -3,17 +3,28 @@
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.iv.RandomIvGenerator;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.SecureRandom;
+import java.util.Base64;
+
public final class EncryptionUtil {
private final StandardPBEStringEncryptor textEncryptor = new StandardPBEStringEncryptor();
+ private static final int SALT_LENGTH = 16; // Length of the salt in bytes
+ private static final int IV_LENGTH = 16; // Length of the IV in bytes
public static String key;
public static String algorithm;
+ public static String password;
public EncryptionUtil(String password, String algorithm) {
+ this.password = password;
this.textEncryptor.setPassword(password);
this.textEncryptor.setAlgorithm(algorithm);
this.textEncryptor.setIvGenerator(new RandomIvGenerator());
-
}
public StandardPBEStringEncryptor getTextEncryptor() {
@@ -21,15 +32,91 @@ public StandardPBEStringEncryptor getTextEncryptor() {
}
public String encrypt(String plainText) {
- //if value already encrypted do not encrypt and return
+ // If the value is already encrypted, do not encrypt again and return
if (plainText.startsWith("ENC(") && plainText.endsWith(")")) {
return plainText;
}
- return "ENC(" + this.textEncryptor.encrypt(plainText) + ")";
+
+ // Generate random salt
+ byte[] salt = new byte[SALT_LENGTH];
+ new SecureRandom().nextBytes(salt);
+
+ // Generate random IV
+ byte[] iv = new byte[IV_LENGTH];
+ new SecureRandom().nextBytes(iv);
+
+ // Generate key from password and salt
+ SecretKeySpec secretKey = new SecretKeySpec(generateKey(password, salt), "AES");
+
+ // Encrypt the plain text
+ byte[] encryptedBytes = encryptWithIv(secretKey, iv, plainText);
+
+ // Encode the salt, IV, and encrypted text
+ Base64.Encoder encoder = Base64.getEncoder();
+ String encodedSalt = encoder.encodeToString(salt);
+ String encodedIv = encoder.encodeToString(iv);
+ String encodedEncryptedText = encoder.encodeToString(encryptedBytes);
+
+ // Concatenate and return
+ return String.format("ENC(%s|%s|%s)", encodedSalt, encodedIv, encodedEncryptedText);
+ }
+
+ public String decrypt(String encryptedText) {
+ // Validate and extract components
+ if (!encryptedText.startsWith("ENC(") || !encryptedText.endsWith(")")) {
+ throw new IllegalArgumentException("Invalid encrypted text format.");
+ }
+
+ String contents = encryptedText.substring(4, encryptedText.length() - 1);
+ String[] parts = contents.split("\\|");
+ if (parts.length != 3) {
+ throw new IllegalArgumentException("Invalid encrypted text format.");
+ }
+
+ Base64.Decoder decoder = Base64.getDecoder();
+ byte[] salt = decoder.decode(parts[0]);
+ byte[] iv = decoder.decode(parts[1]);
+ byte[] encryptedBytes = decoder.decode(parts[2]);
+
+ // Generate key from password and salt
+ SecretKeySpec secretKey = new SecretKeySpec(generateKey(password, salt), "AES");
+
+ // Decrypt the encrypted text
+ return decryptWithIv(secretKey, iv, encryptedBytes);
+ }
+
+
+ private byte[] generateKey(String password, byte[] salt) {
+ try {
+ PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 10000, 256); // 10000 iterations, 256 bits
+ SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
+ return factory.generateSecret(spec).getEncoded();
+ } catch (Exception e) {
+ throw new RuntimeException("Key generation failed.", e);
+ }
+ }
+
+ private byte[] encryptWithIv(SecretKeySpec secretKey, byte[] iv, String plainText) {
+ try {
+ Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ IvParameterSpec ivParams = new IvParameterSpec(iv);
+ cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParams);
+ return cipher.doFinal(plainText.getBytes("UTF-8")); // Use UTF-8 encoding
+ } catch (Exception e) {
+ throw new RuntimeException("Encryption failed.", e);
+ }
}
- public String decrypt(String encryptedText){
- return this.textEncryptor.decrypt(encryptedText);
+ private String decryptWithIv(SecretKeySpec secretKey, byte[] iv, byte[] encryptedBytes) {
+ try {
+ Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ IvParameterSpec ivParams = new IvParameterSpec(iv);
+ cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParams);
+ byte[] decryptedBytes = cipher.doFinal(encryptedBytes);
+ return new String(decryptedBytes, "UTF-8"); // Use UTF-8 encoding
+ } catch (Exception e) {
+ throw new RuntimeException("Decryption failed.", e);
+ }
}
}
diff --git a/utils/src/main/java/org/assimbly/util/domain/AssimblyEvent.java b/utils/src/main/java/org/assimbly/util/domain/AssimblyEvent.java
index ce8f863..3b5eb2b 100644
--- a/utils/src/main/java/org/assimbly/util/domain/AssimblyEvent.java
+++ b/utils/src/main/java/org/assimbly/util/domain/AssimblyEvent.java
@@ -10,16 +10,16 @@ public class AssimblyEvent implements Serializable {
private final String timestamp;
private final String expiryDate;
- private final String bundleId;
+ private final String flowId;
private final int flowVersion;
private final String component;
private final String body;
private final Map headers;
- public AssimblyEvent(String timestamp, String expiryDate, String bundleId, int flowVersion, String component, String body, Map headers) {
+ public AssimblyEvent(String timestamp, String expiryDate, String flowId, int flowVersion, String component, String body, Map headers) {
this.timestamp = timestamp;
this.expiryDate = expiryDate;
- this.bundleId = bundleId;
+ this.flowId = flowId;
this.flowVersion = flowVersion;
this.component = component;
this.body = body;
@@ -34,8 +34,8 @@ public String getTimestamp() {
return timestamp;
}
- public String getBundleId() {
- return bundleId;
+ public String getFlowId() {
+ return flowId;
}
public int getFlowVersion() {
diff --git a/utils/src/main/java/org/assimbly/util/domain/FlowRegistry.java b/utils/src/main/java/org/assimbly/util/domain/FlowRegistry.java
index 0675c16..be748e6 100644
--- a/utils/src/main/java/org/assimbly/util/domain/FlowRegistry.java
+++ b/utils/src/main/java/org/assimbly/util/domain/FlowRegistry.java
@@ -40,7 +40,7 @@ public FlowInfo getFlow(String flowId) {
public HashMap getRegisteredFlows() { return new HashMap<>(registeredFlows); }
- public void unregister(String bundleId) { registeredFlows.remove(bundleId); }
+ public void unregister(String flowId) { registeredFlows.remove(flowId); }
public static FlowRegistry getInstance() {
return INSTANCE;