-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat(auth): server side changes for new worker auth flow #790
Conversation
Codecov Report
@@ Coverage Diff @@
## main #790 +/- ##
=========================================
+ Coverage 0 56.48% +56.48%
=========================================
Files 0 243 +243
Lines 0 16164 +16164
=========================================
+ Hits 0 9131 +9131
- Misses 0 6628 +6628
- Partials 0 405 +405
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs server mocks for admin/register-token (probably not validate though)
correction: validate needs a mocked endpoint but probably not a mock response json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's closer. I see one more issue with UpdateWorker, and then I can approve.
api/worker.go
Outdated
if secret, ok := c.Value("secret").(string); ok { | ||
tkn := new(library.Token) | ||
tkn.SetToken(secret) | ||
c.JSON(http.StatusOK, WorkerCheckIn{Worker: w, Token: tkn}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the swagger doc comment's 200 response needs to be updated to show the two different response types: Worker, and WorkerCheckIn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, sdk-go is going to need to know about both types that can be returned. Or, maybe the worker needs a different server end point it can use to check in and get the new token.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I think about this, the more I think it should just be a separate endpoint altogether
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest commit decoupled UpdateWorker
and RefreshWorkerAuth
, which I think is much cleaner. Plus we don't have to create a temporary struct as a return type. I also took this change to its natural conclusion and eliminated platform admin access to refresh auth, as that can only cause problems in practice.
Thank you for the feedback!
Ref: go-vela/community#770
Dependent on: go-vela/types#283