Commit Graph
213 Commits
Author SHA1 Message Date
Stefan Krempel 33e7ed3a7e molecule: fix quarkus_flags role lookup and keycloak.conf path
The quarkus_flags scenario added in #445 is the only role-based
scenario without the roles -> ../../roles symlink, so in CI its
converge stops with "the role 'keycloak_quarkus' was not found".

Once the role is found, verify fails next: it reads
/opt/keycloak/keycloak-26.7.3/conf/keycloak.conf, but the scenario
installs the role's default version, which is no longer 26.7.3.

Add the roles symlink the other scenarios use and read keycloak.conf
through the /opt/keycloak/keycloak-*/ glob already used in
molecule/quarkus/verify.yml, so the check does not depend on the
installed version. The assertions are unchanged.
2026-11-20 13:10:15 +01:00
Ranabir ChakrabortyandGitHub 901c21e87e Merge pull request #445 from cihlamar/AMW-653
Add quarkus_flags molecule scenario for untested flag toggles
2026-11-13 18:51:01 +05:30
Stefan Krempel 33c0bfbdec Bump Keycloak to 26.8.1 and RHBK to 26.6.7
Update the keycloak_quarkus role defaults, argument specs, README and
molecule scenarios to the current upstream releases. Keycloak 26.7.4,
26.7.5, 26.8.0 and 26.8.1 together fix more than 40 CVEs, among them
CVE-2026-17526 (impersonation role can impersonate a realm admin) and
CVE-2026-94000 (manage-users delegated admin can become realm-admin).

The RHBK default moves from the 26.4 to the 26.6 stream. RHBK 26.6.7
(RHSA-2026:68278) fixes 28 CVEs; 26.4.16, the latest 26.4 release
from the same day, fixes 7 of them.

- keycloak_quarkus_version: 26.7.3 -> 26.8.1
- rhbk_version: 26.4.15 -> 26.6.7
- molecule/quarkus: SPID provider 26.7.1 -> 26.8.1 (new sha256),
  keycloak-kerberos-federation 26.7.3 -> 26.8.1
- molecule/quarkus_upgrade: prepare on 26.7.3, converge to 26.8.1

JDBC driver defaults are left unchanged; they still match the versions
listed in Red Hat article 7033107 referenced from the defaults file.
2026-11-03 21:41:13 +01:00
Martin Cihlar e871df11a1 AMW-653 Add quarkus_flags molecule scenario for untested flag toggles 2026-11-03 18:55:30 +01:00
Aleksandr Mangin 2a7834c5e4 keycloak_userprofile: support required.scopes
Keycloak can require a user profile attribute only when one of the given
client scopes is requested, but the module's argument spec only accepted
required.roles and rejected required.scopes.
2026-11-02 20:21:31 +01:00
Aleksandr ManginandClaude Opus 5.5 fa594a57de molecule: address review on containerized CI runners
- drop the debian scenario from CI: the Debian mirrors are blocked on
  the CI network
- quarkus_upgrade, https_revproxy: drop unused fixed published_ports
- debian: fetch the openid configuration from the instance with
  ansible.builtin.uri instead of curl | jq on the controller

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 13:14:36 +01:00
Aleksandr ManginandClaude Opus 5.5 68a1f3d28b molecule: make scenarios work on containerized CI runners
Since the molecule jobs moved to self-hosted container runners, molecule
talks to a Docker daemon that does not share the runner's filesystem or
network namespace:

- quarkus_ha*: drop the postgresql.conf bind mount (the workspace path
  does not exist on the daemon side) and pass listen_addresses via -c
- quarkus, quarkus_devmode: fetch the openid configuration from the
  instance with ansible.builtin.uri instead of curl | jq on the runner,
  and drop the fixed host published_ports that are no longer needed
- quarkus_nohost: add the missing roles symlink

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 09:44:24 +01:00
Ranabir ChakrabortyandGitHub 9c5f03b8be Merge pull request #446 from cihlamar/AMW-578
Fix INJECT_FACTS_AS_VARS deprecation in molecule prepare files
2026-11-01 19:29:20 +05:30
Ranabir ChakrabortyandGitHub 2d01c78590 Merge pull request #444 from FilipeCapela98/fix/442-keycloak-user-check-mode-groups
keycloak_user: fix check mode reporting changed=True for every existing user
2026-11-01 19:24:24 +05:30
sarankumar1325 dc8a6cb02d keycloak_realm: fix check mode always reporting changed
Check mode compared the realm returned by Keycloak with a plain
dict.update() of the module parameters. Keycloak stores attributes,
browserSecurityHeaders and smtpServer as string maps, merges attributes
and browserSecurityHeaders into the existing values and masks the SMTP
password, so the comparison never matched and check mode always
reported a change while a live run reported ok.

Predict the realm Keycloak would return for those maps in check mode
and add molecule checks for unchanged and changed settings.

Fixes #447

Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
2026-10-30 13:12:39 +00:00
Martin Cihlar 0891945924 AMW-578 Fix INJECT_FACTS_AS_VARS deprecation in molecule prepare files 2026-10-19 17:45:10 +02:00
Ranabir Chakraborty a3bd55327d AMW-654 keycloak_realms doesn't update default or optional default client scopes 2026-10-16 02:35:18 +05:30
Filipe Rosa Capela 07438ad4af keycloak_user: fix check mode reporting changed=True for every existing user
In check mode, the desired group memberships were built as a set and
compared with the stored memberships, a list, through is_struct_included().
It has no branch for sets and falls back to comparing their string forms,
which never match, so check mode reported a change for every existing user,
with or without groups.

Check mode now decides like normal mode: a group given by name or by path
counts as joined when the user is already a member. That rule moves from
update_user_groups_membership() into
filter_groups_to_add_to_and_remove_from_user(), which both modes use, and
the groups reported in check mode no longer list a group given by path
twice. Add check mode tests, including groups given by path.

Fixes #442

Signed-off-by: Filipe Rosa Capela <Filipe.Capela-CIC.Netherlands1@ibm.com>
2026-10-13 18:23:51 +02:00
Martin Cihlar c51f290d64 AMW-616 Port 24 community.general keycloak integration tests to molecule
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
2026-10-08 20:48:09 +02:00
Harsha CherukuriandGitHub 3f620aaeba Merge pull request #429 from cihlamar/AMW-641
Fix health check URL to use localhost with protocol and port
2026-10-05 19:22:06 -04:00
Ranabir Chakraborty ed99d28b5d AMW-644 keycloak_user_federation module always reports task as changed in check mode 2026-10-05 19:40:06 +05:30
Martin Cihlar 3e82ac6461 AMW-641 Fix health check URL to use localhost instead of public hostname
Replace hostname-based health check URL with localhost. The health check
runs on the managed host itself, so it should always target localhost
rather than the public-facing keycloak_quarkus_hostname which can be
empty or a domain name behind a load balancer.

Compose the URL directly from existing production variables
(keycloak_quarkus_http_enabled, keycloak_quarkus_http_port,
keycloak_quarkus_https_port, keycloak_quarkus_http_relative_path)
without introducing intermediate variables.

Add .config/molecule/config.yml with shared molecule settings and a new
quarkus_nohost test scenario that verifies the role works when
keycloak_quarkus_hostname is left at its default empty value.

Fixes #428
2026-10-05 15:24:02 +02:00
Ranabir Chakraborty bd2c01a588 AMW-642 keycloak_identity_provider: add support for Do not store users from transient-users feature 2026-10-01 00:55:27 +05:30
Harsha CherukuriandGitHub 221b1a7667 Merge pull request #425 from hcherukuri/main
Issue#421 Remove default setting of JAVA_OPTS and restrict to JAVA_OPTS_KC_HEAP and JAVA_OPTS_APPEND
2026-09-21 08:15:22 -04:00
Harsha Cherukuri d4fea4a5be Fix quarkus molecule verify for JAVA_OPTS sysconfig 2026-09-18 09:30:58 -04:00
Harsha Cherukuri 8a3ed80b04 Issue#421 Remove default setting of JAVA_OPTS and restrict to JAVA_OPTS_KC_HEAP and JAVA_OPTS_APPEND 2026-09-17 11:15:47 -04:00
Stefan Krempel f3b484acdd Bump Keycloak to 26.7.3 and RHBK to 26.4.15
Update the keycloak_quarkus role defaults, argument specs, README and
molecule scenarios to the current upstream releases. Keycloak 26.7.2+
and RHBK 26.4.15 fix CVE-2026-18963 (GHSA-4gv3-mc9p-5wqc, CVSS 9.1).

- keycloak_quarkus_version: 26.6.2 -> 26.7.3
- rhbk_version: 26.4.11 -> 26.4.15
- molecule/quarkus: SPID provider 26.5.6 -> 26.7.1 (new sha256),
  keycloak-kerberos-federation 26.6.3 -> 26.7.3
- molecule/quarkus_upgrade: prepare on 26.6.2, converge to 26.7.3

JDBC driver defaults are left unchanged; they still match the versions
listed in Red Hat article 7033107 referenced from the defaults file.
2026-09-15 15:39:42 +02:00
Ranabir ChakrabortyandGitHub e103524781 Merge pull request #384 from NilsBergmann/feature/authv2-formaction
authentication_v2: Fix validation for FormActions
2026-09-11 20:00:09 +05:30
Ranabir ChakrabortyandGitHub 9ac8274434 Merge pull request #413 from cihlamar/AMW-578
Replace deprecated community.general.yaml callback with result
2026-09-10 21:07:57 +05:30
Martin Cihlar 8c3c4d8cbc AMW-578 Replace deprecated community.general.yaml callback with result_format 2026-09-10 10:38:00 +02:00
Nils Bergmann 638f694120 authentication_v2: Fix validation for form-flows and client-flows 2026-09-09 10:36:56 +02:00
Ranabir Chakraborty 86bd6c77d6 AMW-626 keycloak_user_rolemapping raises 403 error code while listing asignable Roles if invoker lacks view-realm Role 2026-09-09 13:24:37 +05:30
Ranabir ChakrabortyandGitHub 6644207e5d Merge pull request #407 from Yabk/bugfix/keycloak_group_parents
keycloak_group: fix subgroup lookup on Keycloak older than 25
2026-09-09 12:40:51 +05:30
Martin Cihlar d6ceb63914 AMW-625 add use_netrc option to prevent .netrc overriding bearer token auth
When ~/.netrc contains an entry matching the Keycloak host, open_url()
silently replaces the OIDC Bearer header with Basic auth, causing 401
errors. Add use_netrc option (default false) to all keycloak modules
and pass it through to both open_url() call sites.

Includes molecule test scenario (netrc) that verifies both behaviors:
- default use_netrc=false ignores .netrc (fix works)
- use_netrc=true picks up .netrc and gets 401 (proves the bug)

Fixes: https://github.com/ansible-middleware/keycloak/issues/403
2026-09-07 09:09:39 +02:00
Yabk 529b667321 keycloak_group: fix subgroup lookup on Keycloak older than 25
The parents branch of get_group_by_name() queried
GET /admin/realms/{realm}/groups/{id}/children?search=&exact=true
unconditionally. That endpoint only accepts GET from Keycloak 23 on, so
older servers (RH-SSO 7.x included) failed with 405 Method Not Allowed,
and 23/24 ignore search/exact and return only the first 10 children, so
subgroups past the tenth were silently reported as absent.

The lookup now goes through get_subgroups(), which already detects the
server generation, and that helper takes an optional search argument so
the search optimization is kept where the server supports it.
2026-09-04 12:56:23 +02:00
Ranabir Chakraborty 0868b58e90 AMW-622 keycloak collection spelling and grammar checking for PRs 2026-09-03 22:18:47 +05:30
Ranabir ChakrabortyandGitHub d41fc161be Merge pull request #392 from cihlamar/AMW-612
Normalize hostname that includes http_relative_path suffix
2026-09-01 18:42:10 +05:30
Martin Cihlar b48b0b7334 AMW-612 Fix health URL duplication when hostname includes http_relative_path
Use removesuffix to strip overlapping path from hostname before
re-appending http_relative_path, preventing /auth/auth/ duplication.
Add molecule test for the relative path scenario.
2026-08-27 13:14:28 +02:00
Thomas Bargetz 742c44039c 369 add integration tests for keycloak_authentication_v2 2026-08-17 07:40:31 +02:00
Chris BrownandClaude Opus 4.6 c8253fdbf8 Add keycloak_organization and keycloak_organization_info modules
Keycloak 26 introduced Organizations as a stable feature for B2B
multi-tenancy within a single realm. This adds declarative Ansible
module support so organizations can be managed like other Keycloak
resources instead of requiring direct REST API calls.

New modules:
- keycloak_organization: CRUD for organizations with full check_mode,
  diff_mode, and idempotency support. Manages name, alias, description,
  enabled state, domains, and attributes.
- keycloak_organization_info: read-only module to list/search
  organizations by name with exact or partial matching.

Also adds 6 API methods to the KeycloakAPI class and comprehensive
Molecule integration tests covering create, idempotency, update,
info queries, attributes, and delete flows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-08-07 07:26:58 +01:00
Harsha CherukuriandGitHub 866c5e2255 Merge pull request #371 from RISE-GmbH/368-avoid_pruning_of_undefined_realm_attributes
368 keycloak_realm: Control whether undefined realm attributes are pruned
2026-07-28 09:10:49 -04:00
Thomas Bargetz 95c6fe1b50 386 add integration tests 2026-07-27 11:01:35 +02:00
Harsha Cherukuri ff51c4098a Add community.general.keycloak_realm_users_info into keycloak collection 2026-07-23 22:31:32 -04:00
Martin Cihlar 4f62617f2c Fix health check URL to include HTTP relative path
- Include keycloak_quarkus_http_relative_path in health_url construction
- Use rstrip('/') to handle both default '/' and custom paths like '/auth'
- Replace hardcoded 'master' realm with keycloak_quarkus_master_realm variable
- Add keycloak_quarkus_validate_certs option for SSL certificate validation
- Update documentation in meta and README

Fixes #299
2026-07-22 11:24:57 +02:00
Ranabir Chakraborty d25bf46a6a AMW-592 AMW Github Actions are failing because of latest molecule 2026-07-21 00:27:35 +05:30
Harsha CherukuriandGitHub 0307985282 Merge pull request #356 from RanabirChakraborty/AMW-571
AMW-571 keycloak_identity_provider hide_on_login_page not working
2026-06-24 23:19:24 -04:00
Ranabir Chakraborty 728d5288ec Fixing linting issues 2026-06-25 03:22:25 +05:30
Ranabir Chakraborty eaeedd8d74 AMW-571 keycloak_identity_provider hide_on_login_page not working 2026-06-23 22:43:37 +05:30
Ranabir Chakraborty 1f82f50127 Fix downstream SSO collection errors 2026-06-20 21:14:34 +05:30
Ranabir Chakraborty 0a9e6c66eb Fixing password 2026-06-20 13:01:44 +05:30
Ranabir Chakraborty 01b00dfb2e Providing correct rhbk version 2026-06-11 18:58:23 +05:30
Harsha Cherukuri c8bcff39ef Fix keycloak client module 2026-06-10 08:22:52 -04:00
Felix Grzelka 808d137e4c s/clientscope/client_scope/ 2026-06-08 12:00:52 +00:00
Harsha Cherukuri 123906d739 Added PRs #11841 and #11749, and updated version references from community.general to Keycloak. 2026-05-30 09:29:04 -04:00
Harsha Cherukuri bdc090de64 Move community.general keycloak modules into keycloak collection 2026-05-28 13:14:54 -04:00