Skip to content

Commit

Permalink
[Docs] Workaround for env var auth params
Browse files Browse the repository at this point in the history
Also fix collapsible section on authentication.adoc
  • Loading branch information
onobc committed Feb 20, 2024
1 parent 2aecb93 commit 153bf06
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ For example, if you want to configure the issuer url for the `AuthenticationOAut
If you use other forms, such as `issuerurl` or `issuer-url`, the setting will not be applied to the plugin.
====

[[client-authentication-env-vars]]
[TIP]
====
Using environment variables for auth parameters is typically problematic because the case sensitivity is lost during translation.
For example, consider the following `issuerUrl` auth parameter set via an environment variable:
[source,properties]
----
SPRING_PULSAR_CLIENT_AUTHENTICATION_PARAM_ISSUERURL=https://some.server.com
----
When Spring Boot loads this property it will use `issuerurl` (lower-cased) rather than the expected `issuerUrl` (camel-cased).
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.
Continuing the example above:
[source,yaml]
----
spring:
pulsar:
client:
authentication:
param:
issuerUrl: ${SPRING_PULSAR_CLIENT_AUTHENTICATION_PARAM_ISSUERURL}
----
====

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.


Expand All @@ -22,6 +45,7 @@ The following listings show how to configure each of the supported authenticatio
.[.underline]#Click ##here## for **Athenz**#
[%collapsible]
[source, yaml]
====
----
spring:
pulsar:
Expand All @@ -36,11 +60,13 @@ spring:
keyId: ...
----
NOTE: This also requires xref:reference/pulsar.adoc#tls-encryption[TLS encryption].
====

[[Token]]
.[.underline]#Click ##here## for **Token**#
[%collapsible]
[source, yaml]
====
----
spring:
pulsar:
Expand All @@ -50,11 +76,13 @@ spring:
param:
token: some-token-goes-here
----
====
[[Basic]]
.[.underline]#Click ##here## for **Basic**#
[%collapsible]
[source, yaml]
====
----
spring:
pulsar:
Expand All @@ -65,11 +93,13 @@ spring:
userId: ...
password: ...
----
====
[[OAuth2]]
.[.underline]#Click ##here## for **OAuth2**#
[%collapsible]
[source, yaml]
====
----
spring:
pulsar:
Expand All @@ -82,11 +112,13 @@ spring:
audience: ...
scope: ...
----
====
[[Sasl]]
.[.underline]#Click ##here## for **Sasl**#
[%collapsible]
[source, yaml]
====
----
spring:
pulsar:
Expand All @@ -97,6 +129,7 @@ spring:
saslJaasClientSectionName: ...
serverType: ...
----
====
[[mTlS-pem]]
.[.underline]#Click ##here## for **mTLS (PEM)**#
Expand Down

0 comments on commit 153bf06

Please sign in to comment.