docker run \
-d \
-e KEYCLOAK_USER=admin \
-e KEYCLOAK_PASSWORD=admin \
--name keycloak-demo \
-p 8081:8080 \
jboss/keycloak:3.0.0.Final
Browse to http://localhost:8081/auth
Goto realm -> Clients -> Create -> Import -> Select demo.json
After the import goto Clients -> demo -> credentials and copy the client secret.
We'll need this for the application.yml
in a few minutes.
You need to set firstname and lastname (e.g. Theo Tester) since this will be used in
the app as the principal.name
by default.
Set a password on the credentials tab -> use "test", temporary: off then click "reset password".
Now we're ready with keycloak.
Install the spring boot cli
spring run hello-oauth.groovy
You'll be redirected to the Keycloak login. After login you get back to the application and see your greeting.
You should see something like: Hello Theo Tester
That's it.
Have fun!
Cheers, Thomas