OPCP - How to use the APIs and obtain the credentials
Objective
OPCP integrates a centralized authentication with Keycloak. It is therefore necessary to configure the OpenStack CLI so that it uses Keycloak as the identity provider (Identity Provider).
This guide describes the steps required to configure Keycloak and the OpenStack CLI to allow authentication via Keycloak.
Requirements
- Be an administrator of the OPCP infrastructure and have access to the administration interface (admin.dashboard).
- Have access to the Keyloack admin interface.
- Have a user with sufficient rights to log in to Horizon on the OPCP offer.
Instructions
Creating a Keycloak client for the OpenStack CLI
A dedicated Keycloak client is required to allow the OpenStack CLI to securely communicate with the Keycloak server.
Steps
1. Log in to the Keycloak administration interface
- Log in to your Keycloak instance and select the realm in which the OpenStack users are defined.
2. Create a new client
- Go to the
Clientssection and click onCreate a client. - Enter a Client ID, for example:
- Click on
Next.
3. Enable client authentication
- Enable Client Authentication (set to ON).
- Click on
Next, then onSave.
4. Configure scopes (Client Scopes)
- Open the
Client Scopestab. - Select the scope named:
- Click on
Configure a new mapper.
5. Add a user group attribute mapper
- Choose the mapper type aggregated-user-group-attribute-mapper.
- Configure the following fields:
| Field | Value |
|---|---|
| Name | projects |
| User Attribute | project |
| Token Claim Name | projects |
- Click on
Save.
6. Retrieve the client credentials
- Go to the
Credentialstab of the client you just created. - Copy and securely store the Client Secret — it will be needed when configuring the OpenStack CLI.
Configuration of the OpenStack CLI
Once the Keycloak client is created, the OpenStack CLI must be configured to use this client as the OIDC (OpenID Connect) identity provider.
Steps
1. Install the OpenStack CLI tools
If not already done:
2. Set environment variables for Keycloak authentication
Example:
Tip
You can use the following script to easily generate the openrc.sh configuration file:
Tip: Proxy configuration
If you are using a proxy to access your service, you must configure your environment variables to take this proxy into account.
To do this, add the following commands lines:
Configuration verification
You can test your configuration using a few simple commands:
If these commands return results, the Keycloak ↔ OpenStack integration is correctly configured.
Troubleshooting
| Problem | Possible cause | Solution |
|---|---|---|
Invalid client credentials | Wrong or missing Client Secret | Check the secret in the Credentials tab of the Keycloak client |
Unauthorized | The user is not associated with the correct group or project | Check the project attributes of the user in Keycloak |
OIDC discovery failed | Wrong URL in DISCOVERY_ENDPOINT | Make sure it points to the correct Keycloak realm |
References
Go further
If you need training or technical assistance for the implementation of our solutions, contact your sales representative or click this link to request a quote and have your project analyzed by our Professional Services team experts.
Join our community of users.
-
Secure Shell (SSH) : un protocole de réseau sécurisé utilisé pour établir des connexions entre un client et un serveur. Il permet d'exécuter des commandes à distance de manière sécurisée. ↩