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 650 forks source link

Use get_by_natural_key in jwt_get_secret_key #418

Open raverat opened 6 years ago

raverat commented 6 years ago

As stated in commit a3b4d44d2fc34d7752793ccbade2684707bf41da, the field user_id in payload will be deprecated.

Instead of explicitly using user_id field to retrieve user in utils.jwt_get_secret_key function, we should use User.objects.get_by_natural_key with the value in the payload dictionary at username_field key.

codecov[bot] commented 6 years ago

Codecov Report

Merging #418 into master will decrease coverage by 0.33%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #418      +/-   ##
==========================================
- Coverage   90.67%   90.34%   -0.34%     
==========================================
  Files          14       12       -2     
  Lines         847      818      -29     
  Branches       29       29              
==========================================
- Hits          768      739      -29     
  Misses         66       66              
  Partials       13       13
Flag Coverage Δ
#codecov 90.34% <ø> (-0.34%) :arrow_down:
#dj110 87.04% <ø> (-0.45%) :arrow_down:
#dj111 87.04% <ø> (-0.45%) :arrow_down:
#dj18 89.48% <ø> (-0.36%) :arrow_down:
#dj19 89.48% <ø> (-0.36%) :arrow_down:
#drf31 89.48% <ø> (-0.36%) :arrow_down:
#drf32 89.48% <ø> (-0.36%) :arrow_down:
#drf33 89.48% <ø> (-0.36%) :arrow_down:
#drf34 90.34% <ø> (-0.34%) :arrow_down:
#drf35 89.97% <ø> (-0.35%) :arrow_down:
#drf36 89.97% <ø> (-0.35%) :arrow_down:
#py27 90.34% <ø> (-0.34%) :arrow_down:
#py33 89.11% <ø> (-0.38%) :arrow_down:
#py34 89.97% <ø> (+0.48%) :arrow_up:
#py35 87.04% <ø> (?)
#py36 87.04% <ø> (?)
Impacted Files Coverage Δ
rest_framework_jwt/models.py

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...a8ddaf1. Read the comment docs.