Hi all,
I was using keycloak to set sso for grafana by config [auth.generic_oauth] in grafana.ini
However, only one realm can be set in [auth.generic_oauth], just like:
[auth.generic_oauth]
enabled = true
name = Oauth
allow_sign_up = true
client_id = grafana
client_secret = 7105436b-45a8-4563-9cea-f1460d88dff9
auth_url = http://keycloak.domain/auth/realms/**<realm_name>**/protocol/openid-connect/auth
token_url = http://keycloak.domain/auth/realms/**<realm_name>**/protocol/openid-connect/token
api_url = http://keycloak.domain/auth/realms/**<realm_name>**/protocol/openid-connect/userinfo
And here is a normal use case:
- setup keycloak.
- add a new realm <realm_test1> in keycloak.
- add a new client in <realm_test1>
- add a new user in <realm_test1>
- setup [auth.generic_oauth] part in grafana.ini
- restart grafana-server
- SSO complete.
However, in my condition, we have several clusters, and multiple realms need to be set, so if user in different realms can login grafana via keycloak (SSO), how to get there?
I have tried:
- setup keycloak.
- add a new realm <realm_test1> in keycloak.
- add a new client in <realm_test1>
- add a new user in <realm_test1>
- setup [auth.generic_oauth] part in grafana.ini
- while I add new realm <realm_test2> and add new client & user under <realm_test2>, a script should setup [auth.generic_oauth] part and regenerate grafana.ini automatically.
- grafana-server should be restarted to take effect.
I didn’t find any reload
API or any other signal that can trigger grafana to reload configuration.
So, how can I setup SSO with multiple realms? Any suggestions here? Thanks a lot.