Keycloak: align client attributes with realm dictionary

- Extended kc_force_attrs in tasks/main.yml to source 'publicClient',
  'serviceAccountsEnabled' and 'frontchannelLogout' directly from
  KEYCLOAK_DICTIONARY_REALM for consistency with import definitions.
- Updated default.json.j2 import template to set 'publicClient' to true.
- Public client mode is required so the frontend API of role 'web-app-desktop'
  can handle login/logout flows without client secret.

Ref: https://chatgpt.com/share/68ae0060-4fac-800f-9f02-22592a4087d3
This commit is contained in:
Kevin Veen-Birkenbach 2025-08-26 21:22:27 +02:00
parent c182ecf516
commit 97f4045c68
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
2 changed files with 22 additions and 2 deletions

View File

@ -47,7 +47,27 @@
| list | first | list | first
}} }}
kc_force_attrs: kc_force_attrs:
frontchannelLogout: true publicClient: >-
{{
(KEYCLOAK_DICTIONARY_REALM.clients
| selectattr('clientId','equalto', KEYCLOAK_CLIENT_ID)
| map(attribute='publicClient')
| first)
}}
serviceAccountsEnabled: >-
{{
(KEYCLOAK_DICTIONARY_REALM.clients
| selectattr('clientId','equalto', KEYCLOAK_CLIENT_ID)
| map(attribute='serviceAccountsEnabled')
| first )
}}
frontchannelLogout: >-
{{
(KEYCLOAK_DICTIONARY_REALM.clients
| selectattr('clientId','equalto', KEYCLOAK_CLIENT_ID)
| map(attribute='frontchannelLogout')
| first)
}}
attributes: >- attributes: >-
{{ {{
( (KEYCLOAK_DICTIONARY_REALM.clients ( (KEYCLOAK_DICTIONARY_REALM.clients

View File

@ -19,7 +19,7 @@
"implicitFlowEnabled": true, "implicitFlowEnabled": true,
"directAccessGrantsEnabled": true, "directAccessGrantsEnabled": true,
"serviceAccountsEnabled": true, "serviceAccountsEnabled": true,
"publicClient": false, "publicClient": true,
"frontchannelLogout": true, "frontchannelLogout": true,
"protocol": "openid-connect", "protocol": "openid-connect",
"attributes": { "attributes": {