mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-04 12:18:17 +00:00 
			
		
		
		
	Optimized RBAC implementation
This commit is contained in:
		@@ -1,6 +1,5 @@
 | 
			
		||||
http_address            =   "0.0.0.0:4180"
 | 
			
		||||
cookie_secret           =   "{{ applications[oauth2_proxy_application_id].credentials.oauth2_proxy_cookie_secret }}"
 | 
			
		||||
email_domains           =   "{{ primary_domain }}"
 | 
			
		||||
cookie_secure           =   "true"                                                                                                                                                  # True is necessary to force the cookie set via https
 | 
			
		||||
upstreams               =   "http://{{ applications[oauth2_proxy_application_id].oauth2_proxy.application }}:{{ applications[oauth2_proxy_application_id].oauth2_proxy.port }}"
 | 
			
		||||
cookie_domains          =   ["{{ domains | get_domain(oauth2_proxy_application_id) }}", "{{ domains | get_domain('keycloak') }}"]                                                   # Required so cookie can be read on all subdomains.
 | 
			
		||||
@@ -14,7 +13,11 @@ oidc_issuer_url         =   "{{ oidc.client.issuer_url }}"
 | 
			
		||||
provider                =   "oidc"
 | 
			
		||||
provider_display_name   =   "Keycloak"
 | 
			
		||||
 | 
			
		||||
# role restrictions
 | 
			
		||||
#cookie_roles           =   "realm_access.roles"
 | 
			
		||||
#allowed_groups         =   "{{ applications[application_id].allowed_roles }}"           # This is not correct here. needs to be placed in applications @todo move there when implementing
 | 
			
		||||
# @see https://chatgpt.com/share/67f42607-bf68-800f-b587-bd56fe9067b5
 | 
			
		||||
{% if applications[oauth2_proxy_application_id].oauth2_proxy.allowed_groups is defined %}
 | 
			
		||||
{# role based restrictions #}
 | 
			
		||||
scope                   =   "openid email profile groups"
 | 
			
		||||
oidc_groups_claim       =   "realm_access.roles"
 | 
			
		||||
allowed_groups          =   {{ applications[oauth2_proxy_application_id].oauth2_proxy.allowed_groups | tojson }}
 | 
			
		||||
{% else %}
 | 
			
		||||
email_domains           =   "{{ primary_domain }}"
 | 
			
		||||
{% endif %}
 | 
			
		||||
		Reference in New Issue
	
	Block a user