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

Preperations for version 2.x #49

Merged
merged 35 commits into from
Jan 26, 2015
Merged

Preperations for version 2.x #49

merged 35 commits into from
Jan 26, 2015

Conversation

excpt
Copy link
Member

@excpt excpt commented Jan 2, 2015

I think it is time to clean up the single module behavior of the jwt gem to keep up with the specs of JWT and the underlying specs (JWS, JWE, JWA, JWK). As a result the gem should match at least the JWT specifications for the signing of JSON Web Tokens. Encryption may be another goal to but I think it shouldn't be the main approach.

The code is not complete yet. I'd like to get feedback or a code review for the current code base and maybe we can add a milestone and figure out what should be implemented in the version 2.x branch.

What I've done so far:

  • Refactoring the code base, including tests
  • removed validators - should be moved into a seperate validation module/class
  • Split code into modules which manage each section of the specs (JWT and JWA)
  • removed the Ruby 1.8 support (but should return for old projects that cannot switch to a later and supported version of Ruby)

Goals:

  • JWT interface should stay the same
  • Implement the missing algorithms for signing specified in the JWA specs
  • Implement JWS
  • Implement JWT validators
  • Add more tests, more different use cases

JWT, JWS, JWA logic should be represented in seperate modules.
Added new pending tests for each module.
Update travis configuration. Dropped support for jruby and rbx for now.
Added some more configuration options for travis.
Renamed spec/helper to spec/spec_helper.
All tests now load the modules by relative path.
Added empty JWA and JWS modules.
Dropping ruby mri 1.8 support due to the missing require_relative
support.
Adding codeclimate test reporter gem.
Update spec/spec_helper configuration.
Add first HMAC functionality to JWA.
Make rspec tests more readable. Add missing bit to description for HMAC
rspec test cases.
Add basic support for RSA-SHA functionality.
Add bin/prepare-test.sh file. Generates certificates required for
running the tests.
Update .gitignore file.
Update .travis.yml file.
ECDSA cannot be implemented without fixing following bug in the ruby
openssl libs: https://bugs.ruby-lang.org/issues/5600
Add simple plain verification and signing functions.
Uncomment and disable ecdsa features.
Drop old code.
Reformat code.
Drop current code.
Add first specs to cover simple HS256 decoding and encoding.
Extend JWA HMAC logic, add sign/verify basic logic and tests.
Break tests by removing padding from base64 encoded strings.
TODO: Implement padding handling for base64 strings in order to be
compatible with the JOSE JWT/JWS/JWA specs.
Add JWA::NONE for plain JWT
Update JWT to integrate JWA
@excpt excpt mentioned this pull request Jan 2, 2015
# But with some leeway, it will still validate
JWT.decode(jwt_payload, 'secret', true, leeway=10)
```ruby
jwt_payload = JWT.encode({'exp': Time.now.to_i + 30}, 'secret')

Choose a reason for hiding this comment

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

Maybe I'm just nitpicking here but in the code blocks throughout the README you're using different hash syntaxes, double and single quotes etc.
Since Ruby 1.8 is removed in that PR how about replacing all of these with the short notation?
(e.g. { exp: Time.now.to_i })

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right. I will change this and update the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. :)

Change examples to use to current hash syntax since ruby 1.8 dropped in
version 2.x.
@excpt excpt added this to the Version 2.0.0 milestone Jan 7, 2015
@excpt excpt self-assigned this Jan 7, 2015
excpt added a commit that referenced this pull request Jan 26, 2015
Preperations for version 2.x
@excpt excpt merged commit 8f6191f into jwt:2.x Jan 26, 2015
@anakinj anakinj removed this from the Version 3.0.0 milestone Feb 2, 2023
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