-
Notifications
You must be signed in to change notification settings - Fork 2.2k
KeyVault JCA: lazy-load certificate material and add alias regex filtering #49774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6c8ec90
86621f2
f4371a4
5507d46
cc494aa
b3cd9d5
7875700
a343059
a6fbf69
9d74fac
162a828
d588c4d
b4aae28
c553796
c73eb95
72887a0
ce99b3e
7ec6baf
f34921f
9506d26
35885e3
e67607c
8cddbf0
f1ce384
470b184
524655e
7662126
60907c2
d75b0e2
b3120a8
91a495c
a407a55
31c94e2
fb84762
e450841
7c23284
207c42d
4479907
15c6dcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -141,6 +141,7 @@ The JCA library supports configuring the following options: | |||||||||||||||||||||
| * `azure.keyvault.jca.refresh-certificates-when-have-un-trust-certificate`: Indicates whether to refresh certificates when have untrusted certificate. | ||||||||||||||||||||||
| * `azure.keyvault.jca.certificates-refresh-interval`: The refresh interval time. | ||||||||||||||||||||||
| * `azure.keyvault.jca.certificates-refresh-interval-in-ms`: The refresh interval time. | ||||||||||||||||||||||
|
rujche marked this conversation as resolved.
|
||||||||||||||||||||||
| * `azure.keyvault.jca.certificate-alias-filter-pattern`: A regex that filters which Key Vault certificate aliases are eligible for lazy loading. Append a suffix to the property name to configure more than one filter, for example `azure.keyvault.jca.certificate-alias-filter-pattern.1` or `azure.keyvault.jca.certificate-alias-filter-pattern.prod`. If no such property is configured, all discovered Key Vault aliases are eligible for lazy loading. See "Filtering Key Vault certificate aliases" below. | ||||||||||||||||||||||
| * `azure.keyvault.disable-challenge-resource-verification`: Indicates whether to disable verification that the authentication challenge resource matches the Key Vault or Managed HSM domain. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| You can configure these properties using: | ||||||||||||||||||||||
|
|
@@ -152,6 +153,30 @@ or as a JVM argument: | |||||||||||||||||||||
| -Dazure.keyvault.uri=<your-azure-keyvault-uri> | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #### Filtering Key Vault certificate aliases | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Each filter is configured as its own property, so no delimiter is required and a pattern may contain any character: | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```shell | ||||||||||||||||||||||
| -Dazure.keyvault.jca.certificate-alias-filter-pattern.1='^prod-.*' | ||||||||||||||||||||||
| -Dazure.keyvault.jca.certificate-alias-filter-pattern.2='^cert-\d{1,5}$' | ||||||||||||||||||||||
| -Dazure.keyvault.jca.certificate-alias-filter-pattern.exclude-old='!.*-old$' | ||||||||||||||||||||||
|
Comment on lines
+161
to
+163
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small suggestion to make the following points that talk about case sensitivity easier to read:
Suggested change
|
||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| * Use an include pattern directly and an exclude pattern with a `!` prefix. | ||||||||||||||||||||||
| * A suffix can be a number or a string. It only keeps the property names unique and does not affect evaluation, so the filters are unordered. Property names are case-sensitive, which means `.prod` and `.PROD` are two different filters. | ||||||||||||||||||||||
| * Patterns use full-alias matching (`Pattern.matcher(alias).matches()`). | ||||||||||||||||||||||
| * An alias is loaded only if it matches at least one include pattern, or if no include pattern is configured, and matches no exclude pattern. | ||||||||||||||||||||||
| * An invalid pattern fails fast with an `IllegalArgumentException` that names the offending pattern. | ||||||||||||||||||||||
|
Comment on lines
+166
to
+170
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Quote the value as required by your shell, otherwise characters such as `^` and `\` can be altered before the JVM receives them: | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| | Shell | Example | | ||||||||||||||||||||||
| | --- | --- | | ||||||||||||||||||||||
| | Bash, including Git Bash | `-Dazure.keyvault.jca.certificate-alias-filter-pattern.1='^prod-.*'` | | ||||||||||||||||||||||
| | PowerShell | `'-Dazure.keyvault.jca.certificate-alias-filter-pattern.1=^prod-.*'` | | ||||||||||||||||||||||
| | Windows `cmd.exe` | `"-Dazure.keyvault.jca.certificate-alias-filter-pattern.1=^^prod-.*"` | | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### SSL/TLS | ||||||||||||||||||||||
| #### Server side SSL | ||||||||||||||||||||||
| If you are looking to integrate the JCA provider to create an SSLServerSocket see the example below. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.