[JAVA] Install and configure Keycloak

environment

--JDK 8 or above --Installation is required in advance --Please also set the environment variable JAVA_HOME

Download and install

Download the [Standalone server distribution] ZIP file from the Official Page. Then just unzip it to a suitable local folder.

Start-up

Start with standalone.sh (standalone.bat on Windows) in the folder/binwhere you extractedKeycloak.

The default port number is 8080. Add the -Djboss.http.port option to change the port number.

Example of booting on port number 9000


$ cd bin
$ ./standalone.sh -Djboss.http.port=9000

Administrator name / password setting

Open http: // localhost: 9000 (the port number should be the one specified at startup) in a web browser, and in the [Administration Console] on the left side of the screen, enter the administrator user name and password (this time both admin). And click Create.

スクリーンショット 2018-10-21 12.13.57.png

If successful, [User Created] will be displayed.

スクリーンショット 2018-10-21 12.22.58.png

Click the [Administration Console] part to display the administrator login screen.

スクリーンショット 2018-10-21 12.24.35.png

Enter the set user name and password and click [Log In].

Creating a realm

Move the mouse cursor around [Master] on the upper left of the screen and click [Add realm] that appears.

スクリーンショット 2018-10-21 12.26.39.png

Enter an arbitrary realm name (hello-api in this case) in [Name] and click [Create].

スクリーンショット 2020-12-15 13.47.45.png

User settings

Click Users on the left side of the screen, then click Add user on the right side of the screen.

スクリーンショット 2020-12-15 13.48.30.png

Enter user in Username and click Save.

スクリーンショット 2020-12-15 13.49.15.png

Open the Credentials tab, set Password and Password Confirmation (both user this time), set Temporary to OFF and click Set Password.

スクリーンショット 2020-12-15 13.50.28.png

Scope setting

Click Client Scopes on the left side of the screen, then click Create on the right side of the screen.

スクリーンショット 2020-12-15 13.55.41.png

In Name, enter the scope name (in this case hello) and click Save.

スクリーンショット 2020-12-15 13.56.10.png

Client settings

Click Clients on the left side of the screen, then click Create on the right side of the screen.

Client_id in [Client ID](this time hello-client) Then enter the client's root URL (in this case http: // localhost: 8080) in the Root URL and click Save.

スクリーンショット 2020-12-15 13.57.55.png

Open the [Settings] tab, set [Access Type] to [confidential], and set [Valid Redirect URIs] to the client redirect URL (this time http: // localhost: 8080/login/oauth2/code/todo-client). Type it in and click Save.

スクリーンショット 2020-12-15 13.58.51.png

スクリーンショット 2020-12-15 13.34.37.png

Open the Client Scopes tab, select the scope you want to add (in this case hello) in Default Client Scopes and click Add selected. Success if the selected scopes are moved to Assigned Default Client Scopes.

スクリーンショット 2020-12-15 14.00.08.png

Recommended Posts

Install and configure Keycloak
Install and configure jenv on macOS
Install buildah and container-selinux
Difference between bundle and bundle install
[Virtualization] Install VMware and build Ubuntu (20.04)
Install Java and Tomcat with Ansible
Install JDK and JRE on Ubuntu 16.10
How to install and configure the monitoring tool "Graphite" on Ubuntu
Install Xcode and use Hello Swift!
About go get and go install from Go1.16
Install Java 9 on windows 10 and CentOS 7
Challenge to install WSL2 and docker
Install docker and docker-compose on Alpine Linux
Install Webpacker and Yarn to run Rails
[Memo] Difference between bundle install and update
Remove wine3.0 with ubuntu18.04LTS and install wine5.0 (winehq)
Download and install Eclipse (Java) (Mac version)
Install Docker and create Java runtime environment