-
Notifications
You must be signed in to change notification settings - Fork 30
server: add app cap grant checking for /clients/ endpoint #79
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
Conversation
| req := httptest.NewRequest("DELETE", "/clients/test-client-1", nil) | ||
| rr := httptest.NewRecorder() | ||
|
|
||
| s.serveDeleteClient(rr, req, "test-client-1") |
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.
changed to ServeHTTP to use app cap middleware.
59b3a3e to
d081ba3
Compare
| rr := httptest.NewRecorder() | ||
|
|
||
| s.serveGetClientsList(rr, req) | ||
| s.ServeHTTP(rr, req) |
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.
changed to ServeHTTP to use app cap middleware.
| rr := httptest.NewRecorder() | ||
|
|
||
| s.serveNewClient(rr, req) | ||
| s.ServeHTTP(rr, req) |
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.
changed to ServeHTTP to use app cap middleware.
| // Register /clients/ endpoint | ||
| // Migrated from legacy/tsidp.go:684 | ||
| mux.HandleFunc("/clients/", s.serveClients) | ||
| mux.HandleFunc("/clients/", s.addGrantAccessContext(s.serveClients)) |
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.
add middleware handler to inject the App Cap grant into r.Context
remyguercio
left a comment
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.
LGTM, and I agree that consolidation of endpoints to prevent misalignments like this is the path forward.
|
@mostlygeek could you also add some tests that make sure that all non-public endpoints check the grants? |
Update the /clients/ endpoint to require the allow_admin_ui capability grant added in #47.
Updates #78