Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.

Commit 27ca012

Browse files
committed
[refresh-token] rename to JWT_ALLOW_REFRESH
1 parent a7a09b5 commit 27ca012

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ $ curl -H "Authorization: JWT <your_token>" http://localhost:8000/protected-url/
6262
```
6363

6464
## Refresh Token
65-
If `JWT_ALLOW_TOKEN_REFRESH` is True, issued tokens can be "refreshed" to obtain a new brand token with renewed expiration time. Add a URL pattern like this:
65+
If `JWT_ALLOW_REFRESH` is True, issued tokens can be "refreshed" to obtain a new brand token with renewed expiration time. Add a URL pattern like this:
6666
```python
6767
url(r'^api-token-refresh/', 'rest_framework_jwt.views.refresh_jwt_token'),
6868
```
@@ -101,7 +101,7 @@ JWT_AUTH = {
101101
'JWT_LEEWAY': 0,
102102
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300),
103103

104-
'JWT_ALLOW_TOKEN_REFRESH': False,
104+
'JWT_ALLOW_REFRESH': False,
105105
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),
106106
}
107107
```
@@ -153,7 +153,7 @@ This is an instance of Python's `datetime.timedelta`. This will be added to `dat
153153

154154
Default is `datetime.timedelta(seconds=300)`(5 minutes).
155155

156-
### JWT_ALLOW_TOKEN_REFRESH
156+
### JWT_ALLOW_REFRESH
157157
Enable token refresh functionality. Token issued from `rest_framework_jwt.views.obtain_jwt_token` will have an `orig_iat` field. Default is `False`
158158

159159
### JWT_REFRESH_EXPIRATION_DELTA

rest_framework_jwt/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def validate(self, attrs):
4949

5050
# Include original issued at time for a brand new token,
5151
# to allow token refresh
52-
if api_settings.JWT_ALLOW_TOKEN_REFRESH:
52+
if api_settings.JWT_ALLOW_REFRESH:
5353
payload['orig_iat'] = timegm(
5454
datetime.utcnow().utctimetuple()
5555
)

rest_framework_jwt/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
'JWT_LEEWAY': 0,
2727
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300),
2828

29-
'JWT_ALLOW_TOKEN_REFRESH': False,
29+
'JWT_ALLOW_REFRESH': False,
3030
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),
3131
}
3232

rest_framework_jwt/tests/test_views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class RefreshJSONWebTokenTests(BaseTestCase):
164164

165165
def setUp(self):
166166
super(RefreshJSONWebTokenTests, self).setUp()
167-
api_settings.JWT_ALLOW_TOKEN_REFRESH = True
167+
api_settings.JWT_ALLOW_REFRESH = True
168168

169169
def get_token(self):
170170
client = APIClient(enforce_csrf_checks=True)
@@ -253,5 +253,5 @@ def test_refresh_jwt_after_refresh_expiration(self):
253253

254254
def tearDown(self):
255255
# Restore original settings
256-
api_settings.JWT_ALLOW_TOKEN_REFRESH = \
257-
DEFAULTS['JWT_ALLOW_TOKEN_REFRESH']
256+
api_settings.JWT_ALLOW_REFRESH = \
257+
DEFAULTS['JWT_ALLOW_REFRESH']

0 commit comments

Comments
 (0)