Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

pyrech
Copy link

@pyrech pyrech commented Jul 13, 2014

RefreshTokens always had a default scope (the config supported_scopes in FosOAuthServerBundle) instead of the scope asked by the client if any.

@Spomky
Copy link

Spomky commented Jul 13, 2014

Your are right, this part must be updated, but your PR does not solve the problem and it creates a new (security) issue.

According to the RFC, The requested scope MUST NOT include any scope not originally granted by the resource owner, and if omitted is treated as equal to the scope originally granted by the resource owner.

With your PR, if a refresh token has "scope1 scope2" and the client request "scope4", it will receive an access token and a refresh token with "scope4".
If the client request no scope, the server will issue an access token and a refresh token without any scope, which is wrong too.

The logic should be:

if no scope is requested, then stored scope is used
else,
    if scope is requested, the scope must be within stored scope
    else exception

@pyrech
Copy link
Author

pyrech commented Jul 13, 2014

Thanks, you're absolutely right. I edited the class and updated the test.

@Spomky
Copy link

Spomky commented Jul 14, 2014

You should add some new test to verify the following cases:

  • no scope requested: the refresh token has the scope defined in the old refresh token
  • new scope requested: the exception is thrown

@pyrech
Copy link
Author

pyrech commented Jul 14, 2014

Done :)

@pyrech pyrech changed the title Fixed wrong scope(s) associated to accessToken Use scope asked by the client if any Jul 14, 2014
@jaytaph
Copy link

jaytaph commented Sep 10, 2014

Really like to see this PR merged as well.

@Spomky
Copy link

Spomky commented Nov 2, 2014

It can be merged.
@pyrech could you please rebase and squash your PR please?

Conflicts:
	lib/OAuth2/OAuth2.php
@pyrech
Copy link
Author

pyrech commented Nov 2, 2014

Done

@Spomky
Copy link

Spomky commented Nov 3, 2014

@pyrech many thanks!
@alanbem looks good to me. Can be merged.

alanbem added a commit that referenced this pull request Nov 3, 2014
Use scope asked by the client if any
@alanbem alanbem merged commit 23e7653 into FriendsOfSymfony:master Nov 3, 2014
@alanbem
Copy link
Member

alanbem commented Nov 3, 2014

@alanbem looks to me. Can be merged.

done!

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.

5 participants