-
Notifications
You must be signed in to change notification settings - Fork 57
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
modify requests to send authorization header #197
Conversation
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.
Can you remove these comments? Then I'd be happy to approve/merge this.
pkg/grafana/dashboards.go
Outdated
req.Header.Set("Content-Type", "application/json") | ||
req.Header.Set("Authorization", "Bearer " + grafanaToken) | ||
|
||
//resp, err := http.Post(grafanaURL, "application/json", bytes.NewBufferString(wrappedJSON)) |
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.
we can remove this line
pkg/grafana/datasources.go
Outdated
req.Header.Set("Content-Type", "application/json") | ||
req.Header.Set("Authorization", "Bearer " + grafanaToken) | ||
|
||
//resp, err := http.Post(grafanaURL, "application/json", bytes.NewBufferString(sourceJSON)) |
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.
can remove
pkg/grafana/folders.go
Outdated
} | ||
req.Header.Set("Authorization", "Bearer " + grafanaToken) | ||
|
||
//resp, err := http.Get(grafanaURL) |
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.
remove
pkg/grafana/folders.go
Outdated
req.Header.Set("Content-Type", "application/json") | ||
req.Header.Set("Authorization", "Bearer " + grafanaToken) | ||
|
||
//resp, err := http.Post(grafanaURL, "application/json", bytes.NewBufferString(folderJSON)) |
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.
again
pkg/grafana/folders.go
Outdated
} | ||
req.Header.Set("Authorization", "Bearer " + grafanaToken) | ||
|
||
//resp, err := http.Get(grafanaURL) |
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.
last one!
@malcolmholmes I have removed the comments. |
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.
Thanks for providing both a rationale and a fix. Merging now!
I modified the code to use header-based authentication. The following changes where made:
With this changes, Grizzly can be used even if the basic authentication method cannot be used e.g. because Grafana sits behind a reverse proxy with automatic authentication such as OpenID or similar.
Not sure if all requests are modified or if there are other requests where the Authentication header musst be added. Especially for the rules further modification can be neccesarry.