-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We are currently in the middle to removing the deprecated oauth2authentication from edx-platform and this is one of the last libraries that uses it. These changes would allow us to see if this class is currently in use or not.
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
edx-organizations app initialization module | ||
""" | ||
__version__ = '2.2.0' # pragma: no cover | ||
__version__ = '2.2.1' # pragma: no cover |
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,24 @@ | ||
"""Temp auth class to see how often oauth2authentication class is used in organizations""" | ||
from rest_framework_oauth.authentication import OAuth2Authentication | ||
from edx_django_utils.monitoring import set_custom_metric | ||
|
||
|
||
class OAuth2AuthenticationDeprecated(OAuth2Authentication): | ||
""" | ||
This child class was added to add new_relic metrics to OAuth2Authentication. This should be very temporary. | ||
""" | ||
|
||
def authenticate(self, request): | ||
""" | ||
Returns two-tuple of (user, token) if access token authentication | ||
succeeds, None if the user did not try to authenticate using an access | ||
token, or raises an AuthenticationFailed (HTTP 401) if authentication | ||
fails. | ||
""" | ||
set_custom_metric("OAuth2AuthenticationDeprecated", "Failed") | ||
output = super(OAuth2AuthenticationDeprecated, self).authenticate(request) | ||
if output is None: | ||
set_custom_metric("OAuth2AuthenticationDeprecated", "None") | ||
else: | ||
set_custom_metric("OAuth2AuthenticationDeprecated", "Success") | ||
return output |
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