davsclaus opened a new pull request, #31053: URL: https://github.com/apache/camel/pull/31053
JIRA: [CAMEL-27749](https://issues.apache.org/jira/browse/CAMEL-27749) When the `tokenCredential` option is a `DefaultAzureCredential`, camel-azure-eventgrid, camel-azure-servicebus and camel-azure-eventhubs choose `credentialType` `AZURE_IDENTITY`. For `AZURE_IDENTITY`, the clients were then built with `new DefaultAzureCredentialBuilder().build()`, so a credential that the user built with `managedIdentityClientId(...)`, `tenantId(...)` or other settings was not used. In eventgrid this also happened with an explicit `credentialType=TOKEN_CREDENTIAL`, because the component replaced it with `AZURE_IDENTITY`. Changes: - `EventGridProducer`, `ServiceBusClientFactory` and `EventHubsClientFactory` (producer, consumer and event processor clients): `AZURE_IDENTITY` uses the `tokenCredential` instance when it is set, and builds a new `DefaultAzureCredential` only when it is not. - `EventGridComponent`: an explicit `TOKEN_CREDENTIAL` or `AZURE_IDENTITY` is kept when `tokenCredential` is set. Otherwise the type is still `AZURE_IDENTITY` for a `DefaultAzureCredential` and `TOKEN_CREDENTIAL` for another credential, as before (and as in the other two components). - Descriptions of `tokenCredential` and `credentialType` in the three components. - Upgrade-guide entry, as a configured `DefaultAzureCredential` is now the one that authenticates. - Tests with no Azure access. Mockito `mockConstruction` of the client builders checks that `credential(...)` gets the configured instance: - `EventGridTokenCredentialTest`: `tokenCredential` alone, with `credentialType=TOKEN_CREDENTIAL`, and `AZURE_IDENTITY` without `tokenCredential`. - `ServiceBusClientFactoryCredentialTest`. - `EventHubsClientFactoryCredentialTest`: producer and consumer clients. Without the fix, the eventgrid and servicebus tests fail. All unit tests of the three modules pass. - Regenerated the component JSON, the catalog copies and the endpoint/component DSL. Related: [CAMEL-27737](https://issues.apache.org/jira/browse/CAMEL-27737). Its item 3 (an explicit credentialType is overwritten) is fixed here only for `tokenCredential` with `TOKEN_CREDENTIAL` / `AZURE_IDENTITY`. An access key still forces `ACCESS_KEY`, and item 2 (the dead `AZURE_IDENTITY` fallback) is not touched. To be backported to camel-4.18.x and camel-4.22.x after the merge. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
