fix(auth): add email fallback scope for Grafana OAuth and set attribute paths
This commit is contained in:
1 parent
811d65526b
commit
94a143623b
2 files changed
+19
-1
No files matched your search
@@ -66,6 +66,10 @@ services:
|
|||||||
- GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://auth.gunihome.ru/application/o/token/
|
- GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://auth.gunihome.ru/application/o/token/
|
||||||
- GF_AUTH_GENERIC_OAUTH_API_URL=https://auth.gunihome.ru/application/o/userinfo/
|
- GF_AUTH_GENERIC_OAUTH_API_URL=https://auth.gunihome.ru/application/o/userinfo/
|
||||||
- GF_AUTH_GENERIC_OAUTH_ALLOW_SIGN_UP=true
|
- GF_AUTH_GENERIC_OAUTH_ALLOW_SIGN_UP=true
|
||||||
|
- GF_AUTH_GENERIC_OAUTH_LOGIN_ATTRIBUTE_PATH=preferred_username
|
||||||
|
- GF_AUTH_GENERIC_OAUTH_NAME_ATTRIBUTE_PATH=name
|
||||||
|
- GF_AUTH_GENERIC_OAUTH_EMAIL_ATTRIBUTE_PATH=email
|
||||||
|
- GF_AUTH_GENERIC_OAUTH_USE_PKCE=true
|
||||||
- "GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH=contains(groups[*], 'admins') && 'Admin' || 'Viewer'"
|
- "GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH=contains(groups[*], 'admins') && 'Admin' || 'Viewer'"
|
||||||
- GF_AUTH_GENERIC_OAUTH_ALLOW_ASSIGN_GRAFANA_ADMIN=true
|
- GF_AUTH_GENERIC_OAUTH_ALLOW_ASSIGN_GRAFANA_ADMIN=true
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -15,6 +15,20 @@ entries:
|
|||||||
identifiers:
|
identifiers:
|
||||||
name: family
|
name: family
|
||||||
|
|
||||||
|
- model: authentik_providers_oauth2.scopemapping
|
||||||
|
id: scope-grafana-email
|
||||||
|
identifiers:
|
||||||
|
managed: homelab/providers/oauth2/scope-grafana-email
|
||||||
|
attrs:
|
||||||
|
name: "Grafana OAuth Mapping: OpenID 'email' with fallback"
|
||||||
|
scope_name: email
|
||||||
|
description: "Email scope with fallback for users without email"
|
||||||
|
expression: |
|
||||||
|
return {
|
||||||
|
"email": request.user.email or f"{request.user.username}@gunihome.ru",
|
||||||
|
"email_verified": True
|
||||||
|
}
|
||||||
|
|
||||||
- model: authentik_providers_oauth2.oauth2provider
|
- model: authentik_providers_oauth2.oauth2provider
|
||||||
id: provider-grafana
|
id: provider-grafana
|
||||||
identifiers:
|
identifiers:
|
||||||
@@ -31,7 +45,7 @@ entries:
|
|||||||
signing_key: !Find [authentik_crypto.certificatekeypair, [name, "authentik Self-signed Certificate"]]
|
signing_key: !Find [authentik_crypto.certificatekeypair, [name, "authentik Self-signed Certificate"]]
|
||||||
property_mappings:
|
property_mappings:
|
||||||
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, openid]]
|
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, openid]]
|
||||||
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, email]]
|
- !KeyOf scope-grafana-email
|
||||||
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, profile]]
|
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, profile]]
|
||||||
|
|
||||||
- model: authentik_core.application
|
- model: authentik_core.application
|
||||||
|
|||||||
Reference in new issue
Block a user