Commit Graph

473 Commits

Author SHA1 Message Date
Brian Gann
0e2d874ecf
API: Fix redirect issue when configured to use a subpath (#21652)
* request uri will contain the subpath
2020-02-14 14:51:35 +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
a1579283a6
Add disabled option for cookie samesite attribute (#21472)
Breaking change: If disabled the cookie samesite cookie attribute
will not be set, but if none the attribute will be set and is a
breaking change compared to before where none did not render the
attribute. This was due to a known issue in Safari.

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
Co-Authored-By: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

Fixes #19847
2020-01-14 17:41:54 +01:00
Jeffrey Descan
c5f906f472 Security: refactor 'redirect_to' cookie to use 'Secure' flag (#19787)
* Refactor redirect_to cookie with secure flag in middleware

* Refactor redirect_to cookie with secure flag in api/login

* Refactor redirect_to cookie with secure flag in api/login_oauth

* Removed the deletion of 'Set-Cookie' header to prevent logout

* Removed the deletion of 'Set-Cookie' at top of api/login.go

* Add HttpOnly flag on redirect_to cookies where missing

* Refactor duplicated code

* Add tests

* Refactor cookie options

* Replace local function for deleting cookie

* Delete redundant calls

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
2020-01-10 15:55:30 +02:00
Torkel Ödegaard
be2bf1a297
AuthProxy: Can now login with auth proxy and get a login token (#20175)
* AuthProxy: Can now login with auth proxy and get a login token

* added unit tests

* renamed setting and updated docs

* AuthProxy: minor tweak

* Fixed tests and namings

* spellfix

* fix

* remove unused setting, probably from merge conflict

* fix
2019-11-07 17:48:56 +01:00
Jon Gyllenswärd
53f8088316
Auth Proxy: replace ini setting ldap_sync_ttl with sync_ttl (#20191)
* Renamed ttl config in code to be more consistent with behaviour
* Introduced new setting `sync_ttl` in .ini file
* Keeping the old setting `ldap_sync_ttl` in the .ini file as fallback and compatibility.
2019-11-07 11:24:54 +01:00
Arve Knudsen
35e0e078b7
pkg/util: Check errors (#19832)
* pkg/util: Check errors
* pkg/services: DRY up code
2019-10-23 10:40:12 +02:00
Arve Knudsen
6e7c18fc1c
pkg/middleware: Check errors (#19749)
* pkg/middleware: Check errors
* pkg/middleware: Log when gzip middleware handler fails
2019-10-15 18:08:06 +02:00
gotjosh
0cbbb43222
LDAP: Add API endpoint to debug user mapping from LDAP (#18833)
* Move the ReloadLDAPCfg function to the debug file

Appears to be a better suite place for this.

* LDAP: Return the server information when we find a specific user

We allow you to specify multiple LDAP servers as part of LDAP authentication integration. As part of searching for specific users, we need to understand from which server they come from. Returning the server configuration as part of the search will help us do two things:

- Understand in which server we found the user
- Have access the groups specified as part of the server configuration

* LDAP: Adds the /api/admin/ldap/:username endpoint

This endpoint returns a user found within the configured LDAP server(s). Moreso, it provides the mapping information for the user to help administrators understand how the users would be created within Grafana based on the current configuration.

No changes are executed or saved to the database, this is all an in-memory representation of how the final result would look like.
2019-09-03 18:34:44 +01:00
Marcus Efraimsson
964c2e722f
Snapshot: Fix http api (#18830)
(cherry picked from commit be2e2330f5)
2019-09-02 15:15:46 +02:00
Oleg Gaidarenko
6ca1a6c8da
Auth: change the error HTTP status codes (#18584)
* Auth: change the error HTTP status codes

* Use 407 HTTP status code for incorrect credentials error

* Improve proxy auth logs

* Remove no longer needed TODO comment

Fixes #18439
2019-08-20 20:13:27 +03:00
kay delaney
fb0cec5591
Backend: Adds support for HTTP/2 (#18358)
* Backend: Adds support for HTTP/2

* Adds mozilla recommended ciphers

* Updates sample.ini and config documentation
2019-08-16 16:06:54 +01:00
Sofia Papagiannaki
4e29357d15
Backend: Do not set SameSite cookie attribute if cookie_samesite is none (#18462)
* Do not set SameSite login_error cookie attribute if cookie_samesite is none

* Do not set SameSite grafana_session cookie attribute if cookie_samesite is none

* Update middleware tests
2019-08-09 09:10:08 +03:00
Oleg Gaidarenko
d88fdc86fc Auth: Do not search for the user twice (#18366)
* Auth: Do not search for the user twice

Previously `initContextWithBasicAuth` did not use `LoginUserQuery`, doing
`GetUserByLoginQuery` only i.e. looking user in DB only, things changed when
this function started to check LDAP provider via `LoginUserQuery` (#6940),
however, this request was placed after `GetUserByLoginQuery`, so we first
looking in DB then in the LDAP - if LDAP user hasn't logged in we will
not find it in DB, so `LoginUserQuery` will never be reached.

`LoginUserQuery` request already performs `GetUserByLoginQuery`
request in correct sequence. So we can just remove redundant request.

* Correct sequence execution during authentification &
  introduce tests for it

* Move basic auth tests to separate test file, since main test file already
  pretty large

* Introduce `testing.go` for the middleware module

* Remove redundant test helper function

* Make handler names more explicit

Ref 5777f65d05
Fixes #18329

* Auth: address review comment
2019-08-03 21:50:05 +02:00
Oleg Gaidarenko
7e89a93b5f
Auth: introduce more tests for middleware module (#18365)
* Add tests for errors basic auth cases and moves tests to separate test-case.
Also names test cases consistently

* Add additional test helper

Ref 82661b9f69
2019-08-02 20:56:58 +03:00
Oleg Gaidarenko
82661b9f69 Auth: consistently return same basic auth errors (#18310)
* Auth: consistently return same basic auth errors

* Put repeated errors in consts and return only those consts as error strings

* Add tests for errors basic auth cases and moves tests to separate test-case.
  Also names test cases consistently

* Add more error logs and makes their messages consistent

* A bit of code style

* Add additional test helper

* Auth: do not expose even incorrect password

* Auth: address review comments

Use `Debug` for the cases when it's an user error
2019-08-02 11:16:31 +02:00
gotjosh
ed8aeb2999
Auth Proxy: Include additional headers as part of the cache key (#18298)
* Auth Proxy: Include additional headers as part of the cache key

Auth proxy has support to send additional user attributes as part of the
authentication flow. These attributes (e.g. Groups) need to be monitored
as part of the process in case of change.

This commit changes the way we compute the cache key to include all of the
attributes sent as part of the authentication request. That way, if we
change any user attributes we'll upsert the user information.
2019-07-31 11:23:00 +01:00
Oleg Gaidarenko
75fa1f0207 Metrics: use consistent naming for exported variables (#18134)
* Metrics: remove unused metrics

Metric `M_Grafana_Version` is not used anywhere, nor the mentioned
`M_Grafana_Build_Version`. Seems to be an artefact?

* Metrics: make the naming consistent

* Metrics: add comments to exported vars

* Metrics: use proper naming

Fixes #18110
2019-07-16 16:58:46 +02:00
gotjosh
332920954e
SAML: Show SAML login button even if OAuth is disabled (#17993)
* Move the SAML button outside of the oauth div
* Don't attempt to search cookies with an empty name
2019-07-09 10:15:52 +01: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
Sofia Papagiannaki
f3f03ceb6a
Auth Proxy: Respect auto_sign_up setting (#17843)
* Add test for disabled auth proxy auto signup option

* Set correctly auth proxy auto signup
2019-07-01 14:29:41 +03:00
Alexander Zobnin
c2affdee1e
OAuth: return github teams as a part of user info (enable team sync) (#17797)
* OAuth: github team sync POC

* OAuth: minor refactor of github module

* OAuth: able to use team shorthands for github team sync

* support passing a list of groups via auth-proxy header
2019-07-01 12:30:17 +03:00
Sofia Papagiannaki
dc9ec7dc91
Auth: Allow expiration of API keys (#17678)
* Modify backend to allow expiration of API Keys

* Add middleware test for expired api keys

* Modify frontend to enable expiration of API Keys

* Fix frontend tests

* Fix migration and add index for `expires` field

* Add api key tests for database access

* Substitude time.Now() by a mock for test usage

* Front-end modifications

* Change input label to `Time to live`
* Change input behavior to comply with the other similar
* Add tooltip

* Modify AddApiKey api call response

Expiration should be *time.Time instead of string

* Present expiration date in the selected timezone

* Use kbn for transforming intervals to seconds

* Use `assert` library for tests

* Frontend fixes

Add checks for empty/undefined/null values

* Change expires column from datetime to integer

* Restrict api key duration input

It should be interval not number

* AddApiKey must complain if SecondsToLive is negative

* Declare ErrInvalidApiKeyExpiration

* Move configuration to auth section

* Update docs

* Eliminate alias for models in modified files

* Omit expiration from api response if empty

* Eliminate Goconvey from test file

* Fix test

Do not sleep, use mocked timeNow() instead

* Remove index for expires from api_key table

The index should be anyway on both org_id and expires fields.
However this commit eliminates completely the index for now
since not many rows are expected to be in this table.

* Use getTimeZone function

* Minor change in api key listing

The frontend should display a message instead of empty string
if the key does not expire.
2019-06-26 09:47:03 +03:00
Kyle Brandt
bd08d8ce8e
middleware: fix Strict-Transport-Security header (#17644)
fixes #17641
2019-06-18 14:24:23 -04:00
Yann Verry
ed613194ac HTTPServer: Fix X-XSS-Protection header formatting (#17620)
Fixes #17619
2019-06-17 23:46:35 +02:00
Oleg Gaidarenko
1b1d951495 LDAP: refactoring (#17479)
* LDAP: use only one struct

* Use only models.ExternalUserInfo

* Add additional helper method :/

* Move all the helpers to one module

* LDAP: refactoring

* Rename some of the public methods and change their behaviour

* Remove outdated methods

* Simplify logic

* More tests
  There is no and never were tests for settings.go, added tests for helper
  methods (cover is now about 100% for them). Added tests for the main
  LDAP logic, but there is some stuff to add. Dial() is not tested and not
  decoupled. It might be a challenge to do it properly

* Restructure tests:
   * they wouldn't depend on external modules
   * more consistent naming
   * logical division

* More guards for erroneous paths

* Login: make login service an explicit dependency

* LDAP: remove no longer needed test helper fns

* LDAP: remove useless import

* LDAP: Use new interface in multildap module

* LDAP: corrections for the groups of multiple users

* In case there is several users their groups weren't detected correctly

* Simplify helpers module
2019-06-13 16:47:51 +02:00
Kyle Brandt
599514ad68
middleware: add security related HTTP(S) response headers (#17522)
* x_xss_protection
  * strict_transport_security (HSTS)
  * x_content_type_options

these are currently defaulted to false (off) until the next minor release.

fixes #17509
2019-06-12 13:15:50 +02:00
Kyle Brandt
826d33ea37
auth_proxy: non-negative cache TTL (#17495)
fixes setex error with redis on #17377
2019-06-10 15:25:23 +02:00
Marcus Efraimsson
b9181df212
Auth Proxy: Log any error in middleware (#17275)
Fixes so that errors happening in auth proxy middleware is logged.

Ref #17247
2019-05-27 10:38:17 +02:00
Oleg Gaidarenko
9b7f9dd9be
LDAP: consistently name the LDAP entities (#17203) 2019-05-22 15:30:03 +03:00
Mario Trangoni
66ba2aa524 Fix gosimple issues (#17179)
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2019-05-21 07:50:44 +02:00
Oleg Gaidarenko
35f227de11
Feature: LDAP refactoring (#16950)
* incapsulates multipleldap logic under one module

* abstracts users upsert and get logic

* changes some of the text error messages and import sort sequence

* heavily refactors the LDAP module – LDAP module now only deals with LDAP related behaviour

* integrates affected auth_proxy module and their tests

* refactoring of the auth_proxy logic
2019-05-17 14:57:26 +03:00
Oleg Gaidarenko
79ac3fd699
Chore: remove use of == false (#17036)
Interestingly enough, golint or revive doesn't not prohibit
the use that construction :)

Ref #17035
2019-05-14 10:18:28 +03: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
Marcus Efraimsson
1c1427520d
Security: Add new setting allow_embedding (#16853)
When allow_embedding is false (default) the Grafana backend 
will set the http header `X-Frame-Options: deny` in all responses 
to non-static content which will instruct browser to not allow 
Grafana to be embedded in `<frame>`, `<iframe>`, 
`<embed>` or `<object>`.

Closes #14189
2019-05-06 09:56:23 +02:00
Marcus Efraimsson
f778c1d971
Security: Responses from backend should not be cached (#16848)
Currently all API requests set Cache-control: no-cache to avoid browsers 
caching sensitive data. This fixes so that all responses returned from 
backend not are cached using http headers. The exception is the data proxy 
where we don't add these http headers in case datasource backend needs 
to control whether data can be cached or not.

Fixes #16845
2019-05-06 09:22:59 +02:00
Samuel
846b9327a5 LDAP: Added reload endpoint for LDAP config (#15470)
* 4843 - Added reload endpoint for LDAP config

closes #4843

* Refactor to make the reload work after master drifted
2019-05-03 14:53:07 +02:00
Carl Bergquist
9660356638
Auth: Enable retries and transaction for some db calls for auth tokens (#16785)
the WithSession wrapper handles retries and connection
management so the caller dont have to worry about it.
2019-04-30 14:42:01 +02:00
Oleg Gaidarenko
62b85a886e
LDAP Refactoring to support syncronizing more than one user at a time. (#16705)
* Feature: add cron setting for the ldap settings

* Move ldap configuration read to special function

* Introduce cron setting (no docs for it yet, pending approval)

* Chore: duplicate ldap module as a service

* Feature: implement active sync

This is very early preliminary implementation of active sync.
There is only one thing that's going right for this code - it works.

Aside from that, there is no tests, error handling, docs, transactions,
it's very much duplicative and etc.

But this is the overall direction with architecture I'm going for

* Chore: introduce login service

* Chore: gradually switch to ldap service

* Chore: use new approach for auth_proxy

* Chore: use new approach along with refactoring

* Chore: use new ldap interface for auth_proxy

* Chore: improve auth_proxy and subsequently ldap

* Chore: more of the refactoring bits

* Chore: address comments from code review

* Chore: more refactoring stuff

* Chore: make linter happy

* Chore: add cron dep for grafana enterprise

* Chore: initialize config package var

* Chore: disable gosec for now

* Chore: update dependencies

* Chore: remove unused module

* Chore: address review comments

* Chore: make linter happy
2019-04-26 15:47:16 +03:00
Oleg Gaidarenko
db584b3d28
Chore: remove session storage references (#16445)
* Chore: remove session storage references

* Small refactoring of the settings module

* Update docs - remove references for the session storage

* Update config files (sample and default configs)

* Add tests for warning during the config load on defined storage cache

* Remove all references to session storage

* Remove macaron session dependency

* Remove leftovers

* Fix: address review comments

* Fix: remove old deps

* Fix: add skipStaticRootValidation = true to tests

* Fix: improve the docs and warning message

As per discussion in here - https://github.com/grafana/grafana/pull/16445/files#r273026255

* Chore: make linter happy

Fixes #16148
Ref #16114
2019-04-22 18:58:24 +03:00
Oleg Gaidarenko
318182ccc9 Chore: refactor auth proxy (#16504)
* Chore: refactor auth proxy

Introduced the helper struct for auth_proxy middleware.
Added couple unit-tests, but it seems "integration" tests already cover
most of the code paths.

Although it might be good idea to test every bit of it, hm.
Haven't refactored the extraction of the header logic that much

Fixes #16147

* Fix: make linters happy
2019-04-16 14:09:18 +02:00
Oleg Gaidarenko
67cbc7d4cf
Chore: use remote cache instead of session storage (#16114)
Replaces session storage in auth_proxy middleware with remote cache

Fixes #15161
2019-04-08 14:31:46 +03:00
Leonard Gram
6589a4e55f teams: better names for api permissions. 2019-03-19 14:01:20 +01:00
Hugo Häggmark
782b5b6a3a teams: viewers and editors can view teams 2019-03-19 14:01:14 +01:00
Leonard Gram
22e098b830 teams: editors can work with teams. 2019-03-19 13:57:22 +01:00
Marcus Efraimsson
8029e48588
support get user tokens/revoke all user tokens in UserTokenService 2019-03-08 15:15:17 +01:00
Johannes Schill
a81d5486b0 Viewers with viewers_can_edit should be able to access /explore (#15787)
* fix: Viewers with viewers_can_edit should be able to access /explore #15773

* refactoring initial PR a bit to simplify function and reduce duplication
2019-03-05 12:41:01 +01:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
Carl Bergquist
dcec61e1b4
Merge pull request #15378 from grafana/auth_token_quotas
use authTokenService for session quotas restrictions
2019-02-12 15:38:57 +01:00
bergquist
e163aadfe4 use authtoken for session quota restrictions
closes #15360
2019-02-12 15:10:55 +01:00
bergquist
1310d356fc removes unused session code 2019-02-12 12:33:54 +01:00
Marcus Efraimsson
836501186f
fix 2019-02-06 17:30:17 +01:00
Marcus Efraimsson
8678620730
move UserToken and UserTokenService to models package 2019-02-06 16:55:12 +01:00
Marcus Efraimsson
a60124a88c
change UserToken from interface to struct 2019-02-06 16:30:50 +01:00
Marcus Efraimsson
44275d9660
middleware fix 2019-02-06 08:45:01 +01:00
Marcus Efraimsson
871c84d195
changes needed for api/middleware due to configuration settings 2019-02-05 21:14:23 +01:00
Marcus Efraimsson
d53e64a32c
move auth token middleware/hooks to middleware package
fix/adds auth token middleware tests
2019-02-05 00:21:05 +01:00
bergquist
88ca54eba9 renames signout function 2019-01-31 16:26:36 +01:00
bergquist
43ac79685a delete auth token on signout 2019-01-31 16:13:35 +01:00
Mario Trangoni
b7628f2060 pkg/util/{filepath.go,shortid_generator.go}: Fix golint issues
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=golint  ./...
filepath.go:12:5⚠️ error var WalkSkipDir should have name of the form ErrFoo (golint)
shortid_generator.go:11:5⚠️ var validUidPattern should be validUIDPattern (golint)
shortid_generator.go:19:6⚠️ func IsValidShortUid should be IsValidShortUID (golint)
shortid_generator.go:24:6⚠️ func GenerateShortUid should be GenerateShortUID (golint)
2019-01-28 22:37:44 +01:00
bergquist
9ae306e417 use defer to make sure we always release session data 2019-01-24 13:48:36 +01:00
bergquist
f257101c41 removes unused/commented code 2019-01-24 11:26:45 +01:00
bergquist
5998646da5 restrict session usage to auth_proxy 2019-01-23 14:56:48 +01:00
bergquist
c3ff3d644c fixes nil ref in tests 2019-01-22 16:16:32 +01:00
Marcus Efraimsson
59d0c19ba8
passing middleware tests 2019-01-22 13:51:55 +01:00
Marcus Efraimsson
4096449aec
extract auth token interface and remove auth token from context 2019-01-22 12:00:33 +01:00
bergquist
55b3013eb3 moves initWithToken to auth package 2019-01-21 11:37:44 +01:00
Marcus Efraimsson
734a7d38b2
set cookie name from configuration 2019-01-21 11:21:43 +01:00
Marcus Efraimsson
0d1e3759eb
mixor fixes 2019-01-21 10:20:23 +01:00
Marcus Efraimsson
f3125b447b
dead code 2019-01-21 10:20:23 +01:00
bergquist
47a7d93fd9 moves rotation into auth since both happens before c.Next() 2019-01-21 08:59:01 +01:00
bergquist
fd937e3d95 remove maxage from session token 2019-01-17 21:03:27 +01:00
Marcus Efraimsson
81879f0162
fix broken code 2019-01-17 20:29:26 +01:00
Marcus Efraimsson
97c7963f17
fix cannot set cookie when response is written 2019-01-17 20:27:53 +01:00
bergquist
c2accfa4c0 inital code for rotate 2019-01-17 17:11:52 +01:00
bergquist
aba6148c43 login users based on token cookie 2019-01-16 16:44:40 +01:00
Jacob Richard
34d3086ec8 Adding tests for auth proxy CIDR support 2018-12-18 21:16:29 -06:00
Jacob Richard
0b50582b56 Adding CIDR capability to auth_proxy whitelist 2018-12-17 23:43:14 -06:00
Torkel Ödegaard
34c70ca7ce fix for issue with error view in production builds 2018-11-20 13:47:45 +01:00
Marcus Efraimsson
5882e5bb46
Merge pull request #13900 from marefr/ds_cache_refactor
Datasource proxy cache refactor
2018-11-05 11:02:31 +01:00
Torkel Ödegaard
b415d82611 fixed to template PR issues, #13938 2018-11-02 10:49:46 +01:00
Marcus Efraimsson
cfb061ddab
refactor datasource caching 2018-10-30 09:31:56 +01:00
Mario Trangoni
e673337cb9 pkg/middleware/middleware.go: Fix empty branch warning.
See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=megacheck ./...
pkg/middleware/middleware.go:46:3⚠️ empty branch (SA9003) (megacheck)
2018-10-19 19:49:04 +02:00
Torkel Ödegaard
abef94b0da made it possible to have frontend code in symlinked folders that can add routes 2018-10-11 12:36:04 +02:00
Mario Trangoni
dde650905d Fix megacheck issue unused code.
I removed some code, and commented out other one.

See,
$ gometalinter --vendor --disable-all --disable=gotype --enable=megacheck --deadline 6m ./... | grep unused
pkg/api/avatar/avatar.go💯26⚠️ func (*CacheServer).mustInt is unused (U1000) (megacheck)
pkg/api/folder_test.go:136:6⚠️ func callGetFolderByUID is unused (U1000) (megacheck)
pkg/api/folder_test.go:141:6⚠️ func callDeleteFolder is unused (U1000) (megacheck)
pkg/api/live/hub.go:40:15⚠️ func (*hub).removeConnection is unused (U1000) (megacheck)
pkg/components/imguploader/azureblobuploader.go:130:5⚠️ var client is unused (U1000) (megacheck)
pkg/middleware/middleware_test.go:438:28⚠️ func (*scenarioContext).withInvalidApiKey is unused (U1000) (megacheck)
pkg/services/alerting/ticker.go:40:18⚠️ func (*Ticker).updateOffset is unused (U1000) (megacheck)
pkg/services/notifications/notifications_test.go:12:6⚠️ type testTriggeredAlert is unused (U1000) (megacheck)
pkg/services/sqlstore/dashboard_service_integration_test.go:935:6⚠️ type scenarioContext is unused (U1000) (megacheck)
pkg/services/sqlstore/dashboard_service_integration_test.go:939:6⚠️ type scenarioFunc is unused (U1000) (megacheck)
pkg/services/sqlstore/dashboard_service_integration_test.go:941:6⚠️ func dashboardGuardianScenario is unused (U1000) (megacheck)
pkg/services/sqlstore/transactions_test.go:13:6⚠️ type testQuery is unused (U1000) (megacheck)
2018-10-01 18:23:59 +02:00
bergquist
12c9860882 string formating fixes 2018-08-28 22:33:38 +02:00
Marcus Efraimsson
8af5da7383
Revert "auth proxy: use real ip when validating white listed ip's" 2018-06-28 15:43:33 +02:00
Dan Cech
3056d9a80e support passing api token in Basic auth password (#12416) 2018-06-28 03:08:32 -07:00
Marcus Efraimsson
b418e14bd9
make sure to use real ip when validating white listed ip's 2018-06-15 15:29:43 +02:00
Torkel Ödegaard
80d694d205
Backend image rendering as plugin (#11966)
* rendering: headless chrome progress

* renderer: minor change

* grpc: version hell

* updated grpc libs

* wip: minor progess

* rendering: new image rendering plugin is starting to work

* feat: now phantomjs works as well and updated alerting to use new rendering service

* refactor: renamed renderer package and service to rendering to make renderer name less confusing (rendering is internal service that handles the renderer plugin now)

* rendering: now render key is passed and render auth is working in plugin mode

* removed unneeded lines from gitignore

* rendering: now plugin mode supports waiting for all panels to complete rendering

* fix: LastSeenAt fix for render calls, was not set which causes a lot of updates to Last Seen at during rendering, this should fix sqlite db locked issues in seen in previous releases

* change: changed render tz url parameter to use proper timezone name as chrome does not handle UTC offset TZ values

* fix: another update to tz param generation

* renderer: added http mode to renderer service, new ini setting [rendering] server_url
2018-05-24 15:26:27 +02:00
Dan Cech
543c7fe587 support additional fields in authproxy (#11661) 2018-05-07 10:39:16 +02:00
Marcus Efraimsson
de0d409a23
Revert "Opportunities to unindent code (unindent)" 2018-05-02 14:06:46 +02:00
Karsten Weiss
893a91af3a Use opportunities to unindent code (unindent)
This commit fixes the following unindent findings:
pkg/api/common.go:102:2: "if x { if y" should be "if x && y"
pkg/components/dynmap/dynmap.go:642:2: invert condition and early return
pkg/components/dynmap/dynmap.go:681:2: invert condition and early return
pkg/components/simplejson/simplejson.go:171:2: "if x { if y" should be "if x && y"
pkg/middleware/dashboard_redirect.go:42:3: invert condition and early return
pkg/tsdb/mssql/mssql.go:301:3: invert condition and early break
pkg/tsdb/mysql/mysql.go:312:3: invert condition and early break
pkg/tsdb/postgres/postgres.go:292:3: invert condition and early break
pkg/tsdb/sql_engine.go:144:2: invert condition and early return
2018-04-28 10:53:16 +02:00
Karsten Weiss
de8696d5d3 Outdent code after if block that ends with return (golint)
This commit fixes the following golint warnings:
pkg/bus/bus.go:64:9: if block ends with a return statement, so drop this else and outdent its block
pkg/bus/bus.go:84:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:137:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:177:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:183:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:199:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:208:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/components/dynmap/dynmap.go:236:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:242:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:257:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:263:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:278:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:284:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:299:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:331:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:350:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:356:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:366:12: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:390:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:396:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:405:12: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:427:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:433:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:442:12: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:459:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:465:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:474:12: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:491:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:497:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:506:12: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:523:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:529:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:538:12: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:555:9: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:561:10: if block ends with a return statement, so drop this else and outdent its block
pkg/components/dynmap/dynmap.go:570:12: if block ends with a return statement, so drop this else and outdent its block
pkg/login/ldap.go:55:11: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/login/ldap_test.go:372:10: if block ends with a return statement, so drop this else and outdent its block
pkg/middleware/middleware_test.go:213:12: if block ends with a return statement, so drop this else and outdent its block
pkg/plugins/dashboard_importer.go:153:11: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/plugins/dashboards_updater.go:39:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/plugins/dashboards_updater.go:121:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/plugins/plugins.go:210:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/plugins/plugins.go:235:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/eval_context.go:111:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/notifier.go:92:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/notifier.go:98:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/notifier.go:122:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/rule.go:108:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/rule.go:118:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/rule.go:121:11: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/alerting/notifiers/telegram.go:94:10: if block ends with a return statement, so drop this else and outdent its block
pkg/services/sqlstore/annotation.go:34:11: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/sqlstore/annotation.go:99:11: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/sqlstore/dashboard_test.go:107:13: if block ends with a return statement, so drop this else and outdent its block
pkg/services/sqlstore/plugin_setting.go:78:10: if block ends with a return statement, so drop this else and outdent its block
pkg/services/sqlstore/preferences.go:91:10: if block ends with a return statement, so drop this else and outdent its block
pkg/services/sqlstore/user.go:50:10: if block ends with a return statement, so drop this else and outdent its block
pkg/services/sqlstore/migrator/migrator.go:106:11: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/services/sqlstore/migrator/postgres_dialect.go:48:10: if block ends with a return statement, so drop this else and outdent its block
pkg/tsdb/time_range.go:59:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/tsdb/time_range.go:67:9: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
pkg/tsdb/cloudwatch/metric_find_query.go:225:9: if block ends with a return statement, so drop this else and outdent its block
pkg/util/filepath.go:68:11: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
2018-04-27 23:10:43 +02:00
Mario Trangoni
97fd66db2e pkg: fix deadcode issues 2018-04-26 19:24:21 +02:00
Dan Cech
3fedcb1e4b
cleanup, make sure users are always synced with ldap 2018-04-17 17:48:56 -04:00
Dan Cech
52503d9cb5
refactor authproxy & ldap integration, address comments 2018-04-17 14:06:25 -04:00
Dan Cech
d837be91ec
switch to passing ReqContext as a property 2018-04-17 14:06:25 -04:00
Dan Cech
e53315dce8
cleanup 2018-04-17 14:06:25 -04:00
Dan Cech
a1b1d2fe80
switch to Result 2018-04-17 14:06:25 -04:00
Dan Cech
d5dd1c9bca
update auth proxy 2018-04-17 14:06:25 -04:00
Dan Cech
d2eab2ff4c
fix tests 2018-04-17 14:06:25 -04:00
Dan Cech
1c5afa731f
shared library for managing external user accounts 2018-04-17 14:06:25 -04:00
Mario Trangoni
91fb2e07ce pkg: fix codespell issues 2018-04-13 20:31:29 +02:00
Julian Kornberger
391868c5d6 Use net.SplitHostPort to support IPv6
- Add some tests
- Make error message more helpful
2018-03-26 02:48:25 +02:00
Julian Kornberger
0a415c50d0 Make golint happier 2018-03-22 22:38:44 +01:00
Julian Kornberger
7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
Daniel Lee
1cef373d16 Merge remote-tracking branch 'upstream/master' into update-xorm 2018-03-20 19:21:58 +01:00
Daniel Lee
3ca1e06509 session: fork Macaron mysql session middleware
This changes forks the mysql part of the Macaron session middleware.

In the forked mysql file:

- takes in a config setting for SetConnMaxLifetime (this solves wait_timeout
problem if it is set to a shorter interval than wait_timeout)
- removes the panic when an error is returned in the Exist function.
- retries the exist query once
- retries the GC query once
2018-03-16 01:19:28 +01:00
bergquist
6cac7c2de9 renderer: avoid redirect render requests
closes #11180
2018-03-14 15:27:18 +01:00
Dan Cech
bbd6adabbf
move quota to dedicated service 2018-03-07 17:19:35 -05: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
bergquist
0ab0343995 mark redirect_to cookie as http only
closes #10829
2018-02-15 10:56:29 +01:00
bergquist
842f4c1d32 tech: dont print error message on 500 page
closes #10828
2018-02-14 16:39:20 +01:00
Torkel Ödegaard
0e61a670bb fix: error handling now displays page correctly, fixes #10777 2018-02-06 12:28:17 +01:00
Alexander Zobnin
f97be541af redirect "permission denied" requests to "/" (#10773) 2018-02-05 18:17:47 +01:00
Marcus Efraimsson
32054ad9a6 dashboard: fix redirect of legacy dashboard url's
Redirect of /dashboard/db/:slug to /d/:uid/:slug and
/dashboard-solo/db/:slug to /d-solo/:uid/:slug now includes querystring parameters.

Fixes #10752
2018-02-04 17:29:16 +01:00
bergquist
58cfb23625 retry uid generation 2018-01-31 17:29:17 +01:00
Marcus Efraimsson
a99331cdb9 dashboards: redirect from old url used to load dashboard to new url
If legacy backend routes (/dashboard/db/<slug> and /dashboard-solo/db/<slug>)
are requested we try to redirect to new routes with a 301 Moved Permanently
 #7883
2018-01-31 14:06:19 +01:00
SteelPhase
a320a83138 Use strings.TrimPrefix to make sure relative url doesn't start with forward slash
Closes grafana/grafana#10263
2017-12-19 03:01:33 -05:00
Torkel Ödegaard
a8a5f8181b fix: viewers can edit now works correctly 2017-12-15 14:19:49 +01:00
Torkel Ödegaard
0e44fe082b Merge branch 'master' into develop 2017-11-17 15:49:17 +01:00
Daniel Lee
0d85c63fff middleware: recovery handles panics in all handlers
Also, changes the order of the middleware so that recovery is after the
gzip middleware. Otherwise, a 200 OK is returned instead of a 500 error.
2017-11-15 13:57:33 +01:00
Torkel Ödegaard
b44daaabf2 Merge branch 'master' into develop 2017-10-24 09:06:09 +02:00
bergquist
139f077453 prometheus: enable gzip for /metrics endpoint
closes #9464
2017-10-23 09:35:46 +02:00
Torkel Ödegaard
18337f610d Merge branch 'master' into develop 2017-09-22 08:42:07 +02:00
Torkel Ödegaard
41e01184aa Merge branch 'master' into develop 2017-09-18 12:32:29 +02:00
bergquist
861843f4ca mark >=400 responses as error 2017-09-18 11:08:58 +02:00
bergquist
ec29b469e4 adds custom tags from settings 2017-09-18 11:08:58 +02:00
bergquist
e3211f6e48 use route as span name 2017-09-18 11:08:58 +02:00
bergquist
d55b49b7b7 attach context with span to *http.Request 2017-09-18 11:08:58 +02:00
bergquist
89c86c7a22 use opentracing ext package when possible 2017-09-18 11:08:58 +02:00
bergquist
2e350bbb8e adds basic traces using open traces 2017-09-18 11:08:58 +02:00
bergquist
491e6897e7 metrics: set summary unit
we have to use milleseconds since graphite
doesnt support float64
2017-09-14 19:28:54 +02:00
bergquist
4bc6ecb241 adds metric middlware to route register 2017-09-14 14:26:32 +02:00
bergquist
6d22a67a30 return /metrics before session middleware 2017-09-14 14:26:32 +02:00
bergquist
2de94d6548 convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
Torkel Ödegaard
a38ded9e7e Merge branch 'master' into develop-newgrid-row-design2 2017-09-07 15:05:41 +02:00
wangguoliang
652fce7e76 Optimize some wrong usage and spelling
Signed-off-by: wgliang <liangcszzu@163.com>
2017-09-07 17:50:11 +08:00
Torkel Ödegaard
d25dae9b58 Merge branch 'master' into develop-newgrid 2017-08-09 14:07:06 +02:00
Torkel Ödegaard
668cb3c1ef Merge branch 'v4.4.x' 2017-08-09 10:37:06 +02:00
Torkel Ödegaard
e8a20643d6 feat: store last seen date for users and present in stats and user lists, closes #9007 2017-08-09 10:36:41 +02:00
Daniel Lee
649fe7e462 Merge branch 'v4.4.x' 2017-08-07 10:47:23 +02:00
Daniel Lee
aa889e59a1 tests: fix after interface change 2017-08-07 10:20:46 +02:00
Daniel Lee
1e5778174c login: regenerates session id on login 2017-08-07 10:00:29 +02:00
Torkel Ödegaard
9fb60c2fc8 Merge branch 'develop' into panel-title-menu-ux 2017-08-02 09:56:08 +02:00
Daniel Lee
e6f9546a7c api: add no cache headers for IE11
Adds pragma and expires headers for API calls so that IE11 does not
cache GET calls. Ref #5356
2017-07-06 18:56:22 +02:00
Daniel Lee
74093c700f api: adds no-cache header for GET requests
Fixes #5356. Internet Explorer aggressively caches GET requests which
means that all API calls fetching data are cached. This fix adds a
Cache-Control header with the value no-cache to all GET requests to
the API.
2017-07-04 21:26:05 +02:00
Daniel Lee
f68d2816ab dashfolders: security for png rendering 2017-06-22 01:23:48 +02:00
Dhia
ac28c4b233 add Referer header to logs. This is useful to link datasource requests to dashboard that originated it (#8399) 2017-05-24 13:47:29 +02:00
Tiantian Gao
b2c14b858e Fix http logging time_ms unit is wrong (#8342)
In fact, the unit of `time_ms` int http logging is not "ms", this patch fix it.
2017-05-11 08:53:40 +02:00
Dan Cech
f490c5f12c use X-Grafana-Org-Id header to ensure backend uses correct org (#8122) 2017-04-14 15:47:39 +02:00
Torkel Ödegaard
b3df1aa9bd org: fixed issue with orgId query param redirect handling when grafana is under subpath and reverse proxy, fixes #8089 2017-04-12 07:11:08 +02:00
Daniel Lee
f45d637025 auth: fix warning in test 2017-03-23 15:52:08 +01:00
Daniel Lee
beb85f413a oauth: delete session key instead of set to empty
Adds the Delete function to the Session wrapper so that the Macaron
function for deleting keys from a Session can be used.

https://go-macaron.com/docs/middlewares/session#implement-provider-interface
2017-03-23 15:26:13 +01:00
Torkel Ödegaard
c3202d3f99 sessions: start session gc at startup but only after between 10 - 180 seconds 2017-03-06 12:23:28 +01:00
bergquist
072c1559ba middlware: prevent orgredirect to open body stream
the org redirecter opened the body stream by misstake. Causing
downstream code to start reading from an empty stream and raise errors.
2017-02-20 11:38:29 +01:00
bergquist
6115941df0 middleware: rename org-id -> orgId 2017-02-17 15:18:40 +01:00
bergquist
5174d050f2 middlware: change org when url contains orgid
closes #6948
ref #1613
2017-02-17 15:02:14 +01:00
Torkel Ödegaard
6e27db148c Merge branch 'authproxy_ldap' of https://github.com/seuf/grafana into seuf-authproxy_ldap 2016-12-14 21:45:15 +01:00
huydx
adb441e5c8 (format) run go fmt in pkg 2016-12-14 12:17:38 +09:00
Utkarsh Bhatnagar
bd20dc6c4c Fixed failing tests (#6941) 2016-12-13 10:00:33 +01:00
Utkarsh Bhatnagar
5777f65d05 Basic Auth now supports LDAP username and password (#6940) 2016-12-13 09:15:52 +01:00
Seuf
12a82bc0d4 Auth Proxy improvements - adds the option to use ldap groups for authorization in combination with an auth proxy - adds an option to limit where auth proxy requests come from by configure a list of ip's - fixes a security issue, session could be reused 2016-12-12 09:53:02 +01:00
Seuf
ae27c17c68 Auth Proxy improvements
- adds the option to use ldap groups for authorization in combination with an auth proxy
- adds an option to limit where auth proxy requests come from by configure a list of ip's
- fixes a security issue, session could be reused
2016-12-12 09:43:17 +01:00
Torkel Ödegaard
05772b30d7 feat(ux): completed work on getting started panel, #6466 2016-12-08 10:25:05 +01:00
Torkel Ödegaard
cc46b81961 fix(rendering): fixed server side rendering issue when sertting enforce_domain to true, fixes #6769 2016-12-05 11:20:01 +01:00
Torkel Ödegaard
18e965c775 fix(error handling): fixed server side error handling page 2016-11-16 17:41:44 +01:00
Eric Perrino
81443bf8b4 Added a state parameter for all OAuth requests 2016-10-08 01:22:32 -05:00
Torkel Ödegaard
175c651e65 fix(server side rendering): Fixed issues with server side rendering for alerting & for auth proxy scenarios, fixes #6115, fixes #5906 2016-09-23 12:29:53 +02:00
bergquist
6c5860d3e8 feat(metrics): measure proxy requests 2016-09-12 13:29:31 +02:00
bergquist
eb673fd16d fix(middleware): typo 2016-09-12 10:11:55 +02:00
bergquist
4edb31723c fix(metrics): ignore datasource proxy requests 2016-09-09 13:53:50 +02:00
bergquist
e7b56c6389 tech(metrics): move all request counters into one middleware 2016-09-09 13:28:19 +02:00
bergquist
16fa631ea0 tech(tests): remove unused code that breaks gorename 2016-06-25 16:34:42 +02:00
Torkel Ödegaard
bf1ea560e9 feat(logging): error logging improvements 2016-06-11 12:16:33 +02:00
Torkel Ödegaard
086b59483e feat(loggin): disable logging by default so unit tests are not full of logging 2016-06-11 11:38:25 +02:00
Torkel Ödegaard
65aad44464 feat(logging): added uname to context logger 2016-06-07 12:20:46 +02:00
Torkel Ödegaard
a02cf5beb7 feat(logging): added loging filters 2016-06-07 12:11:41 +02:00
Torkel Ödegaard
3dc7706c45 feat(loggin): improved http request panic handling 2016-06-07 10:05:10 +02:00
Torkel Ödegaard
9741af2031 feat(logging): progress on new logging #4590 2016-06-07 09:29:47 +02:00
Torkel Ödegaard
22778e6efd feat(logging): a lot of progress on moving to new logging lib, #4590 2016-06-06 23:06:44 +02:00
Torkel Ödegaard
064e474b0a Merge branch 'metrics_reporting' 2016-06-03 18:06:41 +02:00
Torkel Ödegaard
eee49a4995 feat(instrumentation): added meter, histogram and new timer, timer now send p25, p75, p90, p99 percentiles in 1000 sample exp decaying sample 2016-06-03 12:50:51 +02:00
Torkel Ödegaard
3065d10931 feat(timing): timing is now working with graphite and influxdb 2016-06-03 09:17:36 +02:00
Torkel Ödegaard
1283461b89 fix(gzip): add plugin proxy to gzip exclusion, fixes #5237 2016-06-02 09:56:53 +02:00
Dmitry Smirnov
3fd6ae597d minor spelling corrections
Signed-off-by: Dmitry Smirnov <onlyjob@member.fsf.org>
2016-02-16 12:12:04 +11:00
Torkel Ödegaard
6da3af5e89 Merge branch 'new_macaron' 2016-01-13 15:48:49 +01:00
Torkel Ödegaard
2cf0dc2cb2 fix(gofmt): fixed non formated go file 2016-01-13 15:43:32 +01:00
Torkel Ödegaard
bdb67d4909 fix(build): fixed dependency and build issue 2016-01-13 15:38:54 +01:00
bergquist
4fe72ebf69 feat(macaron): upgrades macaron version 2016-01-13 15:11:23 +01:00
Torkel Ödegaard
ad94f99d57 refactor(apps): more WIP work on apps 2015-12-22 11:37:44 +01:00
Torkel Ödegaard
eacc46da6d feat(plugins): WIP on new apps concept 2015-12-21 23:09:27 +01:00
Carl Bergquist
fabaf5cc04 Merge pull request #3575 from piotr1212/no_username_in_render_logging
Fix empty username in http log for /render calls
2015-12-21 13:31:10 +01:00
Carl Bergquist
333f9101a0 Merge pull request #3458 from improbable-io/use-memcache-for-session
Add memcache as session provider
2015-12-17 15:56:15 +01:00
Piotr Popieluch
e29e3416db router logger did not show username in /render calls because cookies are
cleared in these call. Not just get username before the call is
executed. see #3405 for more info.
2015-12-17 14:28:11 +01:00
Daniel Low
d7f3869959 gofmt 2015-12-08 14:59:54 +00:00
Daniel Low
ed16914715 Add memcache as session provider 2015-12-08 13:35:09 +00:00
Piotr Popieluch
207c1a20ee router logger, log username taken from cookie 2015-12-03 11:05:50 +01:00
Piotr Popieluch
579bc1c2c8 Add more info in route logging
- Add remote address
 - Add method
 - Add protocol
 - Add response size
 - Use consistent unit for response time (us)
2015-12-03 09:28:42 +01:00
Torkel Ödegaard
e873574e8c fix(logging): fixed so that router_logging = true actually logs all http requests, fixes #2902 2015-10-10 17:55:15 -04:00
Torkel Ödegaard
9fc91b7aa1 fixed gofmt issue 2015-10-08 17:30:13 +02:00
Torkel Ödegaard
5e949b0564 fix(quota): fixed failing quota unit tests 2015-09-18 08:36:58 +02:00
woodsaj
1ad10914ce add quota middleware unittests 2015-09-15 18:19:47 +08:00
woodsaj
6488324cf1 enhance quota support.
now includes:
- perOrg (users, dashboards, datasources, api_keys)
- perUser (orgs)
- global (users, orgs, dashboards, datasources, api_keys, sessions)
2015-09-11 23:17:10 +08:00
woodsaj
852f9bd277 refactor quota settings 2015-09-11 01:47:33 +08:00
woodsaj
76e9ebde36 always return after errors. 2015-09-11 01:03:58 +08:00
woodsaj
0688050552 add quota middleware to enforce quotas. issue #321
Conflicts:
	pkg/api/api.go
2015-09-11 01:03:47 +08:00
Torkel Ödegaard
fdcb4473af fix(api auth): return 401 for authentication errors and 403 for access denied errors, fixes #2693 2015-09-08 10:46:31 +02:00
Torkel Ödegaard
7072af7c14 fix(auth proxy): Fix for server side rendering of panel when using auth proxy, fixes #2568 2015-08-21 07:49:49 +02:00
Torkel Ödegaard
ae0f8c77d1 Auth: You can now authenicate against api with username / password using basic auth, Closes #2218 2015-06-30 09:37:52 +02:00
Donn Pebe
df33cbc8c5 Fix wrong metrics counter 2015-06-30 12:52:55 +07:00
Torkel Ödegaard
66e60357dc Set email when creating user from auth_proxy header, Fixes #2156 2015-06-13 20:14:44 +02:00
Torkel Ödegaard
34539c0c13 Enforce domain, host header validation against domain setting, Refactoring of PR #1866, Closes #1732 2015-05-05 11:21:06 +02:00
Torkel Ödegaard
1f2cba81eb Merge branch 'enforce-domain' of https://github.com/gummiboll/grafana 2015-05-05 11:15:09 +02:00
Torkel Ödegaard
38fc85d619 Final tweaks to auth proxy feature 2015-05-02 12:30:53 +02:00
Torkel Ödegaard
be589d81c7 Auth: Support for user authentication via reverse proxy header (like X-Authenticated-User, or X-WEBAUTH-USER), Closes #1921 2015-05-02 12:06:58 +02:00
Torkel Ödegaard
ba883d25fe More middleware unit tests cover all current auth mechanisms 2015-05-02 09:24:56 +02:00
Torkel Ödegaard
f416e2d1ac More middleware unit test, starting to look really good 2015-05-01 22:26:16 +02:00
Torkel Ödegaard
cb8110cd48 Refactoring, worked on middleware unit tests, and began thinking about api unit tests, #1921 2015-05-01 16:23:36 +02:00
Torkel Ödegaard
d1e9b6d6ae Began work on auth_proxy feature (#1932), and began work on testing http api, and auth middleware 2015-05-01 11:55:59 +02:00
Emil Thelin
2d7c7871b0 Fixes broken test 2015-04-23 20:56:31 +02:00
Emil Thelin
9fd3ef2687 Enforce domain 2015-04-23 20:38:00 +02:00
Torkel Ödegaard
059db533d5 HTTP API: grafana /render calls nows with api keys, Fixes #1649 2015-04-08 08:59:12 +02:00
Torkel Ödegaard
c07d48d930 A big refactoring for how sessions are handled, Api calls that authenticate with api key will no longer create a new session 2015-04-07 19:21:14 +02:00
Torkel Ödegaard
646298f5c5 Handle errors when loading dashboard with template variables that query data sources that cannot be found 2015-04-07 13:48:26 +02:00
Torkel Ödegaard
1f330d7753 Basic auth: Fixed issue when using basic auth proxy infront of Grafana, Fixes #1673 2015-04-01 15:23:26 +02:00
Torkel Ödegaard
c3fa68ade8 Data source proxy: Fixed issue with Gzip enabled and data source proxy, Fixes #1675 2015-04-01 09:00:17 +02:00
Torkel Ödegaard
b83367063e Small improvement to dashboard loading error handling 2015-03-31 14:03:01 +02:00
Torkel Ödegaard
d987532262 Added server metrics 2015-03-22 15:14:00 -04:00
Anthony Woods
7010df0fe8 fixes #1619 Secure PhantomJS Png rendering
removes auth hack to allow phantomjs to query pages as a user
without auth.  Instead we pass phantomjs the session cookie,
which it then includes in the request.
2015-03-21 07:14:13 +08:00
Jason Wilder
d3d896dccd Log more descriptive error when anonymous org is not found
Was logging:

  [middleware.go:78 func·004()] [E] Anonymous access organization error%!(EXTRA <nil>)
2015-03-12 11:49:05 -06:00
Torkel Ödegaard
477e035f2e Fixed anonymous access mode, Closes #1586 2015-03-11 17:34:11 +01:00
Torkel Ödegaard
c75aa23092 New implementation for API Keys that only stores hashed api keys, and the client key is base64 decoded json web token with the unhashed key, Closes #1440 2015-02-26 17:23:28 +01:00
Torkel Ödegaard
26e4809e2e Big Backend Refatoring: Renamed Account -> Org 2015-02-23 20:07:49 +01:00
Torkel Ödegaard
e3764ad951 Fixed failing dashboard sql test 2015-02-05 15:53:15 +01:00
Torkel Ödegaard
e5fbbe96fd fixed error handling, and error logging for panel rendering 2015-02-05 12:23:24 +01:00
Torkel Ödegaard
10820f31c2 Changed go package path 2015-02-05 10:37:13 +01:00
Torkel Ödegaard
04d03f73b3 Added disable user sign up feature 2015-01-29 15:46:54 +01:00
Torkel Ödegaard
1d6413bfae More work on backend for user favorites 2015-01-29 12:10:34 +01:00
Torkel Ödegaard
1cff564483 Fontend handling of account role to hide user actions and links that the user does not have access to 2015-01-28 11:33:50 +01:00
Torkel Ödegaard
a5e450a0dd Worked on anonymous access 2015-01-27 15:45:27 +01:00
Torkel Ödegaard
257519490a Worked on login remember cookie, and redirect after login 2015-01-27 12:05:23 +01:00
Torkel Ödegaard
951ce0a102 API token -> API key rename 2015-01-27 08:26:11 +01:00
Torkel Ödegaard
90925273a0 User / Account model split, User and account now seperate entities, collaborators are now AccountUsers 2015-01-19 18:01:04 +01:00
Torkel Ödegaard
c970e82758 Small update to update account command 2015-01-17 08:20:25 +01:00
Torkel Ödegaard
1532eb4278 Fixed png rendering 2015-01-16 17:00:31 +01:00
Torkel Ödegaard
ed879df1f4 Corrected spelling of SignedInUser (was SignInUser) 2015-01-16 16:17:35 +01:00
Torkel Ödegaard
2b05dac071 Api Key role is now correcty added do middleware context 2015-01-16 16:15:35 +01:00