Keycloak on Docker & First Setup
In this post, I would like to show you how to setup Keycloak on Docker.
First, What is Keycloak ?
Keycloak is an open source Identity and Access Management solution targeted towards modern applications and services.
Keycloak offers features such as Single-Sign-On (SSO), Identity Brokering and Social Login, User Federation, Client Adapters, an Admin Console, and an Account Management Console.
docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin quay.io/keycloak/keycloak:12.0.3
This will start Keycloak exposed on the local port 8080. It will also create an initial admin user with username
admin and password
First we’ll enter the initial admin user credentials. (user: admin, pass: admin)
A successful login will take us to the console and open up the default Master realm for us.
We need to create our custom Realm.
On the upper left upper corner, click the Add realm button.
You can give any name.
After created realm, we have to need roles for incoming users.
Created ‘Admin’ role details be like;
Also i created role as ‘User’ too.
Now we’ll navigate to the Clients page. And click the ‘Create’ button.
Our created ‘web-client’ client details;
After created client, we have to specify at least one ‘Valid Redirect URL’ that will use this client for authentication.
User — Credentials
After created user, in ‘Credential’ tab, we have to set password.
Notice that ‘Temporary’ field must be set OFF.
User — Role Mapping
After all these configurations, let’s check it is working properly;
First we need go back to client detail page, change the Access Type as ‘confidential’.
After save, ‘Credential’ tab will be appear. You can copy your secret for sending request.
Request must be like;