-
-
Notifications
You must be signed in to change notification settings - Fork 694
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
Fixes #70. Implemented registry pattern for class-based algorithms #71
Conversation
Agreed. I meant to do that (NotImplementedError) but I was too excited about getting to the rest of the refactoring and then I missed it when I picked this branch back up after the holidays. :-) I'll push up the commit in just a sec |
There we go. Tests are now green again. |
@progrium I'd like your take on this. |
@jpadilla It's always scary whenever someone moves around 80% of the code in a library, huh? :-) |
This PR needs some rework to apply cleanly on top of current master. |
a83790a
to
493a629
Compare
@mark-adams @wbolster thanks! Will try to have @progrium check this out to have his feedback since it's a "big" fundamental change before we make any decisions. |
Absolutely!! I totally understand. However, I do want to point out two very important things to keep in mind here:
A LOT of code looks like it changed here, but a lot of the code actually didn't change here. It's just organized a bit differently. :-) That being said, I totally understand the need for review. I'll anxiously await @progrium's review. Let me know if y'all have any questions. |
493a629
to
7af1325
Compare
@mark-adams ready to move this forward. One thing I'd like to do before merging this in would be to write some comment blocks for the algorithms. |
…e classes in the algorithms module Added register_algorithm to add new algorithms.
7af1325
to
81a5932
Compare
Rebased against the latest master and added some comments for |
… rebasing earlier.
Fixes #70. Implemented registry pattern for class-based algorithms
@mark-adams awesome thanks! |
A bit late to the party, but I'm trying this in view of #42 at the moment... The Algorithm abstraction doesn't provide access to the unprotected header, just the payload. This can be inconvenient if you want the algorithm to manage e.g. the Problem is that since the Any tips? |
In the 2.0 release (#144 to be specific), we're planning on adding additional support for JWK that should make key management a bit easier without having to resort to a lot of trickery. I think this will help resolve a lot of what you're dealing with. I wouldn't be opposed to adding a function to retrieve the unverified header values. Created #155 |
Algorithm-specific logic has been moved to the algorithms module and refactored into classes to make it a bit easier for others to add new standard or non-standard algorithms to the library.
Things to note:
jwt.encode()
andjwt.decode()
) are completely unchangedjwt.register_algorithm()
has been added to the public API for extensibilitysigning_methods
,verify_methods
, andprepare_key_methods
lists / functions has been rearranged into classes inalgorithms.py
. The sign, verify, and prepare_key methods are all nearly identical to their original versions.