Skip to content
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

If the request already has the scope, don't fetchToken again #2382

Merged
merged 1 commit into from
Aug 24, 2017

Conversation

smarterclayton
Copy link
Contributor

@smarterclayton smarterclayton commented Aug 23, 2017

AuthorizeRequest() injects the 'pull' scope if from is set unconditionally. If the current token already has that scope, it will be inserted into the scope list twice and addedScopes will be set to
true, resulting in a new token being fetched that has no net new scopes.

Instead, check whether additionalScopes are actually new.

Signed-off-by: Clayton Coleman [email protected]

AuthorizeRequest() injects the 'pull' scope if `from` is set
unconditionally. If the current token already has that scope, it will
be inserted into the scope list twice and `addedScopes` will be set to
true, resulting in a new token being fetched that has no net new scopes.

Instead, check whether `additionalScopes` are actually new.

Signed-off-by: Clayton Coleman <[email protected]>
@codecov
Copy link

codecov bot commented Aug 23, 2017

Codecov Report

Merging #2382 into master will decrease coverage by 9.61%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2382      +/-   ##
==========================================
- Coverage   60.24%   50.63%   -9.62%     
==========================================
  Files         126      126              
  Lines       14426    14433       +7     
==========================================
- Hits         8691     7308    -1383     
- Misses       4847     6377    +1530     
+ Partials      888      748     -140
Impacted Files Coverage Δ
registry/client/auth/session.go 67.61% <0%> (-1.73%) ⬇️
registry/storage/driver/gcs/gcs.go 0.32% <0%> (-66.13%) ⬇️
registry/storage/driver/oss/oss.go 0.45% <0%> (-56.5%) ⬇️
registry/storage/driver/s3-aws/s3.go 4.07% <0%> (-55.4%) ⬇️
registry/storage/driver/s3-goamz/s3.go 0.4% <0%> (-52.4%) ⬇️
registry/client/transport/transport.go 68.75% <0%> (-8.75%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f6282d...23f8ca8. Read the comment docs.

@dmcgowan
Copy link
Collaborator

LGTM

@dmcgowan dmcgowan merged commit d9e0121 into distribution:master Aug 24, 2017
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.

2 participants