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

fix(authz): get username from authn.go request context #1383

Merged
merged 1 commit into from
Apr 27, 2023

Conversation

peusebiu
Copy link
Collaborator

What type of PR is this?

Which issue does this PR fix:

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

Automation added to e2e:

Will this break upgrades or downgrades?

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Apr 21, 2023

Codecov Report

Merging #1383 (30798ff) into main (635d07a) will decrease coverage by 0.01%.
The diff coverage is 90.90%.

@@            Coverage Diff             @@
##             main    #1383      +/-   ##
==========================================
- Coverage   90.71%   90.70%   -0.01%     
==========================================
  Files          99       99              
  Lines       22246    22253       +7     
==========================================
+ Hits        20180    20185       +5     
- Misses       1540     1542       +2     
  Partials      526      526              
Impacted Files Coverage Δ
pkg/api/authz.go 96.41% <86.95%> (+0.57%) ⬆️
pkg/requestcontext/context.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

pkg/api/authz.go Outdated Show resolved Hide resolved
@peusebiu peusebiu force-pushed the authz_fail branch 4 times, most recently from 5791261 to 9cfcfdc Compare April 25, 2023 09:08
@peusebiu peusebiu marked this pull request as ready for review April 25, 2023 09:09
@peusebiu peusebiu requested a review from rchincha as a code owner April 25, 2023 09:09
pkg/api/authz.go Outdated Show resolved Hide resolved
pkg/api/authz.go Outdated Show resolved Hide resolved
pkg/requestcontext/context.go Outdated Show resolved Hide resolved
@peusebiu peusebiu force-pushed the authz_fail branch 3 times, most recently from da778b0 to 1b2ef2b Compare April 25, 2023 14:16
andaaron
andaaron previously approved these changes Apr 25, 2023
pkg/api/authz.go Outdated Show resolved Hide resolved
andaaron
andaaron previously approved these changes Apr 26, 2023
pkg/api/authz.go Outdated

readGlobPatterns := ac.getGlobPatterns(username, acCtx.Groups, Read)
dmcGlobPatterns := ac.getGlobPatterns(username, acCtx.Groups, DetectManifestCollision)
// getContext updates an AccessControlContext for a user/anonymous and returns it.
Copy link
Contributor

@rchincha rchincha Apr 26, 2023

Choose a reason for hiding this comment

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

Leave it as getContext()

pkg/api/authz.go Outdated
readGlobPatterns := ac.getGlobPatterns(username, acCtx.Groups, Read)
dmcGlobPatterns := ac.getGlobPatterns(username, acCtx.Groups, DetectManifestCollision)
// getContext updates an AccessControlContext for a user/anonymous and returns it.
func (ac *AccessController) updateContext(acCtx *localCtx.AccessControlContext, request *http.Request) context.Context {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getContext()

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

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

lgtm

@rchincha rchincha merged commit 07bfc8a into project-zot:main Apr 27, 2023
24 of 25 checks passed
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.

None yet

3 participants