Commit Graph

72 Commits

Author SHA1 Message Date
Martin Reinhardt
7a3d1c0e4b OAuth: Generic OAuth role mapping support (#17149)
Adds support for Generic OAuth role mapping. A new 
configuration setting for generic oauth is added named 
role_attribute_path which accepts a JMESPath expression.
Only Grafana roles named Viewer, Editor or Admin are
accepted.

Closes #9766
2019-11-05 21:56:42 +01:00
Arve Knudsen
0a2d5e16dd pkg/api: Check errors (#19657)
* pkg/api: Check errors
* pkg/api: Remove unused function HashEmail
2019-10-08 18:57:53 +02:00
Sofia Papagiannaki
269c1fb107 Do not set SameSite for OAuth cookie if cookie_samesite is None (#18392) 2019-08-06 09:50:20 +03:00
Sofia Papagiannaki
69b7b8bb46 Fix OAuth error due to SameSite cookie policy (#18332)
The `oauth_state` cookie used to be created with the SameSite value set
according to the `cookie_samesite` configuration.
However, due to a Safari bug SameSite=None or SameSite=invalid are treated
as Strict which results in "missing saved state" OAuth login failures
because the cookie is not sent with the redirect requests to the OAuth
provider.
This commit always creates the `oauth_state` cookie with SameSite=Lax
to compensate for this.
2019-08-01 15:47:04 +02:00
Oleg Gaidarenko
d16fd58bdb Auth: do not expose disabled user disabled status (#18229)
Fixes #17947
2019-07-23 13:12:55 +03: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
Alexander Zobnin
48d5a1bcd3 OAuth: deny login for disabled users (#17957) 2019-07-05 11:35:04 +02: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
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
Sean Lafferty
8d19ca005f Merge branch 'master' into 12556-oauth-pass-thru 2019-03-13 14:25:43 -04:00
bergquist
60fef31748 moves social package to /login
ref #14679
2019-02-25 15:30:40 +01:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
Marcus Efraimsson
871c84d195 changes needed for api/middleware due to configuration settings 2019-02-05 21:14:23 +01:00
Sean Lafferty
5a59cdf0ef Add oauth pass-thru option for datasources 2019-02-01 19:40:57 -05:00
bergquist
d6edaa1328 moves cookie https setting to [security] 2019-01-24 19:04:58 +01:00
bergquist
4626f083bb store oauth login error messages in an encrypted cookie 2019-01-23 17:01:09 +01:00
bergquist
12f8338977 stores hashed state code in cookie 2019-01-22 15:22:24 +01:00
Marcus Efraimsson
8764fb5aa6 inject login/logout hooks 2019-01-15 15:16:20 +01:00
bergquist
d7b5fb4604 go fmt fixes 2018-05-28 20:48:01 +02:00
iyeonok
bafe25fbd9 configure proxy environments for Transport property
related issue: https://github.com/grafana/grafana/issues/9703
2018-05-28 20:48:01 +02:00
Dan Cech
d837be91ec switch to passing ReqContext as a property 2018-04-17 14:06:25 -04:00
Dan Cech
a1b1d2fe80 switch to Result 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
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
Torkel Ödegaard
0e61a670bb fix: error handling now displays page correctly, fixes #10777 2018-02-06 12:28:17 +01:00
Torkel Ödegaard
dbfaf5dac8 refactor: minor refactoring of PR #10560 2018-01-23 13:03:44 +01:00
Dan Cech
04e17c145f support for decoding JWT id tokens 2018-01-18 18:25:58 -05:00
bergquist
5eb36e65f2 use context over golang.org/x/net/context 2018-01-16 12:32:58 +01:00
m-pavel
dff66559e4 Use URLEncoding instead of StdEncoding to be sure state value will be corectly decoded (#10512) 2018-01-15 08:49:30 +01:00
bergquist
88f55b01d8 oauth: raise error if session state is missing
ref #9476
2017-10-12 15:25:27 +02:00
bergquist
0848ba2e9c oauth: provide more logging for failed oauth requests 2017-10-12 15:25:27 +02:00
Matt Bostock
83f1ae4e3e OAuth: Rename sslcli
Rename `sslcli` to the more descriptive `oauthClient`.
2017-10-06 17:10:03 +01:00
Matt Bostock
ccf093da81 OAuth: Separate TLS client auth and CA config
It should be specify to either use TLS client authentication or use a
user-supplied CA; previously you had to enable client authentication to
use a custom CA.
2017-10-06 17:10:03 +01:00
Matt Bostock
f2f8ca52d9 OAuth: Check both TLS client cert and key
If either is set, try to use them.

This should help avoid a situation where someone has half-configured TLS
client authentication and it doesn't work without raising an obvious
error.
2017-10-06 17:10:03 +01: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
bergquist
2de94d6548 convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
Eirik Nygaard
1efdd92ae8 Update oauth2 lib (#8524)
* Update to latest oauth2 library using govendor

* Follow API changes
2017-06-05 10:09:27 +02:00
Dan Cech
8422697199 centralize oauth http calls, validate response status (#8470) 2017-05-26 14:35:32 +02:00
Daniel Lee
79cef75fed Merge pull request #7426 from Altoros/altoros/authorization-errors
Add common type for oauth authorization errors
2017-03-23 15:25:35 +01:00
bergquist
70b36a02af Revert "tech: use context package over xperimental version"
This reverts commit 99f1c30071.
2017-02-20 22:04:51 +01:00
bergquist
99f1c30071 tech: use context package over xperimental version 2017-02-20 21:44:15 +01:00
Dan Cech
b22881c717 redirect user to requested url after login via oauth 2017-02-09 14:01:53 -05: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
Tom Kozlowski
a353c8d1bb added explicitly setting token as Bearer Type 2016-11-16 09:55:14 -05:00
Eric Uldall
658fc1a67a added hosted domain suppport to google oauth login (#6372) 2016-10-28 12:00:47 +02:00
Eric Uldall
eda442dbf9 added support to login user oauth user by email only (#6330)
* added support to login user oauth user by email only

* added sql handler

* fixed model method name from GetUserByEmail to GetUserByEmailQuery

* fixed variable declaration typo
2016-10-20 06:45:10 +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