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

Update to go-pkgz/auth/v2 and golang-jwt/jwt/v5 #1758

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

paskal
Copy link
Collaborator

@paskal paskal commented Apr 10, 2024

This will also serve as a reference for go-pkgz/auth/v2 migration, and I'll add links to this PR to the readme for the auth package.

@paskal paskal added the backend label Apr 10, 2024
@paskal paskal added this to the v1.13.0 milestone Apr 10, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8638476796

Details

  • 20 of 33 (60.61%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 84.824%

Changes Missing Coverage Covered Lines Changed/Added Lines %
backend/app/rest/api/admin.go 6 9 66.67%
backend/app/cmd/server.go 6 16 37.5%
Files with Coverage Reduction New Missed Lines %
backend/app/cmd/server.go 1 83.53%
Totals Coverage Status
Change from base Build 8388042292: -0.02%
Covered Lines: 5975
Relevant Lines: 7044

💛 - Coveralls

@paskal paskal removed this from the v1.13.0 milestone May 12, 2024
@paskal paskal force-pushed the paskal/jwt_v5 branch 2 times, most recently from 81ba327 to 9f38749 Compare July 30, 2024 22:51
@paskal paskal marked this pull request as ready for review July 30, 2024 22:52
@paskal paskal requested a review from umputun as a code owner July 30, 2024 22:52
Copy link

github-actions bot commented Aug 1, 2024

Pull Request Test Coverage Report for Build 10192720403

Details

  • 20 of 33 (60.61%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 84.832%

Changes Missing Coverage Covered Lines Changed/Added Lines %
backend/app/rest/api/admin.go 6 9 66.67%
backend/app/cmd/server.go 6 16 37.5%
Files with Coverage Reduction New Missed Lines %
backend/app/cmd/server.go 1 83.53%
Totals Coverage Status
Change from base Build 10172404701: -0.02%
Covered Lines: 5990
Relevant Lines: 7061

💛 - Coveralls

@paskal paskal force-pushed the paskal/jwt_v5 branch 2 times, most recently from a1b6029 to 4ac60d0 Compare December 9, 2024 01:47
Copy link
Owner

@umputun umputun left a comment

Choose a reason for hiding this comment

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

looking good, just a couple of trully minor things

@@ -1215,10 +1215,15 @@ func (s *ServerCommand) getAuthenticator(ds *service.DataStore, avas avatar.Stor
if c.User == nil {
return c
}
c.User.SetAdmin(ds.IsAdmin(c.Audience, c.User.ID))
c.User.SetBoolAttr("blocked", ds.IsBlocked(c.Audience, c.User.ID))
if len(c.Audience) != 1 {
Copy link
Owner

Choose a reason for hiding this comment

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

I think this check needs some comments explaining what is going on here, specifically how 0 or >1 is causing this lack of update and why.

@@ -107,13 +107,20 @@ func (a *admin) deleteMeRequestCtrl(w http.ResponseWriter, r *http.Request) {
return
}

if err = a.dataService.DeleteUserDetail(claims.Audience, claims.User.ID, engine.AllUserDetails); err != nil {
if len(claims.Audience) != 1 {
rest.SendErrorJSON(w, r, http.StatusBadRequest, fmt.Errorf("bad request"), "can't process token, aud is not a single element", rest.ErrActionRejected)
Copy link
Owner

Choose a reason for hiding this comment

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

Probably changing the error message to indicate which element is expected to be single will be better.

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

Successfully merging this pull request may close these issues.

3 participants