Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 2.37 KB

README.md

File metadata and controls

54 lines (43 loc) · 2.37 KB

Keycloak realm configuration

Introduction

This folder contains a configuration file for a demo realm that is used by the OIDC Sample.

How to use

  1. Install Docker on your machine
  2. Run the docker run command like below and insert the absolute path to this repo folder.

Docker run command

docker run -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin \
    -e KEYCLOAK_IMPORT=/tmp/config/malis.io-realm.json -v {replace_with_repo_path}:/tmp/config -p 8080:8080 jboss/keycloak:6.0.1

Example with replaced path:

docker run -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin \
    -e KEYCLOAK_IMPORT=/tmp/config/malis.io-realm.json -v /Users/malis.io/dev/oidc-sample/keycloak:/tmp/config -p 8080:8080 jboss/keycloak:6.0.1

Using Keycloak

After successfully running the command above you have a fully working OIDC Provider setup with a configured Realm ready for use.

If you haven't changed the port in the run command, keycloak listens on http://localhost:8080. You can log in into the Administration Console with

user:admin
password:admin

Navigate through Keycloak to get an overview of the configured realm malis.io. Refer to the official keycloak documentation, if you need further assistance.

The configured realm

There is a preconfigured realm malis.io, which has a configured client oidc-spring-boot with all redirect URLs setup ready to go, if you keep the default configuration for the Spring Boot App. There is a preconfigured user which you can use to log in via your OIDC client:

user:[email protected]
password:demo

Troubleshooting

If you get an error like the following when the keycloak docker container is starting up:

Caused by: java.io.FileNotFoundException: /tmp/config/malis.io-realm.json (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at org.keycloak.services.resources.KeycloakApplication.importRealms(KeycloakApplication.java:368)
	... 40 more

Check if you correctly replaced the {replace_with_repo_path} variable in the docker run command.