mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2026-11-21 14:48:50 +00:00
AMW-642 keycloak_identity_provider: add support for Do not store users from transient-users feature
This commit is contained in:
@@ -546,6 +546,51 @@
|
||||
- idp_hide_on_login_off_result.end_state.hideOnLogin == false
|
||||
- "'hide_on_login_page' not in (idp_hide_on_login_off_result.end_state.config | default({}))"
|
||||
|
||||
- name: keycloak_identity_provider — set doNotStoreUsers config option
|
||||
middleware_automation.keycloak.keycloak_identity_provider:
|
||||
realm: "{{ target_realm }}"
|
||||
alias: "{{ idp }}"
|
||||
config:
|
||||
doNotStoreUsers: "true"
|
||||
state: present
|
||||
register: idp_do_not_store_users_result
|
||||
|
||||
- name: Assert doNotStoreUsers is set correctly in end_state config
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- idp_do_not_store_users_result is changed
|
||||
- idp_do_not_store_users_result.end_state.config.doNotStoreUsers == "true"
|
||||
|
||||
- name: keycloak_identity_provider — set doNotStoreUsers idempotency check
|
||||
middleware_automation.keycloak.keycloak_identity_provider:
|
||||
realm: "{{ target_realm }}"
|
||||
alias: "{{ idp }}"
|
||||
config:
|
||||
doNotStoreUsers: "true"
|
||||
state: present
|
||||
register: idp_do_not_store_users_idempotent_result
|
||||
|
||||
- name: Assert doNotStoreUsers idempotency (no change)
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- idp_do_not_store_users_idempotent_result is not changed
|
||||
- idp_do_not_store_users_idempotent_result.end_state.config.doNotStoreUsers == "true"
|
||||
|
||||
- name: keycloak_identity_provider — disable doNotStoreUsers
|
||||
middleware_automation.keycloak.keycloak_identity_provider:
|
||||
realm: "{{ target_realm }}"
|
||||
alias: "{{ idp }}"
|
||||
config:
|
||||
doNotStoreUsers: "false"
|
||||
state: present
|
||||
register: idp_do_not_store_users_off_result
|
||||
|
||||
- name: Assert doNotStoreUsers can be toggled off
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- idp_do_not_store_users_off_result is changed
|
||||
- idp_do_not_store_users_off_result.end_state.config.doNotStoreUsers == "false"
|
||||
|
||||
- name: keycloak_clienttemplate — create client template
|
||||
middleware_automation.keycloak.keycloak_clienttemplate:
|
||||
realm: "{{ target_realm }}"
|
||||
|
||||
@@ -244,6 +244,12 @@ options:
|
||||
- Way to identify and track external users from the assertion.
|
||||
type: str
|
||||
|
||||
doNotStoreUsers:
|
||||
description:
|
||||
- If V(true), users authenticating through this identity provider will not be stored in the Keycloak database.
|
||||
- This requires the C(transient-users) feature to be enabled on the Keycloak server (available since Keycloak 23).
|
||||
type: bool
|
||||
|
||||
fromUrl:
|
||||
description:
|
||||
- IDP well-known OpenID Connect configuration URL.
|
||||
@@ -372,6 +378,25 @@ EXAMPLES = r"""
|
||||
attribute.name: roles
|
||||
syncMode: INHERIT
|
||||
|
||||
- name: Create OIDC identity provider with transient users (do not store users in database)
|
||||
middleware_automation.keycloak.keycloak_identity_provider:
|
||||
state: present
|
||||
auth_keycloak_url: https://auth.example.com
|
||||
auth_realm: master
|
||||
auth_username: admin
|
||||
auth_password: admin
|
||||
realm: myrealm
|
||||
alias: oidc-idp
|
||||
display_name: OpenID Connect IdP
|
||||
enabled: true
|
||||
provider_id: oidc
|
||||
config:
|
||||
fromUrl: https://the-idp.example.com/realms/idprealm/.well-known/openid-configuration
|
||||
clientAuthMethod: client_secret_post
|
||||
clientId: my-client
|
||||
clientSecret: secret
|
||||
doNotStoreUsers: true
|
||||
|
||||
- name: Create OIDC identity provider, authentication with credentials and advanced claim to group
|
||||
middleware_automation.keycloak.keycloak_identity_provider:
|
||||
state: present
|
||||
|
||||
Reference in New Issue
Block a user