jpadilla / django-rest-framework-jwt

JSON Web Token Authentication support for Django REST Framework
http://jpadilla.github.io/django-rest-framework-jwt/
MIT License
3.19k stars 649 forks source link

Optimize jwt_decode_handler #344

Open blueyed opened 7 years ago

blueyed commented 7 years ago
  1. There is no need to decode the payload without verification first, in case api_settings.JWT_PUBLIC_KEY is used.
  2. It also skips decoding in case api_settings.JWT_GET_USER_SECRET_KEY is not used. This might be a problem in case somebody is monkey-patching jwt_get_secret_key, but that should not be considered stable/public API, should it?

I had this still from when working on https://github.com/GetBlimp/django-rest-framework-jwt/pull/341. Might be better to keep this for after the currently planned release in any way.

blueyed commented 7 years ago

@jpadilla Anything to be done here?

(the build failure seems unrelated - I've only just rebased it; should be fixed with https://github.com/GetBlimp/django-rest-framework-jwt/pull/369)

codecov[bot] commented 6 years ago

Codecov Report

Merging #344 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #344   +/-   ##
=======================================
  Coverage   90.67%   90.67%           
=======================================
  Files          14       14           
  Lines         847      847           
  Branches       29       29           
=======================================
  Hits          768      768           
  Misses         66       66           
  Partials       13       13
Flag Coverage Δ
#codecov 90.67% <ø> (ø) :arrow_up:
#dj110 87.48% <ø> (ø) :arrow_up:
#dj111 87.48% <ø> (ø) :arrow_up:
#dj18 89.84% <ø> (ø) :arrow_up:
#dj19 89.84% <ø> (ø) :arrow_up:
#drf31 89.84% <ø> (ø) :arrow_up:
#drf32 89.84% <ø> (ø) :arrow_up:
#drf33 89.84% <ø> (ø) :arrow_up:
#drf34 90.67% <ø> (ø) :arrow_up:
#drf35 90.31% <ø> (ø) :arrow_up:
#drf36 90.31% <ø> (ø) :arrow_up:
#py27 90.67% <ø> (ø) :arrow_up:
#py33 89.49% <ø> (ø) :arrow_up:
#py34 89.49% <ø> (ø) :arrow_up:
Impacted Files Coverage Δ
rest_framework_jwt/utils.py 100% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0a0bd40...64f0859. Read the comment docs.