Closed DebakelOrakel closed 2 years ago
Grafana has built in oauth2 capabilities including role mapping.
For the grafana.ini
(copied from infra.yml INTERNAL)
auth.generic_oauth:
name: Example Keycloak
enabled: true
allow_sign_up: true
auth_url: https://id.example.net/auth/realms/example-realm/protocol/openid-connect/auth
token_url: https://id.example.net/auth/realms/example-realm/protocol/openid-connect/token
api_url: https://id.example.net/auth/realms/example-realm/protocol/openid-connect/userinfo
client_id: example
client_secret: "?{vaultkv:${cluster:tenant}/${cluster:name}/example-grafana/client_secret}"
scopes: profile
role_attribute_strict: true
role_attribute_path: "roles[?contains(@, 'admin')] && 'Admin' || roles[?contains(@, 'editor')] && 'Editor' || roles[?contains(@, 'viewer')] && 'Viewer' || 'Deny'"
Needs to be mapped to the jsonnet/commodore way.
Context
I would like to expose grafana. I would like to secure access to grafana by oauth2.
Alternatives
Deploy a grafana helm chart.