Alternative languages:
Leia a página em Português Brasileiro
This project contains Keycloak, which is necessary to set up the Jamie API and Jamie UI projects.
The Jamie UI project already contains a docker-compose.yaml
file, which will make easier to run Keycloak in local environment.
You can check the command to start the docker compose Keycloak service in the repository of the previous.
Open the terminal in the Jamie Auth Service project directory. Then, run the Docker command:
docker build -t keycloak .
docker run -d -p 8080:8080 --name keycloak keycloak
In localhost:8080
, a screen similar to the following will load:
Click on Administration Console
, and a login screen will open. Enter the following credentials:
Username: admin
Password: admin
Afterward, you will need to create the realm
. To do this, click on the area marked in red in the image. Under the "Master" section, you will find the option to create a new Realm.
Upon opening this option, the screen will display:
In Realm name, type jamie
, then click create. On the initial Keycloak screen, where you clicked to create a Realm, the newly created jamie
Realm will appear. Enter it.
Next, in the side menu, click on Clients, and a screen similar to the following will open:
Click on Create Client, and we will create two clients, one for Jamie UI and another for Jamie API.
Fill in the fields with the following data:
- Client ID: jamie
- Name: Jamie UI
In ACCESS Settings, add the following:
-
Valid Redirect URIs:
-
Valid post logout redirect URIs:
-
Web Origins:
In Capability config:
Uncheck:
- Client authentication
- Authorization
Enable(ON):
- Standard flow
- Direct access grants
Fill in the fields with the following data:
- Client ID: jamie-api
In ACCESS Settings, add the following:
-
Root URL:
-
Home URL:
-
Admin URL:
In Capability config:
Enable(ON):
- Client authentication
- Authorization
Uncheck:
- Standard flow
- Direct access grants
Now, we need to configure the Realm Roles. Four Realm roles will be created: reader
, editor
, manager
, admin
(optional). In the side menu, click on Realm Roles, and a screen similar to the following will open. Click on Create Role.
Fill in the fields with the following data:
- Role name: reader
- Save
- Role name: editor
- In Action, click on Add associated roles, then click on the
reader
role we created, and click on Assign - Save
- Role name: manager
- In Action, click on Add associated roles, then click on the
reader
andeditor
roles we created, and click on Assign - Save
- Role name: admin
- In Action, click on Add associated roles, then click on the
reader
,editor
, andmanager
roles we created, and click on Assign - Save
In the side menu, under Users, click on Add user, as shown in the image below:
In Username, type a username you desire, and enable Email verified. Adding your email is optional.
Next, click on Credentials and Set password.
Enter the password and password confirmation, and disable the Temporary field. Then, click on Role mapping, which is next to Credentials. Click on admin
, then click on Assign.
With this, when you enter Jamie UI, you'll need to enter the username and password you created.
Next, follow the instructions in the README of Jamie API or Jamie UI.