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

Preload private_key in JwtTokenSource #519

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LuckySting
Copy link
Contributor

Loading cryptography keys from pem-encoded bytes string takes a lot of time (~250ms). Due to private_key is not changed during the life of JwtTokenSource it could be done only once, which would significantly speed up token issuing.

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Currently the private key is loaded on each call of token() method, which takes ~250ms.

Issue Number: N/A

What is the new behavior?

Now the private key is loaded only once in class constructor, which leads to speed up of token() method from 250ms to 4ms.

Other information

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.

2 participants