Commit f0b41fea by Douglas Hall Committed by GitHub

Revert "LEARNER-717 Added logs for discovery"

parent 88d2ff24
......@@ -3,21 +3,17 @@ Classes that override default django-oauth-toolkit behavior
"""
from __future__ import unicode_literals
import logging
from datetime import datetime
from django.contrib.auth import authenticate, get_user_model
from django.db.models.signals import pre_save
from django.dispatch import receiver
from pytz import utc
from oauth2_provider.models import AccessToken
from oauth2_provider.oauth2_validators import OAuth2Validator
from pytz import utc
from .models import RestrictedApplication
log = logging.getLogger(__name__)
@receiver(pre_save, sender=AccessToken)
def on_access_token_presave(sender, instance, *args, **kwargs): # pylint: disable=unused-argument
......@@ -77,9 +73,6 @@ class EdxOAuth2Validator(OAuth2Validator):
grant_type = request.grant_type
user = request.user
_token_prefix = token['access_token'][:3]
log.info('Saving bearer token with prefix [%s] for user [%d]', _token_prefix, user.id)
if grant_type == 'client_credentials':
# Temporarily remove the grant type to avoid triggering the super method's code that removes request.user.
request.grant_type = None
......@@ -107,8 +100,6 @@ class EdxOAuth2Validator(OAuth2Validator):
token['expires_in'] = expires_in
log.info('Finished bearer token with prefix [%s] for user [%d]', _token_prefix, user.id)
# Restore the original request attributes
request.grant_type = grant_type
request.user = user
......@@ -63,10 +63,10 @@ class ClientCredentialsTest(mixins.AccessTokenMixin, TestCase):
'client_id': application.client_id,
'client_secret': application.client_secret,
'scope': ' '.join(scopes),
'token_type': 'jwt',
'token_type': 'jwt'
}
response = self.client.post(reverse('access_token'), data, user=self.user)
response = self.client.post(reverse('access_token'), data)
self.assertEqual(response.status_code, 200)
content = json.loads(response.content)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment