Optimized RBAC variables and async in keycloak

This commit is contained in:
Kevin Veen-Birkenbach 2025-08-18 00:15:41 +02:00
parent 6443771d93
commit 29df95ed82
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
5 changed files with 9 additions and 7 deletions

View File

@ -5,7 +5,7 @@
{{ {{
( (
KEYCLOAK_DICTIONARY_REALM.clientScopes KEYCLOAK_DICTIONARY_REALM.clientScopes
| selectattr('name','equalto', KEYCLOAK_RBAC_GROUP_CLAIME) | selectattr('name','equalto', KEYCLOAK_RBAC_GROUP_CLAIM)
| list | first | list | first
) | to_json ) | to_json
}} }}
@ -27,7 +27,7 @@
scope_id_rbac: >- scope_id_rbac: >-
{{ ( {{ (
all_scopes.stdout | from_json all_scopes.stdout | from_json
| selectattr('name','equalto', KEYCLOAK_RBAC_GROUP_CLAIME) | selectattr('name','equalto', KEYCLOAK_RBAC_GROUP_CLAIM)
| list | first | default({}) | list | first | default({})
).id | default('') }} ).id | default('') }}
@ -70,3 +70,5 @@
register: add_opt register: add_opt
changed_when: true changed_when: true
failed_when: add_opt.rc != 0 failed_when: add_opt.rc != 0
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"

View File

@ -54,7 +54,7 @@
"organization", "organization",
"offline_access", "offline_access",
"microprofile-jwt", "microprofile-jwt",
"{{ KEYCLOAK_RBAC_GROUP_CLAIME }}", "{{ KEYCLOAK_RBAC_GROUP_CLAIM }}",
"{{ applications | get_app_conf(application_id, 'scopes.nextcloud', True) }}" "{{ applications | get_app_conf(application_id, 'scopes.nextcloud', True) }}"
] ]
} }

View File

@ -1430,7 +1430,7 @@
"phone", "phone",
"microprofile-jwt", "microprofile-jwt",
"organization", "organization",
"{{ KEYCLOAK_RBAC_GROUP_CLAIME }}", "{{ KEYCLOAK_RBAC_GROUP_CLAIM }}",
"{{ applications | get_app_conf(application_id, 'scopes.nextcloud', True) }}" "{{ applications | get_app_conf(application_id, 'scopes.nextcloud', True) }}"
], ],
"browserSecurityHeaders": { "browserSecurityHeaders": {

View File

@ -1,5 +1,5 @@
{ {
"name": "{{ KEYCLOAK_RBAC_GROUP_CLAIME }}", "name": "{{ KEYCLOAK_RBAC_GROUP_CLAIM }}",
"description": "RBAC Groups", "description": "RBAC Groups",
"protocol": "openid-connect", "protocol": "openid-connect",
"attributes": { "attributes": {
@ -22,7 +22,7 @@
"id.token.claim": "true", "id.token.claim": "true",
"lightweight.claim": "false", "lightweight.claim": "false",
"access.token.claim": "true", "access.token.claim": "true",
"claim.name": "{{ KEYCLOAK_RBAC_GROUP_CLAIME }}" "claim.name": "{{ KEYCLOAK_RBAC_GROUP_CLAIM }}"
} }
} }
] ]

View File

@ -14,7 +14,7 @@ KEYCLOAK_SERVER_INTERNAL_URL: "http://127.0.0.1:8080"
KEYCLOAK_LOAD_DEPENDENCIES: "{{ applications | get_app_conf(application_id, 'load_dependencies') }}" KEYCLOAK_LOAD_DEPENDENCIES: "{{ applications | get_app_conf(application_id, 'load_dependencies') }}"
# RBAC # RBAC
KEYCLOAK_RBAC_GROUP_CLAIME: "{{ RBAC.GROUP.CLAIM }}" KEYCLOAK_RBAC_GROUP_CLAIM: "{{ RBAC.GROUP.CLAIM }}"
KEYCLOAK_RBAC_GROUP_NAME: "{{ RBAC.GROUP.NAME }}" KEYCLOAK_RBAC_GROUP_NAME: "{{ RBAC.GROUP.NAME }}"
## Health ## Health