Commit Graph

222 Commits

Author SHA1 Message Date
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