mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2026-11-21 14:48:50 +00:00
Port integration tests from community.general keycloak modules into the keycloak collection molecule test framework (keycloak_modules scenario), adapting for KC 26.x behavioral changes and middleware module differences. Ported modules: keycloak_authentication, keycloak_authz_authorization_scope, keycloak_authz_permission, keycloak_client, keycloak_client_rolescope, keycloak_client_scope_rolemappings, keycloak_client_scope_type, keycloak_clientsecret_info, keycloak_clientsecret_regenerate, keycloak_component_info, keycloak_group, keycloak_group_rolemapping, keycloak_identity_provider, keycloak_modules_authentication, keycloak_realm, keycloak_realm_key, keycloak_realm_users_info, keycloak_role, keycloak_user, keycloak_user_federation, keycloak_user_rolemapping, keycloak_userprofile. KC 26.x adaptations: - serviceAccountsEnabled defaults to true on new clients - Default Policy/Resource no longer auto-created for authz clients - Built-in admin role rejects PUT updates (403) - Invalid credentials return HTTP 400 instead of 401 - LDAP federation no longer auto-creates mappers Other fixes: - Variable collision avoidance (role/group/client register overwriting play-level vars via include_vars) - Ansible 2.19+ native Jinja dict handling (endpoint combine filter) - Jinja embedded template warnings in assert expressions - Auth fallback prevention in invalid-token tests
57 lines
2.0 KiB
YAML
57 lines
2.0 KiB
YAML
---
|
|
# Ported from community.general tests/integration/targets/keycloak_realm
|
|
# Tests session timeout and OAuth2 device settings on keycloak_realm module.
|
|
|
|
- name: Modify realm
|
|
middleware_automation.keycloak.keycloak_realm:
|
|
id: "{{ ephemeral_realm }}"
|
|
realm: "{{ ephemeral_realm }}"
|
|
client_session_idle_timeout: 240
|
|
client_session_max_lifespan: 21600
|
|
client_offline_session_idle_timeout: 100
|
|
client_offline_session_max_lifespan: 200
|
|
oauth2_device_code_lifespan: 700
|
|
oauth2_device_polling_interval: 800
|
|
state: present
|
|
register: result
|
|
|
|
- name: Assert result
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result is changed
|
|
- result.end_state.clientSessionIdleTimeout == 240
|
|
- result.end_state.clientSessionMaxLifespan == 21600
|
|
- result.end_state.clientOfflineSessionIdleTimeout == 100
|
|
- result.end_state.clientOfflineSessionMaxLifespan == 200
|
|
- result.end_state.oauth2DeviceCodeLifespan == 700
|
|
- result.end_state.oauth2DevicePollingInterval == 800
|
|
|
|
- name: Delete realm
|
|
middleware_automation.keycloak.keycloak_realm:
|
|
realm: "{{ ephemeral_realm }}"
|
|
state: absent
|
|
|
|
- name: create realm
|
|
middleware_automation.keycloak.keycloak_realm:
|
|
id: "{{ ephemeral_realm }}"
|
|
realm: "{{ ephemeral_realm }}"
|
|
client_session_idle_timeout: 240
|
|
client_session_max_lifespan: 21600
|
|
client_offline_session_idle_timeout: 100
|
|
client_offline_session_max_lifespan: 200
|
|
oauth2_device_code_lifespan: 700
|
|
oauth2_device_polling_interval: 800
|
|
state: present
|
|
register: result
|
|
|
|
- name: Assert result
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result is changed
|
|
- result.end_state.clientSessionIdleTimeout == 240
|
|
- result.end_state.clientSessionMaxLifespan == 21600
|
|
- result.end_state.clientOfflineSessionIdleTimeout == 100
|
|
- result.end_state.clientOfflineSessionMaxLifespan == 200
|
|
- result.end_state.oauth2DeviceCodeLifespan == 700
|
|
- result.end_state.oauth2DevicePollingInterval == 800
|