Before running OpenSearch you must run and configure a client in Keycloak.
There are 2 docker-compose
files in this repository, for running keycloak navigate to the keycloak/
folder and run:
docker-compose -f docker-compose-keycloak.yml up
This will run a PostgreSQL database on port 5432 and keycloak on localhost:8080.
Once the containers have started, navigate to http://localhost:8080/auth
in a web browser then click on Administration Console
and login with:
Username: admin
Password: Pa55w0rd
Once logged in you need to create a Client
.
- Click on
Clients
on the left menu - Click on
Create client
- Type in
Client ID: opensearch-dashboards-sso
with nameOpenSearch Dashboards SSO
Next
Save
- In
Valid redirect URIs
enter:http://localhost:5601/auth/openid/login
- In
Valid post logout redirect URIs
enter:http://localhost:5601
Save
- Click on
Users
on the left menu - Click on
Add user
- Fill out the form to create a new user (
user1
for an example username) - Click on
Create
- On the next screen (
User details
in the breadcrumbs) click on theCredentials
tab and give the user a password. - Go back to the
Details
tab and clickSave
In the root level of this repository run:
docker-compose up
Wait for startup and then navigate to https://localhost:5601
Login with the user created above
After completing the steps above the user is able to login/logout, but only has access to own_index
.
In order to extract backend roles from keycloak, there needs to be additional configuration on the client to ensure that keycloak is populating a field that matches the roles_key
that is configured in the authc
section of the security plugin's config.yml
file.
- Click on
Users
on the left menu - Click on desired user
- Navigate to
Role mapping
tab - Click on
Assign role
and map the user to the desired backend role - You can create new roles in the
Realm roles
section of the left menu