| 1 |
Grafana |
| 2 |
======= |
| 3 |
|
| 4 |
|image0| |
| 5 |
|
| 6 |
Presentation |
| 7 |
------------ |
| 8 |
|
| 9 |
`Grafana <https://grafana.com/>`__ is an Open Source dashboard for |
| 10 |
monitoring databases such as Prometheus, Graphite or Elasticsearch |
| 11 |
|
| 12 |
Grafana offers social login through a generic OAuth 2 connector. |
| 13 |
Thankfully, it is close enough to OpenID Connect to work well with |
| 14 |
LemonLDAP::NG |
| 15 |
|
| 16 |
Pre-requisites |
| 17 |
-------------- |
| 18 |
|
| 19 |
Grafana configuration |
| 20 |
~~~~~~~~~~~~~~~~~~~~~ |
| 21 |
|
| 22 |
You should start by following the generic OAuth2 documentation provided |
| 23 |
by Grafana: https://grafana.com/docs/grafana/latest/auth/generic-oauth/ |
| 24 |
|
| 25 |
Your configuration file will have to look something like this: |
| 26 |
|
| 27 |
:: |
| 28 |
|
| 29 |
[auth.generic_oauth] |
| 30 |
enabled = true |
| 31 |
client_id = CHOOSE_A_CLIENT_ID |
| 32 |
client_secret = CHOOSE_A_CLIENT_SECRET |
| 33 |
scopes = openid email profile |
| 34 |
auth_url = https://auth.example.com/oauth2/authorize |
| 35 |
token_url = https://auth.example.com/oauth2/token |
| 36 |
api_url = https://auth.example.com/oauth2/userinfo |
| 37 |
allow_sign_up = true |
| 38 |
name = LemonLDAP::NG |
| 39 |
send_client_credentials_via_post = false |
| 40 |
email_attribute_name = email |
| 41 |
|
| 42 |
LL:NG |
| 43 |
~~~~~ |
| 44 |
|
| 45 |
Make sure you have already |
| 46 |
:doc:`enabled OpenID Connect<../idpopenidconnect>` on your LemonLDAP::NG |
| 47 |
server |
| 48 |
|
| 49 |
Then, add a Relying Party with the following configuration: |
| 50 |
|
| 51 |
- Options » Authentification » Client ID : same as ``client_id`` above |
| 52 |
- Options » Authentification » Client Secret : same as ``client_secret`` above |
| 53 |
- Options » Allowed redirection address : ``https://<grafana domain>/login/generic_oauth`` |
| 54 |
|
| 55 |
If you want to transmit extra user attributes to Grafana, you also need to configure: |
| 56 |
|
| 57 |
- Scope values content » |
| 58 |
|
| 59 |
- add a key named ``profile`` to override the default claim list |
| 60 |
- set a value of ``name username display_name upn`` |
| 61 |
|
| 62 |
- Exported Attributes (not all of them are mandatory) |
| 63 |
|
| 64 |
- replace the existing keys with the following 5 new keys: |
| 65 |
|
| 66 |
- ``name`` |
| 67 |
- ``username`` |
| 68 |
- ``display_name`` |
| 69 |
- ``upn`` |
| 70 |
- ``email`` |
| 71 |
|
| 72 |
- map them to your corresponding LemonLDAP::NG session attribute |
| 73 |
|
| 74 |
.. tip:: |
| 75 |
|
| 76 |
To trigger OIDC authentication directly, you can register grafana in application menu and |
| 77 |
set as URL: ``https://<grafana domain>/login/generic_oauth`` |
| 78 |
|
| 79 |
.. |image0| image:: /applications/grafana_logo.png |
| 80 |
:class: align-center |
| 81 |
|