Marcus Efraimsson
a6b2e1865c
Datasource: Improve default timeout settings for HTTP client provider ( #36621 )
...
Make sure that default timeout settings are based on configuration
parameters. This now applies for core data sources using old TSDB
contracts and new SDK contracts. Before it was only applied for old TSDB
contracts.
Also moves global setting variables to non-global (setting.Cfg).
2021-07-15 14:30:06 +02:00
idafurjes
60ac54d969
Chore: Refactor OAuth/social package to service ( #35403 )
...
* Creating SocialService
* Add GetOAuthProviders as socialService method
* Add OAuthTokenService
* Add GetOAuthHttpClient method to SocialService
* Rename services, access socialMap from GetConnector
* Fix tests by mocking oauthtoken methods
* Move NewAuthService into Init
* Move OAuthService to social pkg
* Refactor OAuthService to OAuthProvider
* Fix nil map error, rename file, simplify tests
* Fix bug for Forward OAuth Identify
* Remove file after rebase
2021-07-07 08:54:17 +02:00
Sergey Kostrukov
89ba607382
AzureMonitor: strongly-typed AzureCredentials and correct resolution of auth type and cloud ( #36284 )
2021-07-05 12:20:12 +02:00
Sergey Kostrukov
52e38c54e5
AzureMonitor: token provider into aztokenprovider and cleanup ( #36102 )
2021-06-29 10:05:42 +02:00
Andres Martinez Gotor
6b786e7f68
Avoid log entry if not set for debug ( #35741 )
2021-06-15 15:03:24 +02:00
Andres Martinez Gotor
7109285ac9
AzureMonitor: Use auth middleware for QueryData requests ( #35343 )
2021-06-11 17:02:24 +02:00
Sergey Kostrukov
a337f70469
AzureMonitor: Fix Azure token provider national clouds ( #34615 )
...
* Fix AAD authority for sovereign clouds
* Update Azure SDK with scopes fix
* Credential initialization in cache
2021-05-25 08:19:08 +02:00
Marcus Efraimsson
348e76fc8e
Datasource: Shared HTTP client provider for core backend data sources and any data source using the data source proxy ( #33439 )
...
Uses new httpclient package from grafana-plugin-sdk-go introduced
via grafana/grafana-plugin-sdk-go#328 .
Replaces the GetHTTPClient, GetTransport, GetTLSConfig methods defined
on DataSource model.
Longer-term the goal is to migrate core HTTP backend data sources to use the
SDK contracts and using httpclient.Provider for creating HTTP clients and such.
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-05-19 23:53:41 +02:00
Sergey Kostrukov
c1b8a10f41
Plugins: Fix Azure token provider cache panic and auth param nil value ( #34252 )
...
* More tests for token cache
* Safeguarding from panic and concurrency fixes
* Update Azure dependencies
* Fix interpolation of empty plugin data
2021-05-18 15:36:58 +02:00
Sergey Kostrukov
81f6c806e1
Azure token provider with support for Managed Identities ( #33807 )
...
* Azure token provider
* Configuration for Azure token provider
* Authentication via Azure SDK for Go
* Fix typo
* ConcurrentTokenCache for Azure credentials
* Resolve AAD authority for selected Azure cloud
* Fixes
* Generic AccessToken and fixes
* Tests and wordings
* Tests for getAccessToken
* Tests for getClientSecretCredential
* Tests for token cache
2021-05-14 13:59:07 +02:00
Sergey Kostrukov
1790737cf1
Plugins: AuthType in route configuration and params interpolation ( #33674 )
...
* AuthType in route configuration
* Pass interpolated auth parameters to token provider
* Unit tests
* Update after review
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Fixes #33669
Closed #33732
2021-05-06 22:05:23 +02:00
Sergey Kostrukov
19f520d891
PluginProxy: Split implementations of token providers ( #32820 )
...
* Split implementations of token providers
* Fix imports
* Fix code racing in unit tests
2021-05-03 13:46:32 +01:00
Sofia Papagiannaki
fcd674ec58
Fix deleting prom rules endpoints via ds_proxy ( #33491 )
2021-04-29 10:20:51 +03:00
Owen Diehl
dadccdda06
Allows posting to prom rules endpoints via ds_proxy ( #32946 )
...
* allows posting to prom rules endpoints via ds_proxy
* prom proxy routes via plugin and fix proxy route matching bug
* bump ci
2021-04-14 13:06:20 -04:00
Zoltán Bedi
7a2ab93e7a
Prometheus: Allow exemplars endpoint in data source proxy ( #32802 )
2021-04-08 18:10:59 +02:00
Marcus Efraimsson
aad43869c3
Plugins: Support set body content in plugin routes ( #32551 )
...
Adds support for overriding the body and length in plugin routes.
2021-03-31 16:38:35 +02:00
Marcus Efraimsson
c0edf88f9f
Data proxy: Fix encoded characters in URL path should be proxied encoded ( #30597 )
...
Fix encoded characters in URL path should be proxied as encoded in the data proxy.
Fixes #26870
Fixes #31438
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-17 12:17:41 +01:00
Arve Knudsen
b79e61656a
Introduce TSDB service ( #31520 )
...
* Introduce TSDB service
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2021-03-08 07:02:49 +01:00
Ivana Huckova
dce67db6ba
Prometheus: Use configured HTTP method for /series and /labels endpoints ( #31401 )
...
* Run post-friendly request with set method first
* Improve messaging, retry only when post and specific status code
* Add comments
* Fix backend
* Update public/app/plugins/datasource/prometheus/datasource.ts
2021-02-23 16:31:03 +01:00
Emil Hessman
e598c9e6d9
Chore: Remove duplicate interpolateString test ( #29941 )
2020-12-21 07:53:31 +01:00
Arve Knudsen
c2cad26ca9
Chore: Disable default golangci-lint filter ( #29751 )
...
* Disable default golangci-lint filter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Chore: Fix linter warnings
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 09:32:06 +01:00
Arve Knudsen
ac09baae7d
Chore: Use Header.Set method instead of Header.Add ( #29804 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-14 15:13:01 +01:00
Carl Bergquist
15a6508d4a
trace user login and datasource name instead of id ( #29183 )
...
id's are not very helpful when debugging a system.
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2020-11-18 09:21:45 +01:00
Arve Knudsen
8c765e8068
API: Rewrite tests from goconvey ( #29091 )
...
* API: Rewrite tests from goconvey
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 11:31:35 +01:00
Victor Cinaglia
967e9b39e8
Fix panic when using complex dynamic URLs in app plugin routes ( #27977 )
...
* remove unused function to interpolate URLs
* share function to add headers between ds/plugin proxies
* stop performing unnecessary plugin setting lookup
* fix bug causing runtime errors when using complex templated URLs
* lower case util functions not used outside of pluginproxy package
* change test URL to a (valid) dummy URL to make intent clearer
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 10:56:42 +01:00
Arve Knudsen
fbf0d2c086
Plugin proxy: Handle URL parsing errors ( #29093 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-13 19:38:09 +01:00
Arve Knudsen
e503188b6f
Data source proxy: Convert 401 from data source to 400 ( #28962 )
...
* Data source proxy: Convert 401 from data source to 400
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-13 13:21:43 +01:00
Arve Knudsen
cb62e69997
Chore: Convert API tests to standard Go lib ( #29009 )
...
* Chore: Convert tests to standard Go lib
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2020-11-13 09:52:38 +01:00
Arve Knudsen
3d3a7cbba8
Chore: Fix staticcheck issues ( #28860 )
...
* Chore: Fix issues reported by staticcheck
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Undo changes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Chore: Fix issues reported by staticcheck
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 13:07:06 +01:00
Bill Oley
b3a868169b
OAuth: Support Forward OAuth Identity for backend data source plugins ( #27055 )
...
Adds support for the Forward OAuth Identity feature in backend data source plugins.
Earlier this feature has only been supported for non-backend data source plugins.
Fixes #26023
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-10-24 01:34:38 +02:00
Arve Knudsen
4084b53f91
plugins: Don't exit on duplicate plugin ( #28390 )
...
* plugins: Don't exit on duplicate plugin
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Add missing files
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-10-21 12:39:41 +02:00
Arve Knudsen
a5d9196a53
Chore/fix lint issues ( #27704 )
...
* Chore: Fix linting issues
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-09-22 16:22:19 +02:00
Domas
564d7ecea7
DataProxy: Ignore empty URL's in plugin routes ( #27653 )
...
This adds a check to see if plugin route URL is empty, and in such case
does not modify request schema and host of the request to be proxied.
This behavior is now the same as in the plugin proxy.
2020-09-18 13:22:07 +02:00
Bill Oley
19caa100dc
OAuth: Fix token refresh failure when custom SSL settings are configured for OAuth provider ( #27523 )
...
OAuth token refresh fails when custom SSL settings are configured for
oauth provider. These changes makes sure that custom SSL settings
are applied for HTTP client before refreshing token.
Fixes #27514
2020-09-11 17:25:03 +02:00
Sean Lafferty
900eb8070e
Proxy: Fix updating refresh token in OAuth pass-thru ( #26885 )
...
* Handle updating refresh token in oauth pass-thru
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-17 18:38:32 +02:00
Arve Knudsen
4c56eb3991
Chore: Enable goprintffuncname and nakedret linters ( #26376 )
...
* Chore: Enable goprintffuncname linter
* Chore: Enable nakedret linter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-23 08:14:39 +02:00
Arve Knudsen
d4e4cb4c71
Chore: Enable Go linter gocritic ( #26224 )
...
* Chore: Enable gocritic linter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-16 14:39:01 +02:00
Arve Knudsen
41d432b5ae
Chore: Enable whitespace linter ( #25903 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-06 20:17:28 +02:00
Arve Knudsen
3651a8e976
Chore: Disable scopelint for tests ( #25923 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-30 11:05:47 +02:00
Arve Knudsen
d1e6214a4a
Chore: Enable scopelint Go linter ( #25896 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-29 17:04:38 +02:00
Arve Knudsen
d352c213b3
API: Recognize MSSQL data source URLs ( #25629 )
...
* API: Recognize MSSQL URLs
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Move MSSQL URL validation into mssql package
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-17 11:17:11 +02:00
Robbert Gurdeep Singh
034abaa73a
Security: Use Header.Set and Header.Del for X-Grafana-User header ( #25495 )
...
This ensures that the X-Grafana-User header can be trusted.
If the configuration enabled the setting of this header, the
server can now trust that X-Grafana-User is set/unset by Grafana.
Before this, an anonymous user could simply set the X-Grafana-User
header themselves (using the developer tool for example)
2020-06-11 21:15:17 +02:00
Arve Knudsen
164242f5fd
Data sources: Don't fail if URL doesn't specify protocol ( #24497 )
2020-05-12 13:04:18 +02:00
Mario Trangoni
5116420e9a
Fix misspell issues ( #23905 )
...
* Fix misspell issues
See,
$ golangci-lint run --timeout 10m --disable-all -E misspell ./...
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
* Fix codespell issues
See,
$ codespell -S './.git*' -L 'uint,thru,pres,unknwon,serie,referer,uptodate,durationm'
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
* ci please?
* non-empty commit - ci?
* Trigger build
Co-authored-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
2020-04-29 21:37:21 +02:00
Daniel Lee
52154b465b
dsproxy: adds support for url params for plugin routes ( #23503 )
...
* dsproxy: adds support for url params for plugin routes
* docs: fixes after review
* pluginproxy: rename Params to URLParams
* Update pkg/plugins/app_plugin.go
Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
* Apply suggestions from code review
Co-Authored-By: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
* pluginproxy: rename struct
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2020-04-24 10:32:13 +02:00
Arve Knudsen
7d88018531
DataSourceProxy: Handle URL parsing error ( #23731 )
...
* pluginproxy: Handle URL parsing error
* pkg/api: Validate data source URLs
* pkg/api: Return 400 for URL validation error
2020-04-22 10:30:06 +02:00
John McBride
b017e437d8
Fix typo in oauth error ( #23270 )
...
fixes : #23269
2020-04-02 08:24:59 +02:00
Carl Bergquist
3fdd2648b1
Chore: Avoid aliasing importing models in api package ( #22492 )
2020-03-04 12:57:20 +01:00
Marcus Efraimsson
e6cec8dbdc
Backend plugins: Prepare and clean request headers before resource calls ( #22321 )
...
Moves common request proxy utilities to proxyutil package with
support for removing X-Forwarded-Host, X-Forwarded-Port,
X-Forwarded-Proto headers, setting X-Forwarded-For header
and cleaning Cookie header.
Using the proxyutil package to prepare and clean request
headers before resource calls.
Closes #21512
2020-03-03 11:45:16 +01:00
Martin
cffcc95be0
pkg/api/pluginproxy: Access token provider should handle access tokens without ExpiresOn field ( #19928 )
...
* pkg/api/pluginproxy: Add support for expire_in field in access-token
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-02-26 15:59:02 +01:00
Carl Bergquist
ff9556229a
Data proxy: Log proxy errors using Grafana logger ( #22174 )
...
Now any errors logged by http.ReverseProxy are forwarded to
Grafana's logger and includes more contextual information like
level (error), user id, org id, username, proxy path, referer and
IP address.
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-02-18 13:26:01 +01:00
Anthony Woods
f56f54b1a3
Auth: Rotate auth tokens at the end of requests ( #21347 )
...
By rotating the auth tokens at the end of the request we ensure
that there is minimum delay between a new token being generated
and the client receiving it.
Adds auth token slow load test which uses random latency for all
tsdb queries..
Cleans up datasource proxy response handling.
DefaultHandler in middleware tests should write a response, the
responseWriter BeforeFuncs wont get executed unless a response
is written.
Fixes #18644
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2020-01-15 13:03:12 +01:00
Marcus Efraimsson
3fc5f4552a
CloudWatch: Fix high CPU load ( #20579 )
...
* Cache decrypted securejsondata
* Models: Add datasource cache tests
2019-11-22 14:21:23 +01:00
Marcus Efraimsson
dfa2f3d2fb
Chore: Log actual error when oauth pass thru fails ( #20419 )
...
Logs the actual error when failing to retreive access token
when OAuth pass true is enabled for a datasource.
Ref: #20407
2019-11-15 17:14:53 +01:00
Weeco
8cd93f0b88
Datasource: Add custom headers on alerting queries ( #19508 )
...
* Add custom headers on alerting queries
Reference issue #15381
Signed-off-by: Martin Schneppenheim <martin.schneppenheim@rewe-digital.com>
* Fix datasource transport tests
* Migrate decrypting header test to models pkg
* Check correct header
* Add HTTP transport test
Fixes #15381
2019-10-11 14:28:52 +02:00
Arve Knudsen
0a2d5e16dd
pkg/api: Check errors ( #19657 )
...
* pkg/api: Check errors
* pkg/api: Remove unused function HashEmail
2019-10-08 18:57:53 +02:00
Oleg Gaidarenko
caa1314f44
Build: use golangci-lint as a make command ( #17739 )
...
* Build: use golangci-lint as a make command
* Since gometalinter was deprecated in favor of golangci-lint so it was
replaced by it. Responsibilities held by the gometalinter was moved to
golangci-lint
* There was some changes in implementation (that was also mentioned in
the code comment) between the tools, which uncovered couple errors
in the code. Those issues were either solved or disabled by
the inline comments
* Introduce the golangci-lint config, to make their
configuration more manageable
* Build: replace backend-lint.sh script with make
2019-07-02 16:06:59 +03:00
Maxim Ivanov
151fe240fc
OAuth: Fix for wrong user token updated on OAuth refresh in DS proxy ( #17541 )
2019-06-12 13:47:38 +02:00
Mario Trangoni
87760d4fde
Codestyle: Fix govet issues ( #17178 )
...
ref #10381
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2019-06-04 22:00:05 +02:00
zhulongcheng
2fff8f77dc
move log package to /infra ( #17023 )
...
ref #14679
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-13 08:45:54 +02:00
Brian Gann
b07d0b1026
Plugins: Support templated urls in routes ( #16599 )
...
This adds support for using templated/dynamic urls in routes.
* refactor interpolateString into utils and add interpolation support for app plugin routes.
* cleanup and add error check for url parse failure
* add docs for interpolated route urls
Closes #16835
2019-05-07 18:55:39 +02:00
Marcus Efraimsson
e210725d3d
DataProxy: Restore Set-Cookie header after proxy request ( #16838 )
...
If Grafana rotates the user's auth token during a request to the data
source proxy it will set the Set-Cookie header with new auth token in
response before proxying the request to the datasource.
Before this fix the Set-Cookie response header was cleared after the
proxied request was finished to make sure that proxied datasources
cannot affect cookies in users browsers. This had the consequence
of accidentally also clearing the new auth token set in Set-Cookie
header.
With this fix the original Set-Cookie value in response header is now
restored after the proxied datasource request is finished. The existing
logic of clearing Set-Cookie response header from proxied request
have been left intact.
Fixes #16757
2019-05-01 16:32:03 +02:00
Andrej Ocenas
66f6e16916
Security: Store datasource passwords encrypted in secureJsonData ( #16175 )
...
* Store passwords in secureJsonData
* Revert unnecessary refactors
* Fix for nil jsonSecureData value
* Remove copied encryption code from migration
* Fix wrong field reference
* Remove migration and provisioning changes
* Use password getters in datasource proxy
* Refactor password handling in datasource configs
* Add provisioning warnings
* Update documentation
* Remove migration command, moved to separate PR
* Remove unused code
* Set the upgrade version
* Remove unused code
* Remove double reference
2019-04-15 11:11:17 +02:00
Sean Lafferty
b696492891
Rename dispatched commands to make them easy to grok
2019-03-20 14:32:41 -04:00
Sean Lafferty
3f9a19dcd5
Merge branch 'master' into 12556-oauth-pass-thru
2019-03-14 13:18:00 -04:00
Andrej Ocenas
697a87b7b2
Add check so that header is not sent for anonymous users
2019-03-14 16:33:21 +01:00
Andrej Ocenas
bbdc1c0e64
Add custom header with grafana user and a config switch for it
2019-03-14 16:33:19 +01:00
Sean Lafferty
fcc18d8121
Change import path for social in the tests
2019-03-13 14:55:22 -04:00
Sean Lafferty
8d8119aa98
Change import path for social since it has moved
2019-03-13 14:34:55 -04:00
Sean Lafferty
8d19ca005f
Merge branch 'master' into 12556-oauth-pass-thru
2019-03-13 14:25:43 -04:00
Sean Lafferty
7e62394d01
Add function in ds_proxy to handle oauthPassThru headers
2019-03-13 13:45:32 -04:00
Sean Lafferty
4324a7f51a
Remove auth module from ds_proxy oauth test
2019-03-13 13:28:49 -04:00
Sean Lafferty
3b15e110a5
Get most recent oauth token from db, rather than lookup by auth_module
2019-03-13 13:22:22 -04:00
Marcus Efraimsson
a1cd550df4
revert ds_proxy timeout and implement dataproxy timeout correctly
2019-02-11 13:42:05 +01:00
Sean Lafferty
5a59cdf0ef
Add oauth pass-thru option for datasources
2019-02-01 19:40:57 -05:00
Mario Trangoni
8261613b51
pkg/util/{ip.go,url.go}: Fix some golint issues
...
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=golint ./...
ip.go:8:6⚠️ func SplitIpPort should be SplitIPPort (golint)
url.go:14:6⚠️ func NewUrlQueryReader should be NewURLQueryReader (golint)
url.go:9:6⚠️ type UrlQueryReader should be URLQueryReader (golint)
url.go:37:6⚠️ func JoinUrlFragments should be JoinURLFragments (golint)
2019-01-28 22:29:20 +01:00
Benjamin Reed
9108fd1b9d
add global datasource proxy timeout setting
...
closes grafana#5699
2019-01-24 14:06:48 -05:00
Brian Gann
02365514f9
redact value for plugin proxy routes
2018-12-04 22:35:00 -06:00
Kornelijus Survila
0cafd9a663
dataproxy: Override incoming Authorization header
2018-11-30 12:12:55 -07:00
Julien Pivotto
62417ca69f
Remove Origin and Referer headers while proxying requests
...
Fix #13949
Fix #13328
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2018-11-08 14:57:47 +01:00
Erik Sundell
b02a8127ff
stackdriver: remove debug comments
2018-10-22 16:11:17 +02:00
Erik Sundell
afe0b4b8db
stackdriver: fix typo
2018-10-22 16:11:17 +02:00
Erik Sundell
b2c6c743ce
stackdriver: add debug logging
2018-10-22 16:11:17 +02:00
Erik Sundell
cd7b454e25
stackdriver: add default value for authentication type
2018-10-22 16:03:14 +02:00
Erik Sundell
823838a839
stackdriver: wip - remove debug code
2018-10-22 16:03:14 +02:00
Erik Sundell
2b1709b875
stackdriver: only get default token from metadata server when applying route
2018-10-22 16:03:13 +02:00
Erik Sundell
ff5f281508
stackdriver: wip - get metric descriptors in the backend
2018-10-22 16:03:13 +02:00
Erik Sundell
60617d0bf7
stackdriver: wip - add logic for retrieving token from gce metadata server in the auth provider
2018-10-22 16:03:13 +02:00
Erik Sundell
3f9ed2efaa
stackdriver: wip - temp remove jwt token auth
2018-10-22 16:03:12 +02:00
Erik Sundell
b2de0d8c3e
stackdriver: wip - always use gce default account for stackdriver
2018-10-22 16:03:12 +02:00
Erik Sundell
2002162073
stackdriver: wip - add scope and remove debug code
2018-10-22 16:03:12 +02:00
Erik Sundell
df215d9d09
stackdriver: WIP - test retrieving project id from gce metadata
2018-10-22 16:03:12 +02:00
Mitsuhiro Tanda
fbe0ffd10b
skip jwt token auth if privateKey is empty
2018-10-22 16:03:12 +02:00
Mitsuhiro Tanda
43aa6603a3
fetch token from GCE metadata server
2018-10-22 16:03:12 +02:00
Marcus Efraimsson
2b1e4d001a
Merge pull request #13326 from ryantxu/proxy-slash
...
Keep trailing slash for datasource proxy requests
2018-10-04 14:38:34 +02:00
Marcus Efraimsson
8bf4d68035
add datasource proxy test to verify trailing slashes are forwarded
2018-10-03 12:28:30 +02:00
Daniel Lee
d11f67eb25
stackdriver: change info logging to debug logging
2018-09-28 16:16:27 +02:00
Torkel Ödegaard
6db0880fd8
invalidate access token cache after datasource is updated
2018-09-21 14:24:44 +02:00
Ryan McKinley
7c6227c061
remove the test that does not do anything
2018-09-18 11:18:55 -07:00
Ryan McKinley
71dfeff782
add a test
2018-09-17 12:28:36 -07:00
Daniel Lee
982e095f85
dsproxy: add mutex protection to the token caches
2018-09-14 11:13:09 +02:00
Erik Sundell
56e8e50497
Stackdriver: Use ds_auth_provider in stackdriver. This will make sure the token is renewed when it has exporired
2018-09-14 09:38:16 +02:00
Erik Sundell
db170845b0
Stackdriver: Restructured ds proxy tests
2018-09-14 09:38:16 +02:00
Daniel Lee
05f6710454
stackdriver: fix test
2018-09-14 09:38:16 +02:00
Erik Sundell
1725940ab9
Stackdriver: Add new file
2018-09-14 09:38:16 +02:00
Erik Sundell
6a610558c4
Stackdriver: Start breaking out apply route to its own file
2018-09-14 09:38:16 +02:00
Erik Sundell
23339e4322
Stackdriver: Use new access token API
2018-09-14 09:35:28 +02:00
Erik Sundell
71af62e741
Stackdriver: Temporary exporting token lookup
2018-09-14 09:35:28 +02:00
Erik Sundell
92d631986f
Stackdriver: Removed debug logging
2018-09-14 09:35:27 +02:00
Daniel Lee
e7648c4070
dsproxy: implements support for plugin routes with jwt file
...
Google Cloud service accounts use a JWT token to get an
oauth access token. This adds support for that.
2018-09-14 09:35:27 +02:00
Erik Sundell
a4ef4792bc
Stackdriver: Add scope for google resource manager
2018-09-14 09:35:26 +02:00
Erik Sundell
350bcf4f56
Fixed broken if statement
2018-09-14 09:35:26 +02:00
Erik Sundell
7197a4c17f
Adds jwt token signing google auth
2018-09-14 09:35:26 +02:00
Erik Sundell
ef3beb1f0e
Adds poc code for retrieving google auth accesstoken
2018-09-14 09:33:50 +02:00
Daniel Lee
c75e071213
dsproxy: interpolate route url
...
Allows for dynamic urls for plugin routes. There are a few plugins
where the route url should be configurable and this change allows
using jsonData fields in the url field for a route in the
plugin.json file for a plugin.
2018-08-18 16:02:49 +02:00
Marcus Efraimsson
13921902b5
Set User-Agent header in all proxied datasource requests
...
Header value will be Grafana/%version%, i.e. Grafana/5.3.0
2018-08-15 09:46:59 +02:00
Torkel Ödegaard
4f704cec53
fix: ds_proxy test not initiating header
2018-08-14 09:18:23 +02:00
Torkel Ödegaard
2459b177f9
change: Set User-Agent to Grafana/%Version% Proxied-DS-Request %DS-Type% in all proxied ds requests
2018-08-13 18:09:01 +02:00
Carl Bergquist
828fb39ee2
Merge pull request #11643 from mrsiano/generic_oauth
...
Pass configured/auth headers to a Datasource.
2018-06-21 14:21:59 +02:00
mrsiano
cc1e3a0e3c
Pass configured/auth headers to a Datasource.
...
In some setups (ex openshift), the Datasource will require Grafana
to pass oauth token as header when sending queries.
Also, this PR allow to send any header which is something
Grafana currently does not support.
2018-06-21 14:58:05 +03:00
Daniel Lee
10d30f0b73
dsproxy: move http client variable back
...
After refactoring to be able to mock the client in
a test, the client wasn't a global variable anymore.
This change moves the client back to being a package-
level variable.
2018-06-14 13:39:46 +02:00
Daniel Lee
719ebdc24d
dsproxy: allow multiple access tokens per datasource
...
Changes the cache key for tokens to cache on datasource id +
route path + http method instead of just datasource id.
2018-06-12 17:39:38 +02:00
Daniel Lee
9413ce5ef6
Merge pull request #8096 from ryantxu/influx-db-query2
...
let the influxdb API set a database
2018-04-13 18:22:12 +02:00
Carl Bergquist
980e078222
Merge pull request #11326 from bergquist/more_traces
...
dataproxy: adds dashboardid and panelid as tags
2018-03-23 17:13:15 +01:00
Julian Kornberger
0a415c50d0
Make golint happier
2018-03-22 22:38:44 +01:00
bergquist
f142548969
dataproxy: adds dashboardid and panelid as tags
...
closes #11315
2018-03-20 22:23:28 +01:00
ryan
a04c4ba454
allow any database for influx proxy
2018-03-15 13:01:17 +01:00
ryan
ad88e5398c
remove
2018-03-15 12:57:09 +01:00
ryan
4f8ee9f5a7
merge with master
2018-03-14 23:52:24 +01:00
Mitsuhiro Tanda
a83ede0193
support POST for query and query_range
2018-03-12 13:25:05 +09:00
Dan Cech
c0ecdee375
rename Context to ReqContext
2018-03-07 11:54:50 -05:00
Dan Cech
338655dd37
move Context and session out of middleware
2018-03-06 18:16:49 -05:00
Robin Gustafsson
cf7a49977f
proxyds: delete cookies except those listed in keepCookies
2017-12-14 11:46:44 +01:00
Daniel Lee
f1aa7dcd52
proxyds: failing test for keepCookies
...
If the cookies are specified in the keepCookies property then they
should not be deleted from proxied requests for data sources
2017-12-14 11:46:44 +01:00
ryan
fb9c714a9a
run go fmt
2017-10-18 23:49:33 +02:00
ryan
4440133f4d
Add a setting to allow DB queries
2017-10-18 23:33:10 +02:00
Mitsuhiro Tanda
4f5f38f41b
remove old handler
2017-09-29 13:45:11 +09:00
bergquist
ee2e4c6567
add trace headers for outgoing requests
2017-09-18 11:08:58 +02:00
bergquist
3c8133aa4b
add traces for datasource reverse proxy requests
2017-09-18 11:08:58 +02:00
Torkel Ödegaard
71c22fdbff
dataproxy: removed some logging, closes #9078
2017-08-24 11:18:06 +02:00
Torkel Ödegaard
71c9582944
data source with token auth is starting to work, #9078
2017-08-24 11:07:37 +02:00
Torkel Ödegaard
3c9798bec9
datasource-proxy: token exchange
2017-08-23 17:18:43 +02:00
Torkel Ödegaard
8bf49c51b9
dataproxy: refactoring data source proxy to support route templates and wrote more tests for data proxy code, #9078
2017-08-23 10:52:31 +02:00
Torkel Ödegaard
63d6ab476a
feat: data source proxy refactoring and route handling, #9078
2017-08-22 17:14:15 +02:00
Dan Cech
007c08f2a8
remove X-Forwarded-* headers added by nginx when proxying data source & plugin requests ( #8418 )
...
* remove X-Forwarded-* headers added by nginx when proxying data source & plugin requests
* properly handle X-Forwarded-For
2017-05-24 13:39:40 +02:00
Dan Cech
b489e93d94
Config Array Syntax ( #8204 )
...
* refactor util encryption library so it doesn't have to import log
* add util.SplitString to handle space and/or comma-separated config lines
* go fmt
2017-04-25 09:14:29 +02:00
Torkel Ödegaard
43ba563a1c
fix(logging): change log level to trace for plugin proxy logging call, fixes #5126
2016-05-23 07:55:55 +02:00
Torkel Ödegaard
bd2e1ef67e
feat(plugins): fixed failing api test
2016-02-26 20:27:29 +01:00
Torkel Ödegaard
8db7cf49a6
feat(plugins): began refactoring AppSettings -> PluginSettings, and have the plugins list view and plugin edit view be common for all plugins
2016-02-25 14:55:31 +01:00
Torkel Ödegaard
37c6a1ddf0
feat(app routes): worked on app routes, added unit test, changed Grafana-Context header to start with X to be standard compliant, got cloud saas queries to work via app route feature and header template
2016-02-10 16:43:35 +01:00