apache / apache/pulsar

[JWT] Enable configurable early token refresh in Java Client

Open
#22,314 4 comments 0 reactions 1 assignee Claimed by @damienburke View on GitHub
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Motivation

Same as this https://github.com/apache/pulsar/pull/13951 - but to support the "simpler" JWT auth workflow/client setup.

### Solution

Similar to `AuthenticationOAuth2` - firstly `AuthenticationToken` will need to cache the authenticating JWT in a `transient volatile` field.

This value will also be injected into `AuthenticationDataToken` - and `getCommandData` will now return this value - and not lazily generate a new token.

Meanwhile, a scheduled task will be created, similar to https://github.com/apache/pulsar/pull/13951 to refresh the cached token.

Respect backwards compatibility.

### Alternatives

Complete https://github.com/apache/pulsar/pull/13951 - and use it. In some cases though, using the OAuth client is not appropriate. For example, when using Vault as an OIDC - while also providing apps a Vault agent to do the Vault auth - a clientID and secretID are not needed by the app (as again the OIDC/Vault auth is abstracted away)

### Anything else?

_No response_

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.