A pre-configured Docker Compose environment to demonstrate how to use Single Sign-On (SSO) on Liferay 7.4.13 U55 using Keycloak as an OpenID Connect Provider (OIDC).
- Docker 19+
4th April 2024
- Updated Liferay version to Liferay 7.4.13 U112
21th December 2020
-
Updated Liferay version to Liferay 7.4.13 U55 and added
netcat
to the image. -
The jboss/keycloak image does not seem to work on the Apple M1 chip, so this has been substituted with the quay.io/keycloak/keycloak image instead. This has lead to some configuration changes as well.
-
The client secret can no longer be null / unset. This has been updated to be
liferay
. You can change this value to what ever you wish in the osgi/configs files. -
Updated keycloak configuration to reflect changes, i.e. OpenID Connect Urls and the environment variables for the initial admin account.
Because Liferay communicate in the backend with Keycloak and also redirect the end user to it, you need to align hostname and port between Docker Compose and your host.
Thus, with this default configuration, you need to add sso
as possible host from your localhost in /etc/hosts
and be sure that the port 8080
is available.
If you want to test this setup with other Liferay editions / versions, you can change the Liferay base image in docker-compose.yml
.
- Liferay: http://localhost
- Keycloak: http://sso:8080
- SMTP: http://localhost:5000
- Run
docker-compose up
- When everything is ready, go http://localhost
- Click on
Sign in
, thenOpenID Connect
andSign in
again where you should seeKeycloak
as the onlyOpenId Connect Provider Name
in the list. - You should be redirected to http://sso:8080 (with more parameters, of course)
- Click
Register
to add a new user - Fill out the form and save
- You should be redirected to Liferay where you're asked to verify your email
- Go to http://localhost:5000 and check for new messages
- You should have received the confirmation code
- Copy the code and past it on Liferay
- Now you should be logged in as your new user
Go to http://sso:8080 and use the default credentials admin
:admin
.
You can do it through some development. You'll find an example and more information about this in this repository.
Yes, you could use a Fragment such as this one: https://github.com/lgdd/openid-connect-single-button.
By default, in docker-compose.yml
, the port has not been forwarded to localhost. So you have to update the file, and do something like:
db:
image: mysql:8
ports:
- "3306:3306"
Number on the left is the one you're forwarding to your localhost, so make sure it's not already taken and if so, choose another one.
Since macOS Monterey, port 5000
is used by Content Center, more specially by a AirPlay Receiver.
Either disable the AirPlay Receiver via the System Preferences or change the port defined in the docker compose file for smtp4dev to another port, for example 5050
.