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

NET-10891: Add authorization middleware to sync catalog metrics endpoint #4275

Closed
wants to merge 2 commits into from

Conversation

NiniOak
Copy link
Contributor

@NiniOak NiniOak commented Aug 30, 2024

Changes proposed in this PR

  • Add an validateToken step to ensure X-Consul-Token used to make API requests to the new catalog sync metrics endpoint(/metrics) is valid

How I've tested this PR

TBD

How I expect reviewers to test this PR

TBD

Checklist

return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// TO-DO: Validate the token and proceed to the next handler
token := r.Header.Get("X-Consul-Token")
c.validateToken(token, consulConfig)
Copy link
Member

Choose a reason for hiding this comment

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

assuming this would be something like

if !c.validateToken(token, consulConfig) {
    http.Error(w, 500, "invalid token")
    return
}
next.ServeHTTP(w, r)

@NiniOak NiniOak added pr/no-changelog PR does not need a corresponding .changelog entry pr/no-backport signals that a PR will not contain a backport label labels Aug 30, 2024
@NiniOak NiniOak changed the title initial ideas NET-10891: Add authorization middleware to sync catalog metrics endpoint Aug 30, 2024
@NiniOak NiniOak closed this Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-backport signals that a PR will not contain a backport label pr/no-changelog PR does not need a corresponding .changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants