Skip to main content
StreamNative Pulsar extends the JWT token authentication to support multiple private keys AuthenticationProvider AuthenticationProviderMultipleSignKeyToken, and implement automatic reloading of configuration files into the cache without restarting the broker. The multiple multiple private keys will be maintained in a JSON file and issue new JWT token needs to include a kid field in the header to match the private key for signature verification.

Before you begin

  • Install the following tools.

Create multiple secret keys

  • Create the default secret key
  • Create the second secret key
  • Create a JSON to include the multiple secret keys, key is kid, value is the corresponding secret key encoded by base64
  • Create the K8s Secret for the multi secret key JSON

Create broker and proxy tokens

  • Use the default secret key to generate broker admin token
  • Create the K8s Secret for the tokens

Configure PulsarBroker and PulsarProxy

PulsarBroker

  • [1] spec.config.cusom: authenticationProviders should use the io.streamnative.pulsar.broker.authentication.AuthenticationProviderMultipleSignKeyToken

PulsarProxy

Create client tokens

  • Create a token by the default secret key
  • Create a token by the kid secret key
The kid=KID1 in the headers should be consistent with the secret-keys.json defination.
  • Grant permission to the role
  • Use the token generated by the default secret key to produce data
  • Use the token generated by the KID1 secret key to produce data