mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 02:10:45 -06:00
Add JWT url auth documentation (#54040)
* add jwt auth docs * add appropriate warnings to docs * remove unimplemented login_token assumptions * Update conf/sample.ini
This commit is contained in:
parent
78978048c3
commit
4952b7f22d
@ -598,6 +598,7 @@
|
|||||||
;expected_claims = {"aud": ["foo", "bar"]}
|
;expected_claims = {"aud": ["foo", "bar"]}
|
||||||
;key_file = /path/to/key/file
|
;key_file = /path/to/key/file
|
||||||
;auto_sign_up = false
|
;auto_sign_up = false
|
||||||
|
;url_login = false
|
||||||
|
|
||||||
#################################### Auth LDAP ##########################
|
#################################### Auth LDAP ##########################
|
||||||
[auth.ldap]
|
[auth.ldap]
|
||||||
|
@ -15,7 +15,6 @@ signout_redirect_url = http://env.grafana.local:8088/oauth2/sign_out
|
|||||||
|
|
||||||
[auth.jwt]
|
[auth.jwt]
|
||||||
enabled = true
|
enabled = true
|
||||||
enable_login_token = true
|
|
||||||
header_name = X-Forwarded-Access-Token
|
header_name = X-Forwarded-Access-Token
|
||||||
username_claim = login
|
username_claim = login
|
||||||
email_claim = email
|
email_claim = email
|
||||||
|
@ -15,6 +15,10 @@ You can configure Grafana to accept a JWT token provided in the HTTP header. The
|
|||||||
- JSON Web Key Set (JWKS) in a local file
|
- JSON Web Key Set (JWKS) in a local file
|
||||||
- JWKS provided by the configured JWKS endpoint
|
- JWKS provided by the configured JWKS endpoint
|
||||||
|
|
||||||
|
This method of authentication is useful for integrating with other systems that
|
||||||
|
use JWKS but can't directly integrate with Grafana or if you want to use pass-through
|
||||||
|
authentication in an app embedding Grafana.
|
||||||
|
|
||||||
## Enable JWT
|
## Enable JWT
|
||||||
|
|
||||||
To use JWT authentication:
|
To use JWT authentication:
|
||||||
@ -53,6 +57,46 @@ email_claim = sub
|
|||||||
|
|
||||||
If `auto_sign_up` is enabled, then the `sub` claim is used as the "external Auth ID". The `name` claim is used as the user's full name if it is present.
|
If `auto_sign_up` is enabled, then the `sub` claim is used as the "external Auth ID". The `name` claim is used as the user's full name if it is present.
|
||||||
|
|
||||||
|
## Iframe Embedding
|
||||||
|
|
||||||
|
If you want to embed Grafana in an iframe while maintaning user identity and role checks,
|
||||||
|
you can use JWT authentication to authenticate the iframe.
|
||||||
|
|
||||||
|
> **Note**: for scenarios where verifying viewer identity is not required,
|
||||||
|
> [public dashboards]({{< relref "../../../dashboards/dashboard-public" >}}) embedding should be used.
|
||||||
|
|
||||||
|
In this scenario, you will need to configure Grafana to accept a JWT
|
||||||
|
provided in the HTTP header and a reverse proxy should rewrite requests to the
|
||||||
|
Grafana instance to include the JWT in the request's headers.
|
||||||
|
|
||||||
|
> **Note**: for embedding to work `allow_embedding` must be enabled in the [security section]({{< relref "../../configure-grafana#allow_embedding" >}}).
|
||||||
|
|
||||||
|
In a scenario where it is not possible to rewrite the request headers you
|
||||||
|
can use URL login instead.
|
||||||
|
|
||||||
|
### URL login
|
||||||
|
|
||||||
|
`url_login` allows grafana to search for a JWT in the URL query parameter
|
||||||
|
`auth_token` and use it as the authentication token.
|
||||||
|
|
||||||
|
> **Warning**: this can lead to JWTs being exposed in logs and possible session hijacking if the server is not
|
||||||
|
> using HTTP over TLS.
|
||||||
|
|
||||||
|
```ini
|
||||||
|
# [auth.jwt]
|
||||||
|
# ...
|
||||||
|
url_login = true # enable JWT authentication in the URL
|
||||||
|
```
|
||||||
|
|
||||||
|
An example of an URL for accessing grafana with JWT URL authentication is:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://env.grafana.local/d/RciOKLR4z/board-identifier?orgId=1&kiosk&auth_token=eyJhbxxxxxxxxxxxxx
|
||||||
|
```
|
||||||
|
|
||||||
|
A sample repository using this authentication method is available
|
||||||
|
at [grafana-iframe-oauth-sample](https://github.com/grafana/grafana-iframe-oauth-sample).
|
||||||
|
|
||||||
## Signature verification
|
## Signature verification
|
||||||
|
|
||||||
JSON web token integrity needs to be verified so cryptographic signature is used for this purpose. So we expect that every token must be signed with some known cryptographic key.
|
JSON web token integrity needs to be verified so cryptographic signature is used for this purpose. So we expect that every token must be signed with some known cryptographic key.
|
||||||
|
Loading…
Reference in New Issue
Block a user