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

Preserve JWK kid on import #320

Closed
wants to merge 1 commit into from

Conversation

rkmetzl
Copy link
Contributor

@rkmetzl rkmetzl commented Jun 10, 2019

From issue #313

The JWK import method generates a unique kid on export, but doesn't take the imported kid into account. The logic here allows an imported kid to be included on export, while allowing a kid to be generated if none is present.

@sourcelevel-bot
Copy link

Hello, @rkmetzl! This is your first Pull Request that will be reviewed by Ebert, an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its review page. Please check our documentation for more information.

Copy link
Member

@anakinj anakinj left a comment

Choose a reason for hiding this comment

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

Great improvement, left one suggestion.

@keypair = keypair
end

def kid
return jwk_kid if jwk_kid
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to have this method as something like:

def kid
  @kid ||= generate_from_public_key
end

Then we can just set the instance variable @kid in the constructor.

@volmer
Copy link

volmer commented Apr 9, 2020

Hey @rkmetzl are you still planning on moving forward with things change? It would be great if we could set our own kid when instantiating JWKs 🙏

@excpt excpt added this to the Version 2.3.0 milestone Jul 7, 2020
richardlarocque added a commit to getoutreach/ruby-jwt that referenced this pull request Sep 23, 2020
Updates the implementation of JWT:JWK::EC so it will import and
export custom "kid" values.

See also jwt#320, which proposes
doing the same for JWT::JWK::RSA.
richardlarocque added a commit to getoutreach/ruby-jwt that referenced this pull request Sep 23, 2020
Updates the implementation of JWT:JWK::EC so it will import and
export custom "kid" values.

See also jwt#320, which proposes
doing the same for JWT::JWK::RSA.
@anakinj
Copy link
Member

anakinj commented Sep 25, 2020

@excpt I think we could merge this as it is now and then make some improvements. There are some exciting changes related to JWKs happening.

@phlegx
Copy link
Contributor

phlegx commented Oct 14, 2020

This can be closed because it get solved with PR #375.

@anakinj
Copy link
Member

anakinj commented Oct 15, 2020

The initial fix by you @rkmetzl was included in #375. Thanks for your contribution.

@anakinj anakinj closed this Oct 15, 2020
richardlarocque added a commit to getoutreach/ruby-jwt that referenced this pull request Nov 30, 2020
Updates the implementation of JWT:JWK::EC so it will import and
export custom "kid" values.

See also jwt#320, which proposes
doing the same for JWT::JWK::RSA.
anakinj pushed a commit that referenced this pull request Dec 1, 2020
Updates the implementation of JWT:JWK::EC so it will import and
export custom "kid" values.

See also #320, which proposes
doing the same for JWT::JWK::RSA.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants