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
080f2b90
Commit
080f2b90
authored
Jan 24, 2017
by
Dennis Jen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tracking claim to profile scope in oauth handler.
parent
40e70302
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
lms/djangoapps/oauth2_handler/handlers.py
+5
-1
lms/djangoapps/oauth2_handler/tests.py
+10
-0
No files found.
lms/djangoapps/oauth2_handler/handlers.py
View file @
080f2b90
...
...
@@ -54,7 +54,7 @@ class ProfileHandler(object):
def
scope_profile
(
self
,
_data
):
""" Add specialized claims. """
return
[
'name'
,
'locale'
]
return
[
'name'
,
'locale'
,
'user_tracking_id'
]
def
claim_name
(
self
,
data
):
""" User displayable full name. """
...
...
@@ -77,6 +77,10 @@ class ProfileHandler(object):
return
language
def
claim_user_tracking_id
(
self
,
data
):
""" User tracking ID. """
return
data
[
'user'
]
.
id
class
CourseAccessHandler
(
object
):
"""
...
...
lms/djangoapps/oauth2_handler/tests.py
View file @
080f2b90
...
...
@@ -73,6 +73,11 @@ class IDTokenTest(BaseTestMixin, IDTokenTestCase):
locale
=
claims
[
'locale'
]
self
.
assertEqual
(
language
,
locale
)
def
test_user_tracking_id_claim
(
self
):
scopes
,
claims
=
self
.
get_id_token_values
(
'openid profile'
)
self
.
assertIn
(
'profile'
,
scopes
)
self
.
assertEqual
(
claims
[
'user_tracking_id'
],
self
.
user
.
id
)
def
test_no_special_course_access
(
self
):
with
check_mongo_calls
(
0
):
scopes
,
claims
=
self
.
get_id_token_values
(
'openid course_instructor course_staff'
)
...
...
@@ -232,3 +237,8 @@ class UserInfoTest(BaseTestMixin, UserInfoTestCase):
self
.
user
.
save
()
claims
=
self
.
get_with_scope
(
'permissions'
)
self
.
assertTrue
(
claims
[
'administrator'
])
def
test_profile_scope
(
self
):
claims
=
self
.
get_with_scope
(
'profile'
)
self
.
assertEqual
(
claims
[
'name'
],
UserProfile
.
objects
.
get
(
user
=
self
.
user
)
.
name
)
self
.
assertEqual
(
claims
[
'user_tracking_id'
],
self
.
user
.
id
)
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