138 lines
3.4 KiB
Plaintext
138 lines
3.4 KiB
Plaintext
|
|
include::attributes.adoc[]
|
|
|
|
To connect to a Pulsar cluster that requires authentication, you need to set the `authPluginClassName` and any parameters required by the authentication plugin. You can set the parameters as a single JSON-encoded string or as map of parameter names to parameter values. The following listings show both approaches:
|
|
|
|
[source,yaml,indent=0,role="primary"]
|
|
.[.small]#Map#
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2
|
|
authentication:
|
|
issuer-url: https://auth.server.cloud/
|
|
private-key: file:///Users/some-key.json
|
|
audience: urn:sn:acme:dev:my-instance
|
|
----
|
|
|
|
.[.small]#JSON encoded string#
|
|
[source,yaml,indent=0,role="secondary"]
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2
|
|
auth-params: "{\"privateKey\":\"file:///Users/some-key.json\",\"issuerUrl\":\"https://auth.server.cloud/", \"audience\":\"urn:sn:acme:dev:my-instance"}"
|
|
----
|
|
|
|
TIP: Using a map is the recommended approach as it is less error-prone and easier to read.
|
|
|
|
The following listings show how to configure each of the supported authentication mechanisms.
|
|
|
|
[[Athenz]]
|
|
.[.underline]#Click ##here## for **Athenz**#
|
|
[%collapsible]
|
|
====
|
|
[source, yaml]
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.AuthenticationAthenz
|
|
authentication:
|
|
tenant-domain: ...
|
|
tenant-service: ...
|
|
provider-domain: ...
|
|
private-key: ...
|
|
key-id: ...
|
|
enable-tls: true
|
|
tls-trust-certs-file: /path/to/cacert.pem
|
|
----
|
|
====
|
|
|
|
[[Basic]]
|
|
.[.underline]#Click ##here## for **Basic**#
|
|
[%collapsible]
|
|
====
|
|
[source, yaml]
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.AuthenticationBasic
|
|
authentication:
|
|
user-id: ...
|
|
password: ...
|
|
----
|
|
====
|
|
|
|
[[OAuth2]]
|
|
.[.underline]#Click ##here## for **OAuth2**#
|
|
[%collapsible]
|
|
====
|
|
[source, yaml]
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.oauth2.AuthenticationFactoryOAuth2
|
|
authentication:
|
|
issuer-url: ...
|
|
private-key: ...
|
|
audience: ...
|
|
scope: ...
|
|
----
|
|
====
|
|
|
|
[[Sasl]]
|
|
.[.underline]#Click ##here## for **Sasl**#
|
|
[%collapsible]
|
|
====
|
|
[source, yaml]
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.AuthenticationSasl
|
|
authentication:
|
|
sasl-jaas-client-section-name: ...
|
|
server-type: ...
|
|
----
|
|
====
|
|
|
|
[[Tls]]
|
|
.[.underline]#Click ##here## for **Tls**#
|
|
[%collapsible]
|
|
====
|
|
[source, yaml]
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.AuthenticationTls
|
|
authentication:
|
|
tls-cert-file: /path/to/my-role.cert.pem
|
|
tls-key-file: /path/to/my-role.key-pk8.pem
|
|
enable-tls: true
|
|
tls-trust-certs-file: /path/to/cacert.pem
|
|
----
|
|
====
|
|
|
|
[[Token]]
|
|
.[.underline]#Click ##here## for **Token**#
|
|
[%collapsible]
|
|
====
|
|
[source, yaml]
|
|
----
|
|
spring:
|
|
pulsar:
|
|
client:
|
|
auth-plugin-class-name: org.apache.pulsar.client.impl.auth.AuthenticationToken
|
|
authentication:
|
|
token: some-token-goes-here
|
|
----
|
|
====
|
|
|
|
NOTE: You can find more information on each of the schemes and their required properties in the official {apache-pulsar-docs}/security-overview#authentication-providers[Pulsar security] documentation.
|