-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Python Requirements Update" (#245)
- Loading branch information
1 parent
da30651
commit aa2c519
Showing
11 changed files
with
131 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Middleware that checks if in incoming request has a browser jwt cookie | ||
and enables JWT auth for that request. | ||
This is a temporary workaround that allows easier testing of browser endpoints in | ||
absence of a frontend UI. Normally a frontend application must explicity request | ||
the JWT token to be used for auth by setting USE_JWT_COOKIE_HEADER. | ||
""" | ||
from django.utils.deprecation import MiddlewareMixin | ||
from edx_rest_framework_extensions.auth.jwt.constants import USE_JWT_COOKIE_HEADER | ||
from edx_rest_framework_extensions.auth.jwt.cookies import jwt_cookie_header_payload_name | ||
|
||
|
||
class ForceJWTAuthMiddleware(MiddlewareMixin): # pragma: no cover | ||
""" Middleware to automically enable JWT auth for browser requests """ | ||
def process_request(self, request): # pylint: disable=missing-function-docstring | ||
# prevent lti callback endpoints from reading jwt, we want to ensure | ||
# the session token generated for these is used instead | ||
if request.path.startswith('/lti/lti_consumer'): | ||
return | ||
|
||
if request.COOKIES.get(jwt_cookie_header_payload_name(), None): | ||
request.META[USE_JWT_COOKIE_HEADER] = 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
# A central location for most common version constraints | ||
# (across edx repos) for pip-installation. | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.