Skip to content

Commit 26316dd

Browse files
committed
#222: add support for local providers to be uploaded
1 parent d87c8ca commit 26316dd

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

molecule/quarkus/converge.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
version: 24.0.4 # optional
4040
# username: myUser # optional
4141
# password: myPAT # optional
42+
# - id: my-static-theme
43+
# local_path: /tmp/my-static-theme.jar
4244
keycloak_quarkus_policies:
4345
- name: "xato-net-10-million-passwords.txt"
4446
url: "https://github.com/danielmiessler/SecLists/raw/master/Passwords/xato-net-10-million-passwords.txt"

roles/keycloak_quarkus/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,22 @@ Role Defaults
178178
|:---------|:------------|:--------|
179179
|`keycloak_quarkus_providers`| List of provider definitions; see below | `[]` |
180180

181+
Providers support different sources:
182+
183+
* `url`: http download for SPIs not requiring authentication
184+
* `maven`: maven download for SPIs hosted publicly on Apache Maven Central or private Maven repositories like Github Maven requiring authentication
185+
* `local_path`: static SPIs to be uploaded
186+
181187
Provider definition:
182188

183189
```yaml
184190
keycloak_quarkus_providers:
185-
- id: http-client # required
186-
spi: connections # required if neither url nor maven are specified
191+
- id: http-client # required; "{{ id }}.jar" identifies the file name on RHBK
192+
spi: connections # required if neither url, local_path nor maven are specified; required for setting properties
187193
default: true # optional, whether to set default for spi, default false
188194
restart: true # optional, whether to restart, default true
189195
url: https://.../.../custom_spi.jar # optional, url for download via http
196+
local_path: my_theme_spi.jar # optional, path on local controller for SPI to be uploaded
190197
maven: # optional, for download using maven
191198
repository_url: https://maven.pkg.github.com/OWNER/REPOSITORY # optional, maven repo url
192199
group_id: my.group # optional, maven group id

roles/keycloak_quarkus/meta/argument_specs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ argument_specs:
391391
default: 10
392392
type: 'int'
393393
keycloak_quarkus_providers:
394-
description: "List of provider definition dicts: { 'id': str, 'spi': str, 'url': str, 'default': bool, 'properties': list of key/value TODO:add maven}"
394+
description: "List of provider definition dicts: { 'id': str, 'spi': str, 'url': str, 'local_path': str, 'maven': { 'repository_url': str, 'group_id': str, 'artifact_id': str, 'version': str, 'username': str, optional, 'password': str, optional }, 'default': bool, 'properties': list of key/value }"
395395
default: []
396396
type: "list"
397397
keycloak_quarkus_supported_policy_types:

roles/keycloak_quarkus/tasks/install.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,17 @@
256256
when: item.maven is defined
257257
no_log: "{{ item.maven.password is defined and item.maven.password | length > 0 | default(false) }}"
258258

259+
- name: "Upload local SPIs"
260+
ansible.builtin.copy:
261+
src: "{{ item.local_path}}"
262+
dest: "{{ keycloak.home }}/providers/{{ item.id }}.jar"
263+
owner: "{{ keycloak.service_user }}"
264+
group: "{{ keycloak.service_group }}"
265+
mode: '0640'
266+
become: true
267+
loop: "{{ keycloak_quarkus_providers }}"
268+
when: item.local_path is defined
269+
259270
- name: Ensure required folder structure for policies exists
260271
ansible.builtin.file:
261272
path: "{{ keycloak.home }}/data/{{ item | lower }}"

roles/keycloak_quarkus/tasks/prereqs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
ansible.builtin.assert:
6262
that:
6363
- item.id is defined and item.id | length > 0
64-
- (item.spi is defined and item.spi | length > 0) or (item.url is defined and item.url | length > 0) or (item.maven is defined and item.maven.repository_url is defined and item.maven.repository_url | length > 0 and item.maven.group_id is defined and item.maven.group_id | length > 0 and item.maven.artifact_id is defined and item.maven.artifact_id | length > 0)
64+
- (item.spi is defined and item.spi | length > 0) or (item.url is defined and item.url | length > 0) or (item.maven is defined and item.maven.repository_url is defined and item.maven.repository_url | length > 0 and item.maven.group_id is defined and item.maven.group_id | length > 0 and item.maven.artifact_id is defined and item.maven.artifact_id | length > 0) or (item.local_path is defined and item.local_path | length > 0)
6565
quiet: true
66-
fail_msg: "Providers definition is incorrect; `id` and one of `spi`, `url`, or `maven` are mandatory. `key` and `value` are mandatory for each property"
66+
fail_msg: "Providers definition is incorrect; `id` and one of `spi`, `url`, `local_path`, or `maven` are mandatory. `key` and `value` are mandatory for each property"
6767
loop: "{{ keycloak_quarkus_providers }}"
6868

6969
- name: "Validate policies"

0 commit comments

Comments
 (0)