Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
f0b41fea
Commit
f0b41fea
authored
Oct 24, 2017
by
Douglas Hall
Committed by
GitHub
Oct 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "LEARNER-717 Added logs for discovery"
parent
88d2ff24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
12 deletions
+3
-12
openedx/core/djangoapps/oauth_dispatch/dot_overrides.py
+1
-10
openedx/core/djangoapps/oauth_dispatch/tests/test_client_credentials.py
+2
-2
No files found.
openedx/core/djangoapps/oauth_dispatch/dot_overrides.py
View file @
f0b41fea
...
...
@@ -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
openedx/core/djangoapps/oauth_dispatch/tests/test_client_credentials.py
View file @
f0b41fea
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment