A set of labs to test Keycloak (or RH-SSO) configurations and functionalities.

Actually, until this moment, these labs were tested only with RH-SSO 7.3.

Prerequisites

To follow the instructions here, you will need a Linux or macOS shell in your hands.
Also, you will need Docker Compose and some other tools installed: (read config.sample to know about).

All lab-* functions used in these labs are written in Bash. They are available in one unique file: functions.sh.

Before switching the labs (by runnint the lab-set function) stop all the containers running (and remove the volumes) in the last lab execution.

Lab 0 - Start Keycloak without any modified configuration

$ source ./functions.sh
$ lab-up

Then, open http://localhost:8080. Open Administration Console. Log in with the user and password configured inside configs/0/docker-compose.yml.

To stop the server, type Ctrl+C in the running console.

Lab 1 - Start Keycloak using PostgreSQL to manage its database

$ lab-set 1
$ lab-up -d
$ lab-pg-bash
root@388ddadd36d4:/# psql -U kcuser kcdb
psql (12.3 (Debian 12.3-1.pgdg100+1))
Type "help" for help.

kcdb=# \l
                              List of databases
   Name    | Owner  | Encoding |  Collate   |   Ctype    | Access privileges
-----------+--------+----------+------------+------------+-------------------
 kcdb      | kcuser | UTF8     | en_US.utf8 | en_US.utf8 |
 postgres  | kcuser | UTF8     | en_US.utf8 | en_US.utf8 |
 template0 | kcuser | UTF8     | en_US.utf8 | en_US.utf8 | =c/kcuser        +
           |        |          |            |            | kcuser=CTc/kcuser
 template1 | kcuser | UTF8     | en_US.utf8 | en_US.utf8 | =c/kcuser        +
           |        |          |            |            | kcuser=CTc/kcuser
(4 rows)

kcdb=# \d+
                                 List of relations
 Schema |             Name              | Type  | Owner  |    Size    | Description
--------+-------------------------------+-------+--------+------------+-------------
 public | admin_event_entity            | table | kcuser | 8192 bytes |
 public | associated_policy             | table | kcuser | 0 bytes    |
 public | authentication_execution      | table | kcuser | 8192 bytes |
 public | authentication_flow           | table | kcuser | 16 kB      |
 public | authenticator_config          | table | kcuser | 16 kB      |
 public | authenticator_config_entry    | table | kcuser | 16 kB      |
 public | broker_link                   | table | kcuser | 8192 bytes |
 public | client                        | table | kcuser | 16 kB      |
...
...

Type Ctrl+D two (2) times to return to your shell.

$ lab-down -v

Lab 2 - Start Keycloak using Microsoft SQL Server to manage its database

$ lab-set 2
$ lab-up -d
$ lab-sqlcmd
1> select name from sys.sysdatabases;
2> go
name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb

(4 rows affected)
1> select table_name from master.information_schema.tables where table_type='BASE TABLE' order by table_name;
2> go
table_name
--------------------------------------------------------------------------------------------------------------------------------
ADMIN_EVENT_ENTITY
ASSOCIATED_POLICY
AUTHENTICATION_EXECUTION
AUTHENTICATION_FLOW
AUTHENTICATOR_CONFIG
AUTHENTICATOR_CONFIG_ENTRY
BROKER_LINK
CLIENT
...