Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/keycloak_clientsecret_info/tasks/main.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: Create realm
7 community.general.keycloak_realm: "{{ auth_args | combine(call_args) }}"
8 vars:
9 call_args:
10 id: "{{ realm }}"
11 realm: "{{ realm }}"
12 state: present
13
14 - name: Keycloak Client
15 community.general.keycloak_client: "{{ auth_args | combine(call_args) }}"
16 vars:
17 call_args:
18 realm: "{{ realm }}"
19 client_id: "{{ client_id }}"
20 state: present
21 register: client
22
23 - name: Keycloak Client fetch clientsecret by client_id
24 community.general.keycloak_clientsecret_info: "{{ auth_args | combine(call_args) }}"
25 vars:
26 call_args:
27 realm: "{{ realm }}"
28 client_id: "{{ client_id }}"
29 register: fetch_by_client_id_result
30
31 - name: Assert that the client secret was retrieved
32 assert:
33 that:
34 - fetch_by_client_id_result.clientsecret_info.type == "secret"
35 - fetch_by_client_id_result.clientsecret_info.value | length >= 32
36
37 - name: Keycloak Client fetch clientsecret by id
38 community.general.keycloak_clientsecret_info: "{{ auth_args | combine(call_args) }}"
39 vars:
40 call_args:
41 realm: "{{ realm }}"
42 id: "{{ client.end_state.id }}"
43 register: fetch_by_id_result
44
45 - name: Assert that the same client secret was retrieved both times
46 assert:
47 that:
48 - fetch_by_id_result.clientsecret_info.value == fetch_by_client_id_result.clientsecret_info.value