Skip to content

Commit 80b3aa5

Browse files
authored
Merge branch 'master' into master
2 parents 136e0dd + cb323ef commit 80b3aa5

File tree

20 files changed

+428
-205
lines changed

20 files changed

+428
-205
lines changed

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
## Version 4.7
2+
3+
* Added Italian translations ([#342](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/342))
4+
* Fixed DRF app registry bug, specifically `django.core.exceptions.AppRegistryNotReady`
5+
([#331](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/331))
6+
* Fixed support for PyJWT>=2.0.0 ([#376](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/376))
7+
8+
## Version 4.6
9+
10+
* Added support for PyJWT>=2.0.0 ([#329](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/329))
11+
* Restored Python 3.7 support ([#332](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/332))
12+
* Added Indonesian translations ([#316](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/316))
13+
* Fixed Django 4.0 re_path deprecation ([#280](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/280))
14+
15+
## Version 4.5
16+
17+
* Added `AUTH_HEADER_NAME` to settings ([#309](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/309))
18+
* Added `USER_AUTHENTICATION_RULE` to settings ([#279](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/279))
19+
* Added `UPDATE_LAST_LOGIN` to settings ([#238](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/238))
20+
* Fixed packaging of locale folder for installation ([#117](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/117))
21+
* Allowed TokenUser to be configurable ([#172](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/172))
22+
* Dropped Python 3.7 and below (restored Python 3.7 but not 3.6 in next version)
23+
* Improved error message if cryptography isn't installed
24+
when developer tries to use a certain algorithm that needs the package
25+
([#285](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/285))
26+
* Fixed Django 4.0 ugettext_lazy deprecation warnings ([#186](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/186))
27+
* Remove upper bound of Python version ([#225](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/225))
28+
* Added DRF 3.11 support ([#230](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/230))
29+
30+
Translations:
31+
* Added French translations ([#314](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/314))
32+
* Added Spanish translations ([#294](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/294))
33+
* Added Argentinian Spanish translations ([#244](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/244))
34+
* Added Persian translations ([#220](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/220))
35+
* Added German translations ([#198](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/198))
36+
* Added Czech translations ([#188](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/188))
37+
* Added Polish translations ([#166](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/166))
38+
* Fixed incorrect language encoding from de_CH to es_CL ([#299](https://github.com/SimpleJWT/django-rest-framework-simplejwt/pull/299))
39+
140
## Version 4.4
241

342
* Added official support for Python 3.8 and Django 3.0.

docs/development_and_contributing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ directory:
1212
pip install --upgrade pip setuptools
1313
pip install -e .[dev]
1414
15+
If you're running a Mac and/or with zsh, you need to escape the brackets:
16+
17+
.. code-block:: bash
18+
19+
pip install -e .\[dev\]
20+
1521
To run the tests:
1622

1723
.. code-block:: bash

docs/settings.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Some of Simple JWT's behavior can be customized through settings variables in
3131
'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION',
3232
'USER_ID_FIELD': 'id',
3333
'USER_ID_CLAIM': 'user_id',
34+
'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule',
3435
3536
'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),
3637
'TOKEN_TYPE_CLAIM': 'token_type',
@@ -77,7 +78,7 @@ When set to ``True``, causes refresh tokens submitted to the
7778
``TokenRefreshView`` to be added to the blacklist if the blacklist app is in
7879
use and the ``ROTATE_REFRESH_TOKENS`` setting is set to ``True``.
7980
You need to add ``'rest_framework_simplejwt.token_blacklist',`` to your
80-
``INSTALLED_APPS`` in the settings file to use this settings.
81+
``INSTALLED_APPS`` in the settings file to use this setting.
8182

8283
Learn more about :doc:`/blacklist_app`.
8384

@@ -159,7 +160,12 @@ collection will be used to build the "WWW-Authenticate" header in the response.
159160
``AUTH_HEADER_NAME``
160161
----------------------------
161162

162-
The authorization header name to be used for authentication. The default is ``HTTP_AUTHORIZATION`` which will accept the ``Authorization`` header in the request. For example if you'd like to use ``X_Access_Token`` in the header of your requests please specify the ``AUTH_HEADER_NAME`` to be ``HTTP_X_ACCESS_TOKEN`` in your settings.
163+
The authorization header name to be used for authentication.
164+
The default is ``HTTP_AUTHORIZATION`` which will accept the
165+
``Authorization`` header in the request. For example if you'd
166+
like to use ``X_Access_Token`` in the header of your requests
167+
please specify the ``AUTH_HEADER_NAME`` to be
168+
``HTTP_X_ACCESS_TOKEN`` in your settings.
163169

164170
``USER_ID_FIELD``
165171
-----------------
@@ -180,6 +186,15 @@ The claim in generated tokens which will be used to store user identifiers.
180186
For example, a setting value of ``'user_id'`` would mean generated tokens
181187
include a "user_id" claim that contains the user's identifier.
182188

189+
``USER_AUTHENTICATION_RULE``
190+
----------------------------
191+
192+
Callable to determine if the user is permitted to authenticate. This rule
193+
is applied after a valid token is processed. The user object is passed
194+
to the callable as an argument. The default rule is to check that the ``is_active``
195+
flag is still ``True``. The callable must return a boolean, ``True`` if authorized,
196+
``False`` otherwise resulting in a 401 status code.
197+
183198
``AUTH_TOKEN_CLASSES``
184199
----------------------
185200

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.3'
1+
__version__ = '4.7.0'

rest_framework_simplejwt/backends.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ def decode(self, token, verify=True):
6565
signature check fails, or if its 'exp' claim indicates it has expired.
6666
"""
6767
try:
68-
return jwt.decode(token, self.verifying_key, algorithms=[self.algorithm], verify=verify,
69-
audience=self.audience, issuer=self.issuer,
70-
options={'verify_aud': self.audience is not None})
68+
return jwt.decode(
69+
token, self.verifying_key, algorithms=[self.algorithm], verify=verify,
70+
audience=self.audience, issuer=self.issuer,
71+
options={'verify_aud': self.audience is not None, "verify_signature": verify}
72+
)
7173
except InvalidAlgorithmError as ex:
7274
raise TokenBackendError(_('Invalid algorithm specified')) from ex
7375
except InvalidTokenError:

rest_framework_simplejwt/locale/cs/LC_MESSAGES/django.po

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,58 @@ msgid ""
44
msgstr ""
55
"Project-Id-Version: djangorestframework_simplejwt\n"
66
"Report-Msgid-Bugs-To: \n"
7-
"POT-Creation-Date: 2019-12-11 15:44+0200\n"
7+
"POT-Creation-Date: 2021-02-22 17:30+0100\n"
88
"Last-Translator: Lukáš Rod <info@lukasrod.cz>\n"
99
"Language: cs\n"
1010
"MIME-Version: 1.0\n"
1111
"Content-Type: text/plain; charset=UTF-8\n"
1212
"Content-Transfer-Encoding: 8bit\n"
1313

14-
#: authentication.py:76
14+
#: authentication.py:79
1515
msgid "Authorization header must contain two space-delimited values"
16-
msgstr ""
17-
"Autorizační hlavička musí obsahovat dvě hodnoty oddělené mezerou"
16+
msgstr "Autorizační hlavička musí obsahovat dvě hodnoty oddělené mezerou"
1817

19-
#: authentication.py:97
18+
#: authentication.py:100
2019
msgid "Given token not valid for any token type"
2120
msgstr "Daný token není validní pro žádný typ tokenu"
2221

23-
#: authentication.py:108 authentication.py:130
22+
#: authentication.py:111 authentication.py:133
2423
msgid "Token contained no recognizable user identification"
2524
msgstr "Token neobsahoval žádnou rozpoznatelnou identifikaci uživatele"
2625

27-
#: authentication.py:113
26+
#: authentication.py:116
2827
msgid "User not found"
2928
msgstr "Uživatel nenalezen"
3029

31-
#: authentication.py:116
30+
#: authentication.py:119
3231
msgid "User is inactive"
3332
msgstr "Uživatel není aktivní"
3433

35-
#: backends.py:21
34+
#: backends.py:37
3635
msgid "Unrecognized algorithm type '{}'"
3736
msgstr "Nerozpoznaný typ algoritmu '{}'"
3837

39-
#: backends.py:58 exceptions.py:38 tokens.py:44
38+
#: backends.py:40
39+
msgid "You must have cryptography installed to use {}."
40+
msgstr ""
41+
42+
#: backends.py:74
43+
msgid "Invalid algorithm specified"
44+
msgstr ""
45+
46+
#: backends.py:76 exceptions.py:38 tokens.py:44
4047
msgid "Token is invalid or expired"
4148
msgstr "Token není validní nebo vypršela jeho platnost"
4249

4350
#: serializers.py:24
4451
msgid "No active account found with the given credentials"
45-
msgstr ""
46-
"Žádný aktivní účet s danými údaji nebyl nalezen"
52+
msgstr "Žádný aktivní účet s danými údaji nebyl nalezen"
4753

48-
#: settings.py:57
54+
#: settings.py:63
4955
msgid ""
5056
"The '{}' setting has been removed. Please refer to '{}' for available "
5157
"settings."
52-
msgstr ""
53-
"Nastavení '{}' bylo odstraněno. "
54-
"Dostupná nastavení jsou v '{}'"
58+
msgstr "Nastavení '{}' bylo odstraněno. Dostupná nastavení jsou v '{}'"
5559

5660
#: token_blacklist/admin.py:72
5761
msgid "jti"

rest_framework_simplejwt/locale/de_CH/LC_MESSAGES/django.po

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ msgid ""
44
msgstr ""
55
"Project-Id-Version: djangorestframework_simplejwt\n"
66
"Report-Msgid-Bugs-To: \n"
7-
"POT-Creation-Date: 2020-09-04 15:19-0600\n"
7+
"POT-Creation-Date: 2021-02-22 17:30+0100\n"
88
"Last-Translator: rene <rene@matraxi.ch>\n"
99
"Language: de_CH\n"
1010
"MIME-Version: 1.0\n"
1111
"Content-Type: text/plain; charset=UTF-8\n"
1212
"Content-Transfer-Encoding: 8bit\n"
1313
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
1414

15-
#: authentication.py:75
15+
#: authentication.py:79
1616
msgid "Authorization header must contain two space-delimited values"
1717
msgstr ""
1818
"Der Authorizationheader muss zwei leerzeichen-getrennte Werte enthalten"
1919

20-
#: authentication.py:96
20+
#: authentication.py:100
2121
msgid "Given token not valid for any token type"
2222
msgstr "Der Token ist für keinen Tokentyp gültig"
2323

24-
#: authentication.py:107 authentication.py:129
24+
#: authentication.py:111 authentication.py:133
2525
msgid "Token contained no recognizable user identification"
2626
msgstr "Token enthält keine erkennbare Benutzeridentifikation"
2727

28-
#: authentication.py:112
28+
#: authentication.py:116
2929
msgid "User not found"
3030
msgstr "Benutzer nicht gefunden"
3131

32-
#: authentication.py:115
32+
#: authentication.py:119
3333
msgid "User is inactive"
3434
msgstr "Inaktiver Benutzer"
3535

@@ -41,19 +41,19 @@ msgstr "Unerkannter Algorithmustyp '{}'"
4141
msgid "You must have cryptography installed to use {}."
4242
msgstr ""
4343

44-
#: backends.py:68
44+
#: backends.py:74
4545
msgid "Invalid algorithm specified"
4646
msgstr ""
4747

48-
#: backends.py:70 exceptions.py:38 tokens.py:44
48+
#: backends.py:76 exceptions.py:38 tokens.py:44
4949
msgid "Token is invalid or expired"
5050
msgstr "Ungültiger oder abgelaufener Token"
5151

52-
#: serializers.py:29
52+
#: serializers.py:24
5353
msgid "No active account found with the given credentials"
5454
msgstr "Kein aktiver Account mit diesen Zugangsdaten gefunden"
5555

56-
#: settings.py:60
56+
#: settings.py:63
5757
msgid ""
5858
"The '{}' setting has been removed. Please refer to '{}' for available "
5959
"settings."

rest_framework_simplejwt/locale/es/LC_MESSAGES/django.po

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ msgid ""
44
msgstr ""
55
"Project-Id-Version: djangorestframework_simplejwt\n"
66
"Report-Msgid-Bugs-To: \n"
7-
"POT-Creation-Date: 2020-08-24 15:35-0500\n"
7+
"POT-Creation-Date: 2021-02-22 17:30+0100\n"
88
"Last-Translator: zeack <zeack@protonmail.com>\n"
99
"Language: es\n"
1010
"MIME-Version: 1.0\n"
1111
"Content-Type: text/plain; charset=UTF-8\n"
1212
"Content-Transfer-Encoding: 8bit\n"
1313
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
1414

15-
#: authentication.py:75
15+
#: authentication.py:79
1616
msgid "Authorization header must contain two space-delimited values"
1717
msgstr ""
1818
"El encabezado 'Authorization' debe contener valores delimitados por espacios"
1919

20-
#: authentication.py:96
20+
#: authentication.py:100
2121
msgid "Given token not valid for any token type"
2222
msgstr "El token dado no es valido para ningun tipo de token"
2323

24-
#: authentication.py:107 authentication.py:129
24+
#: authentication.py:111 authentication.py:133
2525
msgid "Token contained no recognizable user identification"
2626
msgstr "El token no contenía identificación de usuario reconocible"
2727

28-
#: authentication.py:112
28+
#: authentication.py:116
2929
msgid "User not found"
3030
msgstr "Usuario no encontrado"
3131

32-
#: authentication.py:115
32+
#: authentication.py:119
3333
msgid "User is inactive"
3434
msgstr "El usuario está inactivo"
3535

@@ -41,19 +41,19 @@ msgstr "Tipo de algoritmo no reconocido '{}'"
4141
msgid "You must have cryptography installed to use {}."
4242
msgstr "Debe tener criptografía instalada para usar {}."
4343

44-
#: backends.py:68
44+
#: backends.py:74
4545
msgid "Invalid algorithm specified"
4646
msgstr "Algoritmo especificado no válido"
4747

48-
#: backends.py:70 exceptions.py:38 tokens.py:44
48+
#: backends.py:76 exceptions.py:38 tokens.py:44
4949
msgid "Token is invalid or expired"
5050
msgstr "El token es inválido o ha expirado"
5151

52-
#: serializers.py:29
52+
#: serializers.py:24
5353
msgid "No active account found with the given credentials"
5454
msgstr "La combination de credenciales no tiene una cuenta activa"
5555

56-
#: settings.py:60
56+
#: settings.py:63
5757
msgid ""
5858
"The '{}' setting has been removed. Please refer to '{}' for available "
5959
"settings."

0 commit comments

Comments
 (0)