[Issue #3810][pulsar-broker] Implement configurable token auth claim #3826
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3810
Please let me know if I've missed anything!
Motivation
This change allows more configuration of the AuthenticationTokenProvider, so that the user can specify which "claim" that is attached to the token should be used as the "role". Before, it was hard-coded in to use the token's subject claim ("sub").
Modifications
Added a field to the AuthenticationTokenProvider which controls which claim is returned from
parseToken
, and a method that sets that field based on the .conf file. Added some documentation and a test.Verifying this change
This change added tests and can be verified as follows:
AuthenticationTokenProviderTest
which sets the configuration and verifies that it picks up the right valueDoes this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
reference-configuration.md