c3ab2fdeb7
Macaron: remove custom Request type ( #37874 )
...
* remove macaron.Request, use http.Request instead
* remove com dependency from bindings module
* fix another c.Req.Request
2021-09-01 11:18:30 +02:00
e42a597e87
Remove unused Macaron code and interfaces ( #37194 )
2021-07-26 11:47:13 +02:00
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
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
89ba607382
AzureMonitor: strongly-typed AzureCredentials and correct resolution of auth type and cloud ( #36284 )
2021-07-05 12:20:12 +02:00
52e38c54e5
AzureMonitor: token provider into aztokenprovider and cleanup ( #36102 )
2021-06-29 10:05:42 +02:00
6b786e7f68
Avoid log entry if not set for debug ( #35741 )
2021-06-15 15:03:24 +02:00
7109285ac9
AzureMonitor: Use auth middleware for QueryData requests ( #35343 )
2021-06-11 17:02:24 +02:00
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
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
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
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
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
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
fcd674ec58
Fix deleting prom rules endpoints via ds_proxy ( #33491 )
2021-04-29 10:20:51 +03:00
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
7a2ab93e7a
Prometheus: Allow exemplars endpoint in data source proxy ( #32802 )
2021-04-08 18:10:59 +02:00
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
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
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
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
e598c9e6d9
Chore: Remove duplicate interpolateString test ( #29941 )
2020-12-21 07:53:31 +01:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
41d432b5ae
Chore: Enable whitespace linter ( #25903 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-06 20:17:28 +02:00
3651a8e976
Chore: Disable scopelint for tests ( #25923 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-30 11:05:47 +02:00
d1e6214a4a
Chore: Enable scopelint Go linter ( #25896 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-29 17:04:38 +02:00
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
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
164242f5fd
Data sources: Don't fail if URL doesn't specify protocol ( #24497 )
2020-05-12 13:04:18 +02:00
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
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
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
b017e437d8
Fix typo in oauth error ( #23270 )
...
fixes : #23269
2020-04-02 08:24:59 +02:00
3fdd2648b1
Chore: Avoid aliasing importing models in api package ( #22492 )
2020-03-04 12:57:20 +01:00