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

Update management command for creating jwks #32377

Conversation

mumarkhan999
Copy link
Member

@mumarkhan999 mumarkhan999 commented Jun 6, 2023

Follow up PR for: #32270

  • Updated management command
  • Dropped pyjwkest from requirements file

@mumarkhan999 mumarkhan999 changed the base branch from master to umar/replace-jwkest-with-pyjwt June 6, 2023 09:01
@mumarkhan999 mumarkhan999 force-pushed the umar/update-management-command-for-creating-jwks branch 2 times, most recently from 599b6ec to 409e056 Compare June 6, 2023 09:21
@mumarkhan999 mumarkhan999 requested a review from timmc-edx June 6, 2023 09:45
@mumarkhan999 mumarkhan999 force-pushed the umar/update-management-command-for-creating-jwks branch from 409e056 to 592ce3b Compare June 6, 2023 10:29
@mumarkhan999 mumarkhan999 changed the title Umar/update management command for creating jwks Update management command for creating jwks Jun 6, 2023
Copy link
Contributor

@timmc-edx timmc-edx left a comment

Choose a reason for hiding this comment

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

One suggestion, very much optional.

Comment on lines 126 to 129
algo = get_default_algorithms()['RS512']
pem = rsa_key.export_key('PEM').decode()
rsa_jwk = json.loads(algo.to_jwk(algo.prepare_key(pem)))
public_rsa_jwk = json.loads(algo.to_jwk(algo.prepare_key(pem).public_key()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion on tightening up this code a little:

Suggested change
algo = get_default_algorithms()['RS512']
pem = rsa_key.export_key('PEM').decode()
rsa_jwk = json.loads(algo.to_jwk(algo.prepare_key(pem)))
public_rsa_jwk = json.loads(algo.to_jwk(algo.prepare_key(pem).public_key()))
algo = get_default_algorithms()['RS512']
key_data = algo.prepare_key(rsa_key.export_key('PEM').decode())
rsa_jwk = json.loads(algo.to_jwk(key_data))
public_rsa_jwk = json.loads(algo.to_jwk(key_data.public_key()))

feat: removing pyjwkest

Commit generated by workflow `openedx/edx-platform/.github/workflows/upgrade-one-python-dependency.yml@refs/heads/master`

Co-authored-by: mumarkhan999 <mumarkhan999@users.noreply.github.com>
@mumarkhan999 mumarkhan999 force-pushed the umar/update-management-command-for-creating-jwks branch from 679b876 to a602f10 Compare June 16, 2023 10:40
@mumarkhan999 mumarkhan999 merged this pull request into umar/replace-jwkest-with-pyjwt Jun 16, 2023
@mumarkhan999 mumarkhan999 deleted the umar/update-management-command-for-creating-jwks branch June 16, 2023 11:32
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