Skip to content

Conversation

@robrap
Copy link
Contributor

@robrap robrap commented Mar 26, 2019

Add user_id scope to the list of available scopes. This should have been done when the scope was added as part of https://github.com/edx/edx-platform/pull/19765.

Note: This is to enable the user_id claim to make it to ecommerce when requested through social-auth oAuth+SSO flow.

ARCH-603

"""
use_asymmetric_key = _get_use_asymmetric_key_value(is_restricted, use_asymmetric_key)
scopes = scopes or ['email', 'profile']
scopes = scopes or ['user_id', 'email', 'profile']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: I don't think this was needed for ecommerce social-auth flow, but I'm not sure about other use cases. It should be more clear when adding a new scope what needs to change. Maybe we need some constants? For example, should these default scopes in cookies always match here? If not, maybe we could add comments or well-named constants to help explain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we trying to limit the combination of profile and user_id scopes to only privileged clients? If so, I recommend not making this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I may introduce a constant named NON_PRIVILEGED_DEFAULT_SCOPES to make this more clear, and maybe one for the cookies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nasthagiri: FYI: I switched this to a comment to try to clarify my concern.

@robrap robrap changed the title ARCH-603: Add user_id scope to various defaults. WIP: ARCH-603: Add user_id scope to various defaults. Mar 26, 2019
Copy link
Contributor

@nasthagiri nasthagiri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robrap A passing response to your question above. Since I don't have time to dive into the details, I'm not sure whether #1 in your comment is really needed. I leave it to you to dive into it.

Regarding #2, I assume this change is only needed for those services that use the new OAuth2+SSO flow. So that's only Credentials and e-commerce at this point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't really call this non_privileged_default_scopes since once would say that email and profile are also privileged. These are simply scopes that we default to when one isn't passed in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I see that this change didn't communicate what I wish to. I will try again.

@robrap
Copy link
Contributor Author

robrap commented Mar 27, 2019

Thanks @nasthagiri. Your passing comment was helpful. I will try the simpler major version upgrade for auth-backends, and document that the OAuth2+SSO flow now requires that an application has access to the user_id scope.

@robrap
Copy link
Contributor Author

robrap commented Mar 27, 2019

@nasthagiri: FYI: This is ready once it gets a thumb.

@robrap robrap changed the title WIP: ARCH-603: Add user_id scope to various defaults. ARCH-603: Add user_id scope to various defaults. Mar 27, 2019
This should have been done when the scope was first added as part
of (#19765).

ARCH-603
@robrap robrap force-pushed the robrap/ARCH-603-fix-user-id-scope branch from 00f3636 to e52db40 Compare March 27, 2019 23:02
@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

@robrap robrap merged commit fe69add into master Mar 28, 2019
@robrap
Copy link
Contributor Author

robrap commented Mar 28, 2019

@nasthagiri: if you want any changes to the comments I’m happy to do a follow-up PR. I just wanted to get this blocking change out in edx-platform asap. Thanks.

@robrap robrap deleted the robrap/ARCH-603-fix-user-id-scope branch March 28, 2019 00:11
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Friday, March 29, 2019.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants