Forked from dteleguin/beercloak.
TL;DR
Use ./start.sh
to run the project. (You will need certificates.)
Go to id.keycloak.test/auth.
BeerCloak is a collection of different techniques for building custom admin resources in Keycloak.
BeerEntity
JPA entity + Liquibase changelogBeerResource
realm REST resource with CRUD operations & more- Authorization:
- roles:
view-beer
andmanage-beer
- automatically created for each existing realm
- automatically created for each newly added realm
- automatically included into the master
admin
role
- roles:
- GUI extensions to the admin console
- Keycloak 22.0
- Java 17
- something to generate TLS certificates (
mkcert
oropenssl
)
-
Add the test domain to your hosts file (
/etc/hosts
)127.0.0.1 id.keycloak.test
-
Generate the certificates with
mkcert
mkcert -install -cert-file cert.pem -key-file cert-key.pem id.keycloak.test 127.0.0.1
-
Rename the certificate and key to
cert.pem
andcert-key.pem
respectively. -
Update permissions for the key
chmod 755 cert-key.pem
-
Update
docker-compose.yml
>KC_HOSTNAME
to:KC_HOSTNAME: id.keycloak.test
If you don't care about the certificate being valid, you can use openssl
to generate one.
-
Generate the certificates
openssl req -newkey rsa:2048 -nodes -keyout cert-key.pem -x509 -days 3650 -out cert.pem
-
Update permissions for the key
chmod 755 cert-key.pem
-
Update
docker-compose.yml
>KC_HOSTNAME
to:KC_HOSTNAME: localhost
Execute start.sh
to build the extension and run Keycloak with Maildev.
- Run
mvn install
- Copy
target/beercloak-XXX.jar
into Keycloak's/opt/keycloak/providers
directory.
Run Keycloak and log into the admin console. You should be able to access the "Beer" menu item.