Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse metadata for SAML/OIDC IdP only for autoUpdate #282

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion roles/keycloak/tasks/blocks/configure_idps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
providerId: "{{ item[1].data.providerId }}"
status_code: 200
register: idp_result
when: item[1].data.config.autoUpdate == "true" or (item[1].metadataUrl is defined and new_idp)

- name: "Setup saml IdP {{ item[1].data.alias }}"
- name: "Setup autoUpdate {{ item[1].providerId }} IdP {{ item[1].data.alias }}"
uri:
url: "{{ keycloak_proxy_host }}/admin/realms/{{ item[0].name }}/identity-provider/instances{% if new_idp %}{% else %}/{{ item[1].data.alias }}{% endif %}"
method: "{% if new_idp %}POST{% else %}PUT{% endif %}"
Expand All @@ -41,6 +42,20 @@
body:
"{{ { 'config': idp_result.json } | combine( item[1].data, recursive=True ) }}"
status_code: "{% if new_idp %}201{% else %}204{% endif %}"
when: item[1].data.config.autoUpdate == "true" or (item[1].metadataUrl is defined and new_idp)

- name: "Setup no autoUpdate {{ item[1].providerId }} IdP {{ item[1].data.alias }}"
uri:
url: "{{ keycloak_proxy_host }}/admin/realms/{{ item[0].name }}/identity-provider/instances{% if new_idp %}{% else %}/{{ item[1].data.alias }}{% endif %}"
method: "{% if new_idp %}POST{% else %}PUT{% endif %}"
body_format: json
headers:
Authorization: "Bearer {{ tokens.json.access_token }}"
body:
"{{ item[1].data }}"
status_code: "{% if new_idp %}201{% else %}204{% endif %}"
when: item[1].metadataUrl is undefined or ( item[1].data.config.autoUpdate != "true" and !new_idp)

tags:
- "keycloak:config:realm:idps"
- "keycloak:config:realm:oidc_idps"
Expand Down