Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KNOX-2392 - Simple file-based TokenStateService implementation #350

Merged
merged 1 commit into from
Jun 19, 2020

Conversation

pzampino
Copy link
Contributor

What changes were proposed in this pull request?

I've created a TokenStateService implementation that avoids the unnecessary overhead associated with the AliasBasedTokenStateService (size of keystore and associated performance of access).

Since KNOX-2377 added the TokenStateJournal for addressing the potential loss of token state due to changes necessary to improve the performance of the AliasBasedTokenStateService, this new implementation leverages that journaling facility alone to manage token state. It is effectively, the AliasBasedTokenStateService without the keystore interactions.

I've not yet made this implementation the default, but I have tested it locally, and I foresee this becoming the default for the near future since the use of the keystore presents an unnecessary burden now that secrets are no longer persisted with token state.

How was this patch tested?

  • mvn -T1.5C -Ppackage,release clean install
  • Added unit tests (JournalBasedTokenStateServiceTest), and augmented existing tests.
  • Changed (only locally) DefaultGatewayServices to use the new implementation, and tested manually, including concurrent load testing. Even with multiple concurrent clients making frequent token requests, the size of the persisted content grows at a small fraction of the rate that the keystore does under similar load.

Copy link
Contributor

@smolnar82 smolnar82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me in general, I've just had a minor observation about a comment and wanted to ask some qualification on why to use addToken in getExpiration.

Regarding reflection usage in unit tests: you may want to check out FieldUtils in apache-commons-lang (to make the code even more simple in the future).

Copy link
Contributor

@moresandeep moresandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loog good

@pzampino pzampino merged commit 71f676b into apache:master Jun 19, 2020
stoty pushed a commit to stoty/knox that referenced this pull request May 14, 2024
…e#350)

Change-Id: Ie41f703e663564ae410cccc26ebb974a9fbb2917
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants