Skip to content

feat(spring): support Key Vault certificate alias filters - #50018

Open
arnabnandy7 wants to merge 1 commit into
Azure:mainfrom
arnabnandy7:feature/keyvault-certificate-alias-filter
Open

feat(spring): support Key Vault certificate alias filters#50018
arnabnandy7 wants to merge 1 commit into
Azure:mainfrom
arnabnandy7:feature/keyvault-certificate-alias-filter

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Description

Adds Spring configuration support for filtering the certificate aliases loaded by the Azure Key Vault JCA provider.

Applications can now configure alias filter patterns independently for an SSL bundle's keystore and truststore:

  • spring.ssl.bundle.keyvault.<bundle-name>.keystore.certificate-alias-filter-patterns
  • spring.ssl.bundle.keyvault.<bundle-name>.truststore.certificate-alias-filter-patterns

The configured list is passed to the JCA provider through the azure.keyvault.jca.certificate-alias-filter-patterns system property. Include patterns are regular expressions, while exclusion patterns use the ! prefix. When the list is empty, all certificate aliases continue to be loaded, preserving the existing behavior.

The JCA system property is cleared between keystore and truststore initialization to prevent filter settings from leaking between SSL bundles or stores.

This change also:

  • Adds Spring configuration binding coverage for the new properties.
  • Adds unit coverage for propagation to the JCA system property.
  • Updates the Spring Cloud Azure and autoconfigure changelogs.

Resolves #50013.

Depends on #49774, which adds the corresponding certificate alias filtering support to azure-security-keyvault-jca.

The focused tests are:

mvn -f sdk/spring/pom.xml -pl spring-cloud-azure-autoconfigure -am \
  -Dtest=AzureKeyVaultJcaAutoConfigurationTests,AzureKeyVaultSslBundleRegistrarTests \
  -Dsurefire.failIfNoSpecifiedTests=false test

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings August 3, 2026 18:57
@arnabnandy7
arnabnandy7 requested review from a team, moarychan, rujche and saragluna as code owners August 3, 2026 18:57
@github-actions github-actions Bot added azure-spring All azure-spring related issues Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @arnabnandy7! We will review the pull request and get back to you soon.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
31 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Spring SSL bundle configuration support to control which Azure Key Vault JCA certificate aliases are loaded by propagating include/exclude regex patterns into the JCA provider’s system property.

Changes:

  • Added new SSL bundle properties for keystore and truststore certificate alias filter patterns and bound them via Spring configuration.
  • Propagated configured patterns to the Key Vault JCA provider using azure.keyvault.jca.certificate-alias-filter-patterns.
  • Added/updated unit tests and changelog entries documenting the new configuration.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/keyvault/jca/AzureKeyVaultSslBundleRegistrar.java Sets the new alias-filter system property when patterns are configured and includes it in the cleared-property set.
sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/keyvault/jca/properties/AzureKeyVaultSslBundleProperties.java Adds certificateAliasFilterPatterns list to keystore/truststore property model for configuration binding.
sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/keyvault/jca/AzureKeyVaultSslBundleRegistrarTests.java Adds a test for propagating configured patterns to the JCA system property.
sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/keyvault/jca/AzureKeyVaultJcaAutoConfigurationTests.java Extends configuration binding assertions for the new truststore alias-filter property.
sdk/spring/spring-cloud-azure-autoconfigure/CHANGELOG.md Documents the new SSL bundle alias-filter configuration support.
sdk/spring/CHANGELOG.md Adds the feature entry to the aggregated Spring release notes.
Suppressed comments (1)

sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/keyvault/jca/AzureKeyVaultJcaAutoConfigurationTests.java:79

  • After adding keystore alias-filter property values, the test should also assert that the keystore patterns were bound (similar to the truststore assertion above) to ensure the new keystore configuration is actually exercised.
                assertThat(sslBundlesProperties.getKeyvault().get("testBundle3").getTruststore().getKeyvaultRef()).isEqualTo("kv1");
                assertThat(sslBundlesProperties.getKeyvault().get("testBundle3").getKeystore().getKeyvaultRef()).isEqualTo("kv2");

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@arnabnandy7
arnabnandy7 force-pushed the feature/keyvault-certificate-alias-filter branch from 1367efc to ad1c98a Compare August 3, 2026 19:22
@arnabnandy7
arnabnandy7 requested a review from Copilot August 3, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@arnabnandy7

Copy link
Copy Markdown
Contributor Author

@moarychan please review

@moarychan moarychan self-assigned this Aug 4, 2026
@moarychan moarychan added this to the 2026-08 milestone Aug 4, 2026
@moarychan moarychan moved this from Todo to In Progress in Spring Cloud Azure Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-spring All azure-spring related issues Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

[FEATURE REQ] Support KeyVault certificate alias filter on Spring side

3 participants