Skip to content

Commit

Permalink
Fix call to is_jwt_authenticated when the request has no successful_a…
Browse files Browse the repository at this point in the history
…uthenticator attribute
  • Loading branch information
brittneyexline committed Jun 5, 2019
1 parent 070d28e commit a421e2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion edx_rest_framework_extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" edx Django REST Framework extensions. """

__version__ = '2.3.0' # pragma: no cover
__version__ = '2.3.1' # pragma: no cover
11 changes: 7 additions & 4 deletions edx_rest_framework_extensions/auth/jwt/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ def authenticate_credentials(self, payload):


def is_jwt_authenticated(request):
is_jwt_authenticated = issubclass(
type(request.successful_authenticator),
BaseJSONWebTokenAuthentication,
)
is_jwt_authenticated = False
successful_authenticator = getattr(request, 'successful_authenticator', None)
if successful_authenticator:
is_jwt_authenticated = issubclass(
type(successful_authenticator),
BaseJSONWebTokenAuthentication
)
if is_jwt_authenticated:
if not getattr(request, 'auth', None):
logger.error(
Expand Down

0 comments on commit a421e2a

Please sign in to comment.