Commit Graph

54 Commits

Author SHA1 Message Date
Torkel Ödegaard
fa7d7ed5df
Initial Baby Step to refactoring settings from global vars to instance (#11777)
* wip: start on refactoring settings

* settings: progress on settings refactor

* refactor: progress on settings refactoring

* fix: fixed failing test

* settings: moved smtp settings from global to instance
2018-04-30 16:21:04 +02:00
bergquist
c22495b6f8 Merge branch 'master' into external-auth
* master:
  changelog: adds note about closing #11613 and #11602
  fix: sign in link should have target self to trigger full page reload, fixes #11626
  codespell: exclude by words instead of files
  Use sort.Strings() (gosimple)
  Remove unused return value assignment (gosimple)
  Remove unnecessary fmt.Sprintf() calls (gosimple)
  Merge variable declaration with assignment (gosimple)
  Use fmt.Errorf() (gosimple)
  Simplify make() (gosimple)
  Use raw strings to avoid double escapes (gosimple)
  Simplify if expression (gosimple)
  Simplify comparison to bool constant (gosimple)
  Simplify error returns (gosimple)
  Remove redundant break statements (gosimple)
2018-04-18 09:34:45 +02:00
Dan Cech
1c5afa731f
shared library for managing external user accounts 2018-04-17 14:06:25 -04:00
Karsten Weiss
f61e69ce75 Simplify comparison to bool constant (gosimple)
This fixes:
build.go:553:6: should omit comparison to bool constant, can be simplified to !strings.Contains(path, ".sha256") (S1002)
pkg/cmd/grafana-cli/commands/ls_command.go:27:5: should omit comparison to bool constant, can be simplified to !pluginDirInfo.IsDir() (S1002)
pkg/components/dynmap/dynmap_test.go:24:5: should omit comparison to bool constant, can be simplified to !value (S1002)
pkg/components/dynmap/dynmap_test.go:122:14: should omit comparison to bool constant, can be simplified to b (S1002)
pkg/components/dynmap/dynmap_test.go:125:14: should omit comparison to bool constant, can be simplified to !b (S1002)
pkg/components/dynmap/dynmap_test.go:128:14: should omit comparison to bool constant, can be simplified to !b (S1002)
pkg/models/org_user.go:51:5: should omit comparison to bool constant, can be simplified to !(*r).IsValid() (S1002)
pkg/plugins/datasource/wrapper/datasource_plugin_wrapper_test.go:77:12: should omit comparison to bool constant, can be simplified to !haveBool (S1002)
pkg/services/alerting/conditions/evaluator.go:23:9: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/evaluator.go:48:5: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/evaluator.go:91:5: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/query.go:56:6: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/extractor.go:107:20: should omit comparison to bool constant, can be simplified to !enabled.MustBool() (S1002)
pkg/services/alerting/notifiers/telegram.go:222:41: should omit comparison to bool constant, can be simplified to this.UploadImage (S1002)
pkg/services/sqlstore/apikey.go:58:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/apikey.go:72:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:66:33: should omit comparison to bool constant, can be simplified to !cmd.Overwrite (S1002)
pkg/services/sqlstore/dashboard.go:175:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:311:13: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:444:12: should omit comparison to bool constant, can be simplified to !exists (S1002)
pkg/services/sqlstore/dashboard.go:472:12: should omit comparison to bool constant, can be simplified to !exists (S1002)
pkg/services/sqlstore/dashboard.go:554:32: should omit comparison to bool constant, can be simplified to !cmd.Overwrite (S1002)
pkg/services/sqlstore/dashboard_snapshot.go:83:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/plugin_setting.go:39:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:34:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:111:6: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:136:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:213:6: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/temp_user.go:129:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:157:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:182:5: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:191:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:212:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:307:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/social/generic_oauth.go:185:5: should omit comparison to bool constant, can be simplified to !s.extractToken(&data, token) (S1002)
pkg/tsdb/mssql/mssql.go:148:39: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mssql/mssql.go:212:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/mssql/mssql.go:247:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mssql/mssql.go:274:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mssql/mssql.go:282:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mysql/mysql.go:221:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/mysql/mysql.go:256:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mysql/mysql.go:283:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mysql/mysql.go:291:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/postgres/postgres.go:134:39: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/postgres/postgres.go:201:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/postgres/postgres.go:236:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/postgres/postgres.go:263:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/postgres/postgres.go:271:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
2018-04-16 21:04:57 +02:00
Dan Cech
9d005c50a2
only use jwt token if it contains an email address 2018-03-06 14:21:36 -05:00
Laurent Godet
59704ee939 Fix Github OAuth not working with private Organizations (#11028)
* Fix Github OAuth not working with private organizations

* Update documentation
2018-02-28 13:08:15 +01:00
Torkel Ödegaard
69ccbffaed fix: fixed github oauth login with allowed orgs filter, fixes #10964, reverts #10851 2018-02-20 11:30:18 +01:00
Andrey Inishev
1b795c0ced Fix #10823 (#10851)
* Fix of #10823

* Typo fix

* Revert Gopkg.lock
2018-02-12 09:24:01 +01:00
Torkel Ödegaard
dbfaf5dac8 refactor: minor refactoring of PR #10560 2018-01-23 13:03:44 +01:00
Dan Cech
a09044a45a
go fmt 2018-01-18 19:17:05 -05:00
Dan Cech
04e17c145f
support for decoding JWT id tokens 2018-01-18 18:25:58 -05:00
Dan Cech
5bb22b836d Generic Oauth Support for ADFS (#9242)
* check upn field if email address isn't present, support for adfs

* correctly set login to the user's email address if not specified by the oauth server

* break up GenericOAuth.UserInfo into helper functions
2018-01-18 17:24:04 +01:00
bergquist
5eb36e65f2 use context over golang.org/x/net/context 2018-01-16 12:32:58 +01:00
Adilet Maratov
50daf7463d Solves problem with Github authentication restriction by organization membership when the organization's access policy is set to "Access restricted". "Access restricted" policy should not stop user to authenticate.
How it is solved:
* Take organizations_url field data from user basic data response
* Make another request to get all organization the user is a member of (public membership)
* Authenticate user if appropriate organization found in that list
2017-12-07 16:13:49 +06:00
Matt Bostock
16c5d0e4b7 Always verify TLS unless explicitly told otherwise
TLS was not being verified in a number of places:

- connections to grafana.com

- connections to OAuth providers when TLS client authentication was
  enabled

- connections to self-hosted Grafana installations when using the CLI
  tool

TLS should always be verified unless the user explicitly enables an
option to skip verification.

Removes some instances where `InsecureSkipVerify` is explicitly set to
`false`, the default, to help avoid confusion and make it more difficult
to regress on this fix by accident.

Adds a `--insecure` flag to `grafana-cli` to skip TLS verification.

Adds a `tls_skip_verify_insecure` setting for OAuth.

Adds a `app_tls_skip_verify_insecure` setting under a new `[plugins]`
section.

I'm not super happy with the way the global setting is used by
`pkg/api/app_routes.go` but that seems to be the existing pattern used.
2017-10-06 17:09:27 +01:00
Dave Hall
0c70d271dc Support large github organisations (#8846)
* Add new HttpGetResponse struct type
* Modify HttpGet() return to use HttpGetResponse
* Look up _all_ the teams the user is a member of
2017-07-31 12:13:29 +02:00
Dan Cech
8422697199 centralize oauth http calls, validate response status (#8470) 2017-05-26 14:35:32 +02:00
Torkel Ödegaard
c34db77f04 grafana_com: changed name of oauth grafana_net integration (old settings names still work), and updated login button look, closes #8415 2017-05-22 14:56:50 +02:00
Dan Cech
665cf55e6e make generic oauth provider flexible enough to handle bitbucket's oauth implementation (#8248) 2017-05-02 14:37:56 +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
Alexander Menzhinsky
30c334a2b8
Add common type for oauth authorization errors 2017-02-01 16:42:59 +03:00
huydx
adb441e5c8 (format) run go fmt in pkg 2016-12-14 12:17:38 +09:00
Eric Uldall
658fc1a67a added hosted domain suppport to google oauth login (#6372) 2016-10-28 12:00:47 +02:00
Eric Uldall
9468ddeed5 Issues/6317 empty google login (#6318)
* added Login property to google_oauth model

* fixed spacing

* fixed google_oauth syntax error, missing comma before newline

* set noexpandtab for commit
2016-10-19 07:43:32 +02:00
Dan Cech
6b16fcea52 Oauth2 Updates (#6226)
* break out go and js build commands

* support oauth providers that return errors via redirect

* remove extra call to get grafana.net org membership

* removed GitHub specifics from generic OAuth

* readded ability to name generic source

* revert to a backward-compatible state, refactor and clean up

* streamline oauth user creation, make generic oauth support more generic
2016-10-11 08:51:44 +02:00
Torkel Ödegaard
e5fc4332cd feat(oauth): refactoring PR #6077 2016-09-28 15:10:50 +02:00
Dan Cech
630a8ed8aa support setting default org role when adding user via grafana.net auth 2016-09-20 12:36:36 -04:00
Dan Cech
fc17ed351c support logging in with grafana.net credentials 2016-09-19 16:48:07 -04:00
bergquist
53dddf1a8f fix(oauth): remove github refs from generic auth 2016-09-07 10:55:46 +02:00
bergquist
3b6820ef03 feat(oauth): create struct for generic oauth and add config values 2016-09-07 10:34:56 +02:00
Kevin Fitzpatrick
f2baa5b210 Make Generic OAuth Configs ENV VARS-friendly
Use underscores instead of dashes.
2016-06-30 15:07:55 -07:00
Kevin Fitzpatrick
b4646b6c3a Allow users to use a generic oauth that conforms to the github style.
Enables users to set their own link text.
2016-06-30 15:07:55 -07:00
Don Thapa
b345c7cf46 gofmt happiness 2015-11-07 11:32:06 -06:00
Don
e16bbc660d use [auth.github] -> api_url property; supports git enterprise 2015-11-07 00:06:15 -06:00
Andrea Bernardo Ciddio
cf147cdeaf GitHub users without a public email should be authenticated using their primary private email address 2015-05-28 16:47:20 +01:00
Indrek Juhkam
b55d9350e7 Add github organizations support 2015-05-23 17:06:51 +03:00
Torkel Ödegaard
884dc53f8a smalĺ refactorings 2015-04-29 09:49:33 +02:00
Garrett Bjerkhoel
eb37fc089b Check for active team membership when fetching s.UserInfo 2015-04-28 20:22:21 -07:00
Garrett Bjerkhoel
979d0ca70f Add new error type for team membership permissions 2015-04-28 20:21:44 -07:00
Garrett Bjerkhoel
7ea579bb71 Add team_ids configuration option 2015-04-28 20:19:48 -07:00
Jason Harvey
ddaac50a25 Add allow_sign_up override for auth.google/github. 2015-04-16 13:43:18 -08:00
William Wei
b7c0d99cdf get google api url from config file
instead of using https://www.googleapis.com/oauth2/v1/userinfo in
code.
2015-04-15 18:11:54 +08:00
Torkel Ödegaard
e9afd30b47 Updated changelog with, Github OAuth: Now works with Github for Enterprise, thanks @williamjoy 2015-04-15 10:31:56 +02:00
William Wei
4fd2622e55 grafana/grafana#1781 add oauth api url as config
read github api from config file instead of using public github:
http://api.github.com/user

this would be useful when you are using github enterprise edition
2015-04-15 14:18:10 +08:00
William Wei
d048e39cde grafana/grafana#1781 add oauth api url as config 2015-04-15 14:03:28 +08:00
Torkel Ödegaard
eb575685aa OAuth: Specify allowed email address domains for google or and github oauth logins, Closes #1660 2015-04-06 14:16:22 +02:00
Torkel Ödegaard
b8c378f2f0 Updated golang/x/oauth2 dependency, #1710 2015-04-04 09:50:25 +02:00
Torkel Ödegaard
10820f31c2 Changed go package path 2015-02-05 10:37:13 +01:00
Torkel Ödegaard
95305e7e11 Changed from goconfig to its new counter part go-ini 2015-01-27 10:09:54 +01:00
Torkel Ödegaard
35326e1d92 Worked a little on anonymous access, needs more work 2015-01-07 16:37:24 +01:00