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

Commit

Permalink
pass issuer to validate
Browse files Browse the repository at this point in the history
  • Loading branch information
cancan101 committed Feb 18, 2015
1 parent 39cb197 commit 0469ac1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ JWT_AUTH = {
'JWT_VERIFY_EXPIRATION': True,
'JWT_LEEWAY': 0,
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300),
'JWT_AUDIENCE': None,
'JWT_ISSUER': None,

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

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

### JWT_AUDIENCE
This is a string that will be checked against the `aud` field of the token, if present.

Default is `None`(fail if `aud` present on JWT).

### JWT_ISSUER
This is a string that will be checked against the `iss` field of the token.

Default is `None`(do not check `iss` on JWT).

### JWT_ALLOW_REFRESH
Enable token refresh functionality. Token issued from `rest_framework_jwt.views.obtain_jwt_token` will have an `orig_iat` field. Default is `False`

Expand Down
4 changes: 2 additions & 2 deletions rest_framework_jwt/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
'JWT_VERIFY_EXPIRATION': True,
'JWT_LEEWAY': 0,
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300),
'JWT_AUDIENCE': None,
'JWT_ISSUER': None,

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

'JWT_AUTH_HEADER_PREFIX': 'JWT',

'JWT_AUDIENCE': None,
}

# List of settings that may be in string import notation.
Expand Down
3 changes: 2 additions & 1 deletion rest_framework_jwt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def jwt_decode_handler(token):
api_settings.JWT_VERIFY,
verify_expiration=api_settings.JWT_VERIFY_EXPIRATION,
leeway=api_settings.JWT_LEEWAY,
audience=api_settings.JWT_AUDIENCE
audience=api_settings.JWT_AUDIENCE,
issuer=api_settings.JWT_ISSUER
)


Expand Down

0 comments on commit 0469ac1

Please sign in to comment.