1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00
community.general/changelogs/fragments
patchback[bot] bfcdeeab91
[PR #11468/80d21f2a backport][stable-12] keycloak_realm_key: add full support for all Keycloak key providers (#11519)
keycloak_realm_key: add full support for all Keycloak key providers (#11468)

* feat(keycloak_realm_key): add support for auto-generated key providers

Add support for Keycloak's auto-generated key providers where Keycloak
manages the key material automatically:

- rsa-generated: Auto-generates RSA signing keys
- hmac-generated: Auto-generates HMAC signing keys
- aes-generated: Auto-generates AES encryption keys
- ecdsa-generated: Auto-generates ECDSA signing keys

New algorithms:
- HMAC: HS256, HS384, HS512
- ECDSA: ES256, ES384, ES512
- AES: AES (no algorithm parameter needed)

New config options:
- secret_size: For HMAC/AES providers (key size in bytes)
- key_size: For RSA-generated provider (key size in bits)
- elliptic_curve: For ECDSA-generated provider (P-256, P-384, P-521)

Changes:
- Make private_key/certificate optional (only required for rsa/rsa-enc)
- Add provider-algorithm validation with clear error messages
- Fix KeyError when managing default realm keys (issue #11459)
- Maintain backward compatibility: RS256 default works for rsa/rsa-generated

Fixes: #11459

* fix: address sanity test failures

- Add 'default: RS256' to algorithm documentation to match spec
- Add no_log=True to secret_size parameter per sanity check

* feat(keycloak_realm_key): extend support for all Keycloak key providers

Add support for remaining auto-generated key providers:
- rsa-enc-generated (RSA encryption keys with RSA1_5, RSA-OAEP, RSA-OAEP-256)
- ecdh-generated (ECDH key exchange with ECDH_ES, ECDH_ES_A128KW/A192KW/A256KW)
- eddsa-generated (EdDSA signing with Ed25519, Ed448 curves)

Changes:
- Add provider-specific elliptic curve config key mapping
  (ecdsaEllipticCurveKey, ecdhEllipticCurveKey, eddsaEllipticCurveKey)
- Add PROVIDERS_WITHOUT_ALGORITHM constant for providers that don't need algorithm
- Add elliptic curve validation per provider type
- Update documentation with all supported algorithms and examples
- Add comprehensive integration tests for all new providers

This completes full coverage of all Keycloak key provider types.

* style: apply ruff formatting

* feat(keycloak_realm_key): add java-keystore provider and update_password

Add support for java-keystore provider to import keys from Java
Keystore (JKS or PKCS12) files on the Keycloak server filesystem.

Add update_password parameter to control password handling for
java-keystore provider:
- always (default): Always send passwords to Keycloak
- on_create: Only send passwords when creating, preserve existing
  passwords when updating (enables idempotent playbooks)

The on_create mode sends the masked value ("**********") that Keycloak
recognizes as "preserve existing password", matching the behavior when
re-importing an exported realm.

Replace password_checksum with update_password - the checksum approach
was complex and error-prone. The update_password parameter is simpler
and follows the pattern used by ansible.builtin.user module.

Also adds key_info return value containing kid, certificate fingerprint,
status, and expiration for java-keystore keys.

* address PR review feedback

- Remove no_log=True from secret_size (just an int, not sensitive)
- Add version_added: 12.4.0 to new parameters and return values
- Remove "Added in community.general 12.4.0" from description text
- Consolidate changelog entries into 4 focused entries
- Remove bugfix from changelog (now in separate PR #11470)

* address review feedback from russoz and felixfontein

- remove docstrings from module-local helpers
- remove line-by-line comments and unnecessary null guard
- use specific exceptions instead of bare except Exception
- use module.params["key"] instead of .get("key")
- consolidate changelog into single entry
- avoid "complete set" claim, reference Keycloak 26 instead

* address round 2 review feedback

- Extract remove_sensitive_config_keys() helper (DRY refactor)
- Simplify RS256 validation to single code path
- Add TypeError to inner except in compute_certificate_fingerprint()
- Remove redundant comments (L812, L1031)
- Switch .get() to direct dict access for module.params

(cherry picked from commit 80d21f2a0d)

Co-authored-by: Ivan Kokalovic <67540157+koke1997@users.noreply.github.com>
2026-02-18 18:36:48 +01:00
..
.keep
5117-maven-artifact-snapshot-resolution.yml [PR #11501/ed7ccbe3 backport][stable-12] maven_artifact: resolve SNAPSHOT to latest using snapshot metadata block (#11508) 2026-02-14 21:14:36 +01:00
11430-fix-keycloak-client-diff-for-flow-overrides.yml [PR #11455/af4dbafe backport][stable-12] keycloak_client: fix diff for keycloak client auth flow overrides (#11477) 2026-02-07 16:34:29 +01:00
11453-keycloak-client-protocol-mapper-ids.yml [PR #11454/b236772e backport][stable-12] keycloak_client: remove id's as change from diff for protocol mappers (#11469) 2026-02-05 17:29:29 +01:00
11486-seport-dccp-sctp.yaml [PR #11486/c05c3133 backport][stable-12] seport: Add support for dccp and sctp protocols (#11509) 2026-02-14 21:14:44 +01:00
11488-mh-ensure-compatibiliy-with-module-tests.yml [PR #11488/5e0fd120 backport][stable-12] ModuleHelper: ensure compatibility with ModuleTestCase (#11518) 2026-02-18 07:26:47 +01:00
11492-python_requires_info.yml [PR #11495/88adca3f backport][stable-12] python_requirements_info: use importlib.metadata when available (#11496) 2026-02-11 07:12:04 +01:00
11503-keycloak-group-search-optimization.yml [PR #11503/85a0deee backport][stable-12] keycloak module utils: group search optimization (#11511) 2026-02-14 21:14:52 +01:00
11504-redfish-info-add-results-to-return.yml [PR #11504/8729f563 backport][stable-12] Update check_availability_service to return data instead of boolean (#11510) 2026-02-14 21:14:07 +01:00
fix-nsupdate-keyring.yml [PR #11461/4bbedfd7 backport][stable-12] nsupdate: fix missing keyring initialization without TSIG auth (#11516) 2026-02-18 06:57:33 +01:00
keycloak-client-add-missing-fields.yml [PR #11473/df6d6269 backport][stable-12] keycloak_client: add valid_post_logout_redirect_uris and backchannel_logout_url (#11475) 2026-02-07 16:34:46 +01:00
keycloak-realm-key-generated-providers.yml [PR #11468/80d21f2a backport][stable-12] keycloak_realm_key: add full support for all Keycloak key providers (#11519) 2026-02-18 18:36:48 +01:00
keycloak-realm-key-keyerror-bugfix.yml [PR #11470/10681731 backport][stable-12] keycloak_realm_key: handle missing config fields for default keys (#11478) 2026-02-07 16:34:22 +01:00
keycloak-url-encode-query-params.yml [PR #11472/c41de53d backport][stable-12] keycloak: URL-encode query parameters for usernames with special characters (#11474) 2026-02-06 20:36:02 +01:00