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

Commit da442fb

Browse files
committed
pass issuer to validate
1 parent 0c9bc1a commit da442fb

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

docs/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ JWT_AUTH = {
127127
'JWT_VERIFY_EXPIRATION': True,
128128
'JWT_LEEWAY': 0,
129129
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300),
130+
'JWT_AUDIENCE': None,
131+
'JWT_ISSUER': None,
130132

131133
'JWT_ALLOW_REFRESH': False,
132134
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),
@@ -182,6 +184,16 @@ This is an instance of Python's `datetime.timedelta`. This will be added to `dat
182184

183185
Default is `datetime.timedelta(seconds=300)`(5 minutes).
184186

187+
### JWT_AUDIENCE
188+
This is a string that will be checked against the `aud` field of the token, if present.
189+
190+
Default is `None`(fail if `aud` present on JWT).
191+
192+
### JWT_ISSUER
193+
This is a string that will be checked against the `iss` field of the token.
194+
195+
Default is `None`(do not check `iss` on JWT).
196+
185197
### JWT_ALLOW_REFRESH
186198
Enable token refresh functionality. Token issued from `rest_framework_jwt.views.obtain_jwt_token` will have an `orig_iat` field. Default is `False`
187199

rest_framework_jwt/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
'JWT_VERIFY_EXPIRATION': True,
2929
'JWT_LEEWAY': 0,
3030
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300),
31+
'JWT_AUDIENCE': None,
32+
'JWT_ISSUER': None,
3133

3234
'JWT_ALLOW_REFRESH': False,
3335
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),
3436

3537
'JWT_AUTH_HEADER_PREFIX': 'JWT',
36-
37-
'JWT_AUDIENCE': None,
3838
}
3939

4040
# List of settings that may be in string import notation.

rest_framework_jwt/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def jwt_decode_handler(token):
5353
api_settings.JWT_VERIFY,
5454
verify_expiration=api_settings.JWT_VERIFY_EXPIRATION,
5555
leeway=api_settings.JWT_LEEWAY,
56-
audience=api_settings.JWT_AUDIENCE
56+
audience=api_settings.JWT_AUDIENCE,
57+
issuer=api_settings.JWT_ISSUER
5758
)
5859

5960

0 commit comments

Comments
 (0)