Claus Ibsen created CAMEL-27732:
-----------------------------------
Summary: camel-azure-key-vault: autowired SecretClient rejected,
no component options, metadata nits
Key: CAMEL-27732
URL: https://issues.apache.org/jira/browse/CAMEL-27732
Project: Camel
Issue Type: Bug
Components: camel-azure
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-azure-key-vault for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/8f9e456c7d5f948a5ba6bcc15ac50e67bde5ba31).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. An autowired SecretClient fails the credential check
{{KeyVaultComponent.createEndpoint()}} fails with "Azure Secret Client or
client Id, client secret and tenant Id must be specified" when the credential
type is {{CLIENT_SECRET}} (the default), {{secretClient}} is null and one of
{{clientId}}, {{clientSecret}} or {{tenantId}} is missing. The {{secretClient}}
option is marked {{autowired = true}}, but autowiring only happens later, in
{{DefaultEndpoint.doInit()}}. So a single {{SecretClient}} bean in the registry
is never used unless the route also sets {{credentialType=AZURE_IDENTITY}} or
all three credentials, and the user sees the error above.
Proposed change: move the check to {{KeyVaultEndpoint.doInit()}} after
{{super.doInit()}}, or skip it when the registry holds a single
{{SecretClient}}.
h4. 2. The component configuration cannot be set
{{KeyVaultComponent}} has a {{@Metadata}} field {{configuration}} without a
getter and a setter. The generated {{KeyVaultComponentConfigurer}} only knows
{{lazyStartProducer}} and {{autowiredEnabled}}, so options such as
{{camel.component.azure-key-vault.client-id}} or a component-wide
{{secretClient}} cannot be configured, and the catalog lists no component
options. Other Azure components expose the configuration on the component.
Proposed change: add {{getConfiguration()}}/{{setConfiguration()}} with a
description, so the configuration options become component options too.
h4. 3. vaultName is not marked required
{{KeyVaultComponent.createEndpoint()}} throws "A vault name must be specified."
when the path is empty, but the {{@UriPath}} of {{vaultName}} in
{{KeyVaultConfiguration}} has no {{@Metadata(required = true)}}, so the catalog
shows it as optional.
Proposed change: add {{@Metadata(required = true)}}.
h4. 4. operation has no defaultValue in the metadata
{{KeyVaultConfiguration.operation}} defaults to
{{KeyVaultOperation.createSecret}} in the code, but its {{@UriParam}} has no
{{defaultValue}}, so the catalog and the docs show no default.
Proposed change: add {{defaultValue = "createSecret"}}.
h4. 5. The category is listed twice
{{KeyVaultEndpoint}} lists {{Category.CLOUD}} twice in the {{category}} of
{{@UriEndpoint}}, so the DSL Javadoc shows "Category: cloud,cloud".
Proposed change: keep one {{Category.CLOUD}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)