-
Notifications
You must be signed in to change notification settings - Fork 21
ARCH-603: Retrieve and map user_id scope. #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
auth_backends/backends.py
Outdated
| # - See https://github.com/edx/edx-platform/blob/1dd1d25bc44cff99cec849ff4695bb1dc92ddac1/lms/djangoapps/oauth2_handler/handlers.py#L57 | ||
| # 2. Should this 'user_tracking_id' be removed if it is overwritten in EdXOpenIdConnect? | ||
| # 3. Even if 'user_tracking_id' is sent, who uses it? Maybe edx-analytics-dashboard? | ||
| 'user_tracking_id': 'user_tracking_id', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field is set only with OpenID Connect. So you can remove it from here. (Already exists in EdXOpenIdConnect.)
robrap
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nasthagiri @douglashall: This is ready for full review.
| """ | ||
| Ensure that `user_id` stays in EXTRA_DATA. | ||
| """ | ||
| self.assertEqual(self.backend.EXTRA_DATA, [('user_id', 'user_id', True)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I didn't want to do an integration test, and I want to ensure this doesn't get lost, so I added a silly simple test.
|
|
||
| DEFAULT_SCOPE = ['user_id', 'profile', 'email'] | ||
| discard_missing_values = True | ||
| EXTRA_DATA = [('user_id', 'user_id', discard_missing_values)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is EXTRA_DATA used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@douglashall: I added the comment above to address your question. I also adjusted the commit comment, which you are welcome to review.
BREAKING CHANGE: The user_id scope is now required when using the EdXOAuth2 backend for oAuth+SSO. This means that the oauth application must first be configured to have access to the user_id scope, which is not available by default. The backend will then pull the user_id from the JWT and store it in the UserSocialAuth.extra_data field. ARCH-603
99d9e60 to
f955e55
Compare
This library update will be needed by ecommerce in order to get the lms user_id passed through appropriately.
IMPORTANT: This change requires https://github.com/edx/edx-platform/pull/20057 to land before we upgrade services, otherwise edx-platform will send invalid_scope errors.
Additionally, oauth applications are required to have access to the
user_idscope in order for this not to break oAuth+SSO flow. There is some follow-up work to ensure this is done for the apps using this flow (ecommerce, credentials, registrar).ARCH-603