Skip to content

Commit 6b6f0be

Browse files
authored
Document workaround for env var auth params (#581)
Also fix collapsible section on authentication.adoc
1 parent 5aeb67a commit 6b6f0be

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,28 @@ 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+
[TIP]
17+
====
18+
Using environment variables for auth parameters is typically problematic because the case sensitivity is lost during translation.
19+
For example, consider the following `issuerUrl` auth parameter set via an environment variable:
20+
[source,properties]
21+
----
22+
SPRING_PULSAR_CLIENT_AUTHENTICATION_PARAM_ISSUERURL=https://some.server.com
23+
----
24+
When Spring Boot loads this property it will use `issuerurl` (lower-cased) rather than the expected `issuerUrl` (camel-cased).
25+
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.
26+
Continuing the example above:
27+
[source,yaml]
28+
----
29+
spring:
30+
pulsar:
31+
client:
32+
authentication:
33+
param:
34+
issuerUrl: ${SPRING_PULSAR_CLIENT_AUTHENTICATION_PARAM_ISSUERURL}
35+
----
36+
====
37+
1638
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.
1739

1840

@@ -22,6 +44,7 @@ The following listings show how to configure each of the supported authenticatio
2244
.[.underline]#Click ##here## for **Athenz**#
2345
[%collapsible]
2446
[source, yaml]
47+
====
2548
----
2649
spring:
2750
pulsar:
@@ -36,11 +59,13 @@ spring:
3659
keyId: ...
3760
----
3861
NOTE: This also requires xref:reference/pulsar.adoc#tls-encryption[TLS encryption].
62+
====
3963

4064
[[Token]]
4165
.[.underline]#Click ##here## for **Token**#
4266
[%collapsible]
4367
[source, yaml]
68+
====
4469
----
4570
spring:
4671
pulsar:
@@ -50,11 +75,13 @@ spring:
5075
param:
5176
token: some-token-goes-here
5277
----
78+
====
5379
5480
[[Basic]]
5581
.[.underline]#Click ##here## for **Basic**#
5682
[%collapsible]
5783
[source, yaml]
84+
====
5885
----
5986
spring:
6087
pulsar:
@@ -65,11 +92,13 @@ spring:
6592
userId: ...
6693
password: ...
6794
----
95+
====
6896
6997
[[OAuth2]]
7098
.[.underline]#Click ##here## for **OAuth2**#
7199
[%collapsible]
72100
[source, yaml]
101+
====
73102
----
74103
spring:
75104
pulsar:
@@ -82,11 +111,13 @@ spring:
82111
audience: ...
83112
scope: ...
84113
----
114+
====
85115
86116
[[Sasl]]
87117
.[.underline]#Click ##here## for **Sasl**#
88118
[%collapsible]
89119
[source, yaml]
120+
====
90121
----
91122
spring:
92123
pulsar:
@@ -97,6 +128,7 @@ spring:
97128
saslJaasClientSectionName: ...
98129
serverType: ...
99130
----
131+
====
100132
101133
[[mTlS-pem]]
102134
.[.underline]#Click ##here## for **mTLS (PEM)**#

0 commit comments

Comments
 (0)