Skip to content

Commit 2b2caf5

Browse files
committed
[Docs] Workaround for env var auth params
Also fix collapsible section on authentication.adoc
1 parent 7a47497 commit 2b2caf5

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/authentication.adoc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,29 @@ For example, if you want to configure the issuer url for the `AuthenticationOAut
1313
If you use other forms, such as `issuerurl` or `issuer-url`, the setting will not be applied to the plugin.
1414
====
1515

16+
[[client-authentication-env-vars]]
17+
[TIP]
18+
====
19+
Using environment variables for auth parameters is typically problematic because the case sensitivity is lost during translation.
20+
For example, consider the following `issuerUrl` auth parameter set via an environment variable:
21+
[source,properties]
22+
----
23+
SPRING_PULSAR_CLIENT_AUTHENTICATION_PARAM_ISSUERURL=https://some.server.com
24+
----
25+
When Spring Boot loads this property it will use `issuerurl` (lower-cased) rather than the expected `issuerUrl` (camel-cased).
26+
You can get around this limitation by using the value of the env var as the value of the related auth property in your application.yml.
27+
Continuing the example above:
28+
[source,yaml]
29+
----
30+
spring:
31+
pulsar:
32+
client:
33+
authentication:
34+
param:
35+
issuerUrl: ${SPRING_PULSAR_CLIENT_AUTHENTICATION_PARAM_ISSUERURL}
36+
----
37+
====
38+
1639
When **not using Spring Boot** auto-configuration, you can use the `org.apache.pulsar.client.api.AuthenticationFactory` to create the authentication and then set it directly on the Pulsar client builder in a client customizer that you provide to the client factory.
1740

1841

@@ -22,6 +45,7 @@ The following listings show how to configure each of the supported authenticatio
2245
.[.underline]#Click ##here## for **Athenz**#
2346
[%collapsible]
2447
[source, yaml]
48+
====
2549
----
2650
spring:
2751
pulsar:
@@ -36,11 +60,13 @@ spring:
3660
keyId: ...
3761
----
3862
NOTE: This also requires xref:reference/pulsar.adoc#tls-encryption[TLS encryption].
63+
====
3964

4065
[[Token]]
4166
.[.underline]#Click ##here## for **Token**#
4267
[%collapsible]
4368
[source, yaml]
69+
====
4470
----
4571
spring:
4672
pulsar:
@@ -50,11 +76,13 @@ spring:
5076
param:
5177
token: some-token-goes-here
5278
----
79+
====
5380
5481
[[Basic]]
5582
.[.underline]#Click ##here## for **Basic**#
5683
[%collapsible]
5784
[source, yaml]
85+
====
5886
----
5987
spring:
6088
pulsar:
@@ -65,11 +93,13 @@ spring:
6593
userId: ...
6694
password: ...
6795
----
96+
====
6897
6998
[[OAuth2]]
7099
.[.underline]#Click ##here## for **OAuth2**#
71100
[%collapsible]
72101
[source, yaml]
102+
====
73103
----
74104
spring:
75105
pulsar:
@@ -82,11 +112,13 @@ spring:
82112
audience: ...
83113
scope: ...
84114
----
115+
====
85116
86117
[[Sasl]]
87118
.[.underline]#Click ##here## for **Sasl**#
88119
[%collapsible]
89120
[source, yaml]
121+
====
90122
----
91123
spring:
92124
pulsar:
@@ -97,6 +129,7 @@ spring:
97129
saslJaasClientSectionName: ...
98130
serverType: ...
99131
----
132+
====
100133
101134
[[mTlS-pem]]
102135
.[.underline]#Click ##here## for **mTLS (PEM)**#

0 commit comments

Comments
 (0)