×
How can I configure Grafana to authenticate users via ITRS Analytics?
Learn how you can configure Grafana to authenticate users via ITRS Analytics.
Do the following steps after downloading the latest supported Grafana version.
Retrieve the client secret from Keycloak Copied
- Log in to the ITRS Analytics Keycloak instance. This is accessible via
https://<external-itrs-analytics-hostname>/auth
. - Navigate to Obcerv realm > Clients > obcerv-apps > Credentials.
- Locate and copy the Client Secret. This value will be used later in the Grafana configuration.
Configure valid redirect URLs in Keycloak Copied
- Navigate to Obcerv realm > Clients > obcerv-apps > Settings.
- Add the URL of your Grafana server into the valid redirect URLs list. For example,
http://localhost:3000/*
.
Configure the realm roles mapper in Keycloak Copied
- Navigate to Obcerv realm > Clients > obcerv-apps > Client scopes > obcerv-apps-dedicated, and then create a new mapper.
- Select From predefined mappers, then search for and select realm roles.
- Click Add.
- In the mapper configuration, set Token Claim Name: roles by selecting the following:
- Add to ID token
- Add to access token
- Add to lightweight access token
- Add to userinfo
- Add to token introspection
- Save your changes.
Edit Grafana’s conf/defaults.ini file Copied
-
Open the
conf/defaults.ini
file. -
Set the domain to the correct fully qualified domain name (FQDN) of your Grafana server. Adjust the
http_port
as needed. -
Locate the
auth.generic_oauth
section and replace it with the following configuration:enabled = true
name = ITRS Analytics
allow_sign_up = true
client_id = obcerv-apps
client_secret =
Use the value from the client secret.
scopes = openid profile email offline_access roles
Adding required scopes, such as “email,” enforces that all user profiles have a value for that attribute. If a user’s profile is missing the required attribute, authentication will fail.
email_attribute_path = email
login_attribute_path = username
name_attribute_path = full_name
auth_url = https://<ITRS Analytics URL>/auth/realms/obcerv/protocol/openid-connect/auth
token_url = https://<ITRS Analytics URL>/auth/realms/obcerv/protocol/openid-connect/token
api_url = https://<ITRS Analytics URL>/auth/realms/obcerv/protocol/openid-connect/userinfo
role_attribute_path = contains(roles[*], 'admin') && 'GrafanaAdmin' || 'Editor'
Install the ITRS Analytics Grafana Datasource app Copied
- Log in to Grafana using standard authentication (not ITRS Analytics) with an admin role. This initial login is required to install the data source.
- Navigate to Home > Connections > Add new connection.
- Search for
ITRS
, clickITRS Group Obcerv
, then click the install button. - Log out of Grafana.
Configure ITRS Analytics with the new data source Copied
- Log in to Grafana using your ITRS Analytics credentials with an admin role.
- Navigate to Home > Connections > Data Sources, then click Add new data source.
- Select
ITRS Group Obcerv
. - In the API URL field, enter the base URL for the API. This is usually
https://<ITRS Analytics URL>/obcerv-app-api-gateway
- Click Save & Test.
["ITRS Analytics"]
["ITRS Analytics > Grafana"]
["FAQ"]