This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 56abd3eff2d2 CAMEL-27991: camel-azure-key-vault - dev console shows
the wrong login (#31263)
56abd3eff2d2 is described below
commit 56abd3eff2d2f921b0a62e680276e1c5b7234321
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Dec 3 08:42:01 2026 +0100
CAMEL-27991: camel-azure-key-vault - dev console shows the wrong login
(#31263)
Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../apache/camel/catalog/dev-consoles-openapi.json | 2 +-
.../camel/catalog/dev-consoles/azure-secrets.json | 2 +-
.../apache/camel/dev-console/azure-secrets.json | 2 +-
.../key/vault/AzureKeyVaultManagerDevConsole.java | 7 +--
.../key/vault/EventhubsReloadTriggerTask.java | 3 ++
.../key/vault/KeyVaultPropertiesFunction.java | 9 ++++
.../vault/AzureKeyVaultManagerDevConsoleTest.java | 63 +++++++++++++++++++++-
.../EventhubsReloadTriggerTaskCheckpointTest.java | 60 +++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc | 8 +++
9 files changed, 148 insertions(+), 8 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles-openapi.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles-openapi.json
index 948a54d7ffba..ff2a1e5105dc 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles-openapi.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles-openapi.json
@@ -177,7 +177,7 @@
"properties": {
"login": {
"type": "string",
-
"description": "The login method the Azure Key Vault properties
function reports, currently always Client Id\/Client Secret, also when Azure
Identity is used (only present when the function is active)"
+
"description": "The login method the Azure Key Vault properties
function uses: 'Azure Identity' when azureIdentityEnabled is set, otherwise
'Client Id\/Client Secret' (only present when the function is active)"
},
"refreshEnabled": {
"type": "boolean",
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles/azure-secrets.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles/azure-secrets.json
index 63e31f80e398..b071c565ce05 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles/azure-secrets.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dev-consoles/azure-secrets.json
@@ -17,7 +17,7 @@
"properties": {
"login": {
"type": "string",
- "description": "The login method the Azure Key Vault properties
function reports, currently always Client Id\/Client Secret, also when Azure
Identity is used (only present when the function is active)"
+ "description": "The login method the Azure Key Vault properties
function uses: 'Azure Identity' when azureIdentityEnabled is set, otherwise
'Client Id\/Client Secret' (only present when the function is active)"
},
"refreshEnabled": {
"type": "boolean",
diff --git
a/components/camel-azure/camel-azure-key-vault/src/generated/resources/META-INF/org/apache/camel/dev-console/azure-secrets.json
b/components/camel-azure/camel-azure-key-vault/src/generated/resources/META-INF/org/apache/camel/dev-console/azure-secrets.json
index 63e31f80e398..b071c565ce05 100644
---
a/components/camel-azure/camel-azure-key-vault/src/generated/resources/META-INF/org/apache/camel/dev-console/azure-secrets.json
+++
b/components/camel-azure/camel-azure-key-vault/src/generated/resources/META-INF/org/apache/camel/dev-console/azure-secrets.json
@@ -17,7 +17,7 @@
"properties": {
"login": {
"type": "string",
- "description": "The login method the Azure Key Vault properties
function reports, currently always Client Id\/Client Secret, also when Azure
Identity is used (only present when the function is active)"
+ "description": "The login method the Azure Key Vault properties
function uses: 'Azure Identity' when azureIdentityEnabled is set, otherwise
'Client Id\/Client Secret' (only present when the function is active)"
},
"refreshEnabled": {
"type": "boolean",
diff --git
a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsole.java
b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsole.java
index cac71475d6eb..ec4ffc1ee7b4 100644
---
a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsole.java
+++
b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsole.java
@@ -46,7 +46,7 @@ public class AzureKeyVaultManagerDevConsole extends
AbstractDevConsole {
}
public record Response(
- @Metadata(description = "The login method the Azure Key Vault
properties function reports, currently always Client Id/Client Secret, also
when Azure Identity is used (only present when the function is active)") String
login,
+ @Metadata(description = "The login method the Azure Key Vault
properties function uses: 'Azure Identity' when azureIdentityEnabled is set,
otherwise 'Client Id/Client Secret' (only present when the function is
active)") String login,
@Metadata(description = "Whether Camel reloads when a secret in
use is updated (only present when the Azure vault configuration exists)")
Boolean refreshEnabled,
@Metadata(description = "The refresh period of the Azure vault
configuration, in milliseconds (only present when that configuration exists)")
Long refreshPeriod,
@Metadata(description = "Epoch time in milliseconds of the last
check for updated secrets (only present when known)") Long lastCheckTimestamp,
@@ -84,8 +84,9 @@ public class AzureKeyVaultManagerDevConsole extends
AbstractDevConsole {
if (propertiesFunction != null) {
sb.append("Azure Key Vault Secret Manager:");
- sb.append("\n Login: Client Id/Client Secret");
AzureVaultConfiguration azure =
getCamelContext().getVaultConfiguration().getAzureVaultConfiguration();
+ String loginMethod = propertiesFunction.isAzureIdentityEnabled() ?
"Azure Identity" : "Client Id/Client Secret";
+ sb.append(String.format("%n Login: %s", loginMethod));
if (azure != null) {
sb.append(String.format("%n Refresh Enabled: %s",
azure.isRefreshEnabled()));
sb.append(String.format("%n Refresh Period: %s",
azure.getRefreshPeriod()));
@@ -129,8 +130,8 @@ public class AzureKeyVaultManagerDevConsole extends
AbstractDevConsole {
List<SecretEntry> secrets = null;
if (propertiesFunction != null) {
- login = "Client Id/Client Secret";
AzureVaultConfiguration azure =
getCamelContext().getVaultConfiguration().getAzureVaultConfiguration();
+ login = propertiesFunction.isAzureIdentityEnabled() ? "Azure
Identity" : "Client Id/Client Secret";
if (azure != null) {
refreshEnabled = azure.isRefreshEnabled();
refreshPeriod = azure.getRefreshPeriod();
diff --git
a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/EventhubsReloadTriggerTask.java
b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/EventhubsReloadTriggerTask.java
index d6ae21b33fc0..0e5b75903efb 100644
---
a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/EventhubsReloadTriggerTask.java
+++
b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/EventhubsReloadTriggerTask.java
@@ -242,6 +242,9 @@ public class EventhubsReloadTriggerTask extends
ServiceSupport implements CamelC
reload.onReload(this);
}
}
+ // Checkpoint after processing so that after a restart the processor
resumes
+ // from the next event rather than from EventPosition.latest() (the
default when no checkpoint exists)
+ eventContext.updateCheckpoint();
}
private static JsonNode retrieveEventData(EventContext eventContext) {
diff --git
a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultPropertiesFunction.java
b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultPropertiesFunction.java
index b163bc58ec91..52ce89fd2021 100644
---
a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultPropertiesFunction.java
+++
b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultPropertiesFunction.java
@@ -90,6 +90,7 @@ public class KeyVaultPropertiesFunction extends
ServiceSupport implements Proper
private static final ObjectMapper MAPPER =
JsonMapper.builderWithJackson2Defaults().build();
private CamelContext camelContext;
private SecretClient client;
+ private boolean azureIdentityEnabled;
// this function is shared and invoked concurrently
private final Set<String> secrets = ConcurrentHashMap.newKeySet();
@@ -121,6 +122,7 @@ public class KeyVaultPropertiesFunction extends
ServiceSupport implements Proper
azureIdentityEnabled =
azureVaultConfiguration.isAzureIdentityEnabled();
}
}
+ this.azureIdentityEnabled = azureIdentityEnabled;
if (ObjectHelper.isNotEmpty(vaultName) &&
ObjectHelper.isNotEmpty(clientId) && ObjectHelper.isNotEmpty(clientSecret)
&& ObjectHelper.isNotEmpty(tenantId) && !azureIdentityEnabled)
{
String keyVaultUri = "https://" + vaultName + ".vault.azure.net";
@@ -154,6 +156,13 @@ public class KeyVaultPropertiesFunction extends
ServiceSupport implements Proper
}
}
+ /**
+ * Whether Azure Identity authentication is used by this properties
function.
+ */
+ public boolean isAzureIdentityEnabled() {
+ return azureIdentityEnabled;
+ }
+
@Override
protected void doStop() throws Exception {
secrets.clear();
diff --git
a/components/camel-azure/camel-azure-key-vault/src/test/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsoleTest.java
b/components/camel-azure/camel-azure-key-vault/src/test/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsoleTest.java
index ff7059903451..d5ae6a57d3c9 100644
---
a/components/camel-azure/camel-azure-key-vault/src/test/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsoleTest.java
+++
b/components/camel-azure/camel-azure-key-vault/src/test/java/org/apache/camel/component/azure/key/vault/AzureKeyVaultManagerDevConsoleTest.java
@@ -26,10 +26,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class AzureKeyVaultManagerDevConsoleTest extends CamelTestSupport {
+class AzureKeyVaultManagerDevConsoleTest extends CamelTestSupport {
@Test
- public void testAzureSecretsConsoleNoPropertiesFunction() {
+ void testAzureSecretsConsoleNoPropertiesFunction() {
DevConsole con =
PluginHelper.getDevConsoleResolver(context).resolveDevConsole("azure-secrets");
assertNotNull(con);
assertEquals("camel", con.getGroup());
@@ -42,4 +42,63 @@ public class AzureKeyVaultManagerDevConsoleTest extends
CamelTestSupport {
assertNotNull(out);
assertTrue(out.isEmpty());
}
+
+ @Test
+ void testConsoleLoginMethodWithAzureIdentityEnabled() throws Exception {
+ // Register a stub properties function that reports
azureIdentityEnabled=true
+ // without making real Azure calls
+ KeyVaultPropertiesFunction stubFunction = new
KeyVaultPropertiesFunction() {
+ @Override
+ public boolean isAzureIdentityEnabled() {
+ return true;
+ }
+
+ @Override
+ protected void doStart() {
+ // skip Azure credential resolution — we are testing the
console, not the function
+ }
+ };
+ stubFunction.setCamelContext(context);
+ context.getPropertiesComponent().addPropertiesFunction(stubFunction);
+ stubFunction.start();
+
+ AzureKeyVaultManagerDevConsole con = new
AzureKeyVaultManagerDevConsole();
+ con.setCamelContext(context);
+ con.start();
+
+ JsonObject out = (JsonObject) con.call(DevConsole.MediaType.JSON);
+ assertNotNull(out);
+ assertEquals("Azure Identity", out.get("login"));
+
+ con.stop();
+ }
+
+ @Test
+ void testConsoleLoginMethodWithClientIdClientSecret() throws Exception {
+ // Register a stub properties function that reports
azureIdentityEnabled=false
+ KeyVaultPropertiesFunction stubFunction = new
KeyVaultPropertiesFunction() {
+ @Override
+ public boolean isAzureIdentityEnabled() {
+ return false;
+ }
+
+ @Override
+ protected void doStart() {
+ // skip Azure credential resolution
+ }
+ };
+ stubFunction.setCamelContext(context);
+ context.getPropertiesComponent().addPropertiesFunction(stubFunction);
+ stubFunction.start();
+
+ AzureKeyVaultManagerDevConsole con = new
AzureKeyVaultManagerDevConsole();
+ con.setCamelContext(context);
+ con.start();
+
+ JsonObject out = (JsonObject) con.call(DevConsole.MediaType.JSON);
+ assertNotNull(out);
+ assertEquals("Client Id/Client Secret", out.get("login"));
+
+ con.stop();
+ }
}
diff --git
a/components/camel-azure/camel-azure-key-vault/src/test/java/org/apache/camel/component/azure/key/vault/EventhubsReloadTriggerTaskCheckpointTest.java
b/components/camel-azure/camel-azure-key-vault/src/test/java/org/apache/camel/component/azure/key/vault/EventhubsReloadTriggerTaskCheckpointTest.java
new file mode 100644
index 000000000000..8177ce5ce6a9
--- /dev/null
+++
b/components/camel-azure/camel-azure-key-vault/src/test/java/org/apache/camel/component/azure/key/vault/EventhubsReloadTriggerTaskCheckpointTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://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 org.apache.camel.component.azure.key.vault;
+
+import java.time.Instant;
+
+import com.azure.messaging.eventhubs.EventData;
+import com.azure.messaging.eventhubs.models.EventContext;
+import com.azure.messaging.eventhubs.models.PartitionContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * Verifies that onEventListener calls updateCheckpoint() after processing, so
that the Event Hubs processor advances
+ * its offset on restart instead of replaying from the beginning.
+ */
+class EventhubsReloadTriggerTaskCheckpointTest {
+
+ @Test
+ void testUpdateCheckpointIsCalledAfterProcessing() throws Exception {
+ // A JSON array that does not match the SECRET_VERSION_ADD event type —
+ // simplest payload that makes the loop execute without triggering
reload
+ String payload =
"[{\"subject\":\"irrelevant\",\"eventType\":\"Other.Event\"}]";
+
+ EventData eventData = mock(EventData.class);
+ when(eventData.getBodyAsString()).thenReturn(payload);
+ when(eventData.getEnqueuedTime()).thenReturn(Instant.now());
+
+ PartitionContext partitionContext = mock(PartitionContext.class);
+ EventContext eventContext = mock(EventContext.class);
+ when(eventContext.getEventData()).thenReturn(eventData);
+ when(eventContext.getPartitionContext()).thenReturn(partitionContext);
+
+ EventhubsReloadTriggerTask task = new EventhubsReloadTriggerTask();
+ task.setCamelContext(new DefaultCamelContext());
+
+ task.onEventListener(eventContext);
+
+ // The checkpoint must be written regardless of whether a reload was
triggered
+ verify(eventContext).updateCheckpoint();
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index fc24ce5fe1ba..2c676b5fb8ed 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -75,6 +75,14 @@ the builder of Azure Identity instead:
builderClass: com.azure.identity.DefaultAzureCredentialBuilder
----
+=== camel-azure-key-vault - EventhubsReloadTriggerTask now checkpoints after
processing
+
+`EventhubsReloadTriggerTask` now writes an Event Hubs checkpoint after each
event.
+Previously no checkpoint was written, so after a restart the task started at
`EventPosition.latest()` and ignored
+`SecretNewVersionCreated` events that arrived while the application was down
(the application resolves the current
+secret values when it starts). Now a restart replays the
`SecretNewVersionCreated` events since the last checkpoint,
+up to the retention of the hub, and a matching event triggers a context reload
right after startup.
+
=== camel-pqc - default-material accessors and provider resolution
The `PQCDefault*Material` helper classes now initialize their default
cryptographic material lazily. Their backing