Skip to content

Commit

Permalink
CI: create two versions of theme: (1) with and (2) w/o forms login hi…
Browse files Browse the repository at this point in the history
…dden
  • Loading branch information
hwo-wd committed Aug 2, 2024
1 parent 8baf041 commit 3dfe3a2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
if: github.event.head_commit.author.name != 'actions'
steps:
- uses: actions/checkout@v4
- name: Create two versions of theme
run: |
cp -r theme/keycloak-theme-world-direct theme/keycloak-theme-world-direct-without-forms-login
sed -i '/kcFormAdditionalClass=/c\kcFormAdditionalClass=displayNone' ./theme/keycloak-theme-world-direct-without-forms-login/login/theme.properties
sed -i '/kcFormAdditionalClass/d' theme/keycloak-theme-world-direct/login/theme.properties
- name: Create jar artifact
run: |
zip -r keycloak-theme-world-direct.jar *
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
![Login theme](img/login_theme.png)

**Note**: as you can see, this theme does not feature the usual user/password login fields, due to:
The final jar version ships with two versions of this theme[^1]:

* we are logging in using ADFS
* should the ADFS be down, the root user can still login manually be running `$("#kc-form-login").classList.remove('displayNone')` in the browser's console
1. `keycloak-theme-world-direct-without-forms-login`: with the login form hidden as shown in the screenshot above
* should the ADFS be down for whatever reason, form login (e.g. for the root user) is still possible via running `$("#kc-form-login").classList.remove('displayNone')` in the browser's console
2. `keycloak-theme-world-direct`: shows the usual login form, also features social providers

[^1]: created in the `Create two versions of theme` step in [ci.yaml](.github/workflows/ci.yaml#:24)

## Development

Expand All @@ -18,13 +21,13 @@
podman-compose up -d
```

* Next we need to set up a user which we can use for login purposes[^1]:
* Next we need to set up a user which we can use for login purposes[^2]:
navigate to <http://localhost:8080/admin/master/console/#/adfs-mock/users>, login via `admin`/`dev_only` and...
* ... create a new user; for example: `Username`: `aaa` and hit `Save`
* ... give this new user a password by navigating to the `Credentials` tab > `Set password` and set a password (e.g., Password/Password confirmation: `aaa`, Temporary: `Off`)
* For theme development, navigate to <http://localhost:8080/realms/theme-dev/account/>, by clicking on the `ADFS mock Login` button, you can use the previously set up user for logging in

[^1]: This step is required since users are not exported as part of the realm export json schema.
[^2]: This step is required since users are not exported as part of the realm export json schema.

### Realm Details

Expand All @@ -42,7 +45,7 @@ The import will import two realms:

* Download the jar file and deploy it by either following the [Keycloak](https://www.keycloak.org/docs/latest/server_development/#deploying-themes) guide:
> To deploy the archive to Keycloak, add it to the `providers/` directory of Keycloak and restart the server if it is already running. When you are working with production-optimized images, you might want to invoke `kc.sh build` prior to restarting Keycloak
* To reference this theme, navigate to your realm > `Realm Settings` > `Themes` and choose `keycloak-theme-world-direct` as your `Login Theme`; *optionally* you can also navigate to `Realm Settings` > `Localization` and enable `Internationalization` and set `Supported locales` to `German` and `English` w/ `German` as the `Default locale`.
* To reference this theme, navigate to your realm > `Realm Settings` > `Themes` and choose `keycloak-theme-world-direct` or `keycloak-theme-world-direct-without-forms-login` as your `Login Theme`; *optionally* you can also navigate to `Realm Settings` > `Localization` and enable `Internationalization` and set `Supported locales` to `German` and `English` w/ `German` as the `Default locale`.
* For production purposes open a PR by changing the corresponding version at <https://github.com/world-direct/rhbk/blob/main/src/ansible/group_vars/asp.yaml#L10>

## Issues & Contributions
Expand Down
2 changes: 2 additions & 0 deletions src/theme/keycloak-theme-world-direct/login/theme.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ locales=en,de
# re-use base style, custom style comes last, thus having highest priority
styles=css/styles.css css/login.css css/custom.css

# this line will be altered in [ci.yaml](.github/workflows/ci.yaml#:24) where 2 versions of this theme are created: one with the forms login hidden, the other one with said form shown
# for development purposes feel free to comment/uncomment this line to see the effects it has on the final product
kcFormAdditionalClass=displayNone

# https://www.keycloak.org/docs/latest/server_development/#custom-identity-providers-icons
Expand Down

0 comments on commit 3dfe3a2

Please sign in to comment.