Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

Updated the default scopes of the client credentials grant #32

Merged
merged 1 commit into from
Apr 13, 2016

Conversation

clintonb
Copy link

Fixes issue introduced by #25.

ECOM-4196

@clintonb
Copy link
Author

@nasthagiri please review. The client credentials grant type doesn't have a grant, like the other grant types, so there is nothing to check to ensure the client is not requesting greater access than is actually permitted. The client can request any scopes. Ultimately, the provider needs to enforce the limitation for either all, or specific, clients.

@clintonb clintonb force-pushed the clintonb/client-credential-update branch 5 times, most recently from db100a2 to c6b191e Compare April 13, 2016 04:08
# users, whereas the client credentials grant will primarily be used by service users.
#
# In the future, we should limit the allowable scopes either at a global or per-client level.
return 39
Copy link

Choose a reason for hiding this comment

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

Why not use the actual scopes instead of a magic number with a lengthy comment describing it?

return constants.OPENID | constants.PROFILE | constants.EMAIL | constants.PERMISSION

Are we trying to avoid making edx-django-oauth2-provider dependent on edx-oauth2-provider?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, we end up with circular dependencies.

@clintonb clintonb merged commit 511f6d9 into edx Apr 13, 2016
@clintonb clintonb deleted the clintonb/client-credential-update branch April 13, 2016 19:12
@@ -634,9 +639,10 @@ def assert_valid_access_token_response(self, access_token, response):
def get_latest_access_token(self):
return AccessToken.objects.filter(client=self.get_client()).order_by('-id')[0]

def test_authorize_success(self):
@ddt.data(None, 'read')

Choose a reason for hiding this comment

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

Can you use constants.READ here instead?
Also, didn't these 2 tests (read and None) work even before this PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants