{
"idToken": "<id_token>"
}
Red Hat Advanced Cluster Security for Kubernetes (RHACS) provides the ability to configure short-lived access to the user interface and API calls.
You can configure this by exchanging OpenID Connect (OIDC) identity tokens for a RHACS-issued token.
We recommend this especially for Continuous Integration (CI) usage, where short-lived access is preferable over long-lived API tokens.
The following steps outline the high-level workflow on how to configure short-lived access to the user interface and API calls:
Configuring RHACS to trust OIDC identity token issuers for exchanging short-lived RHACS-issued tokens.
Exchanging an OIDC identity token for a short-lived RHACS-issued token by calling the API.
Start configuring short-lived access for an OpenID Connect (OIDC) identity token issuer.
In the RHACS portal, go to Platform Configuration → Integrations.
Scroll to the Authentication Tokens category, and then click Machine access configuration.
Click Create configuration.
Select the configuration type, choosing one of the following:
Generic if you use an arbitrary OIDC identity token issuer.
GitHub Actions if you plan to access RHACS from GitHub Actions.
Enter the OIDC identity token issuer.
Enter the token lifetime for tokens issued by the configuration.
The format for the token lifetime is XhYmZs and cannot be set longer than 24 hours. |
Add rules to the configuration:
The Key is the OIDC token’s claim to use.
The Value is the expected OIDC token claim value.
The Role is the role to assign to the token if the OIDC token claim and value exist.
Rules are similar to Authentication Provider rules to assign roles based on claim values. As a general rule, Red Hat recommends to use unique, immutable claims within Rules. The general recommendation is to use the sub claim within the OIDC identity token. For more information about OIDC token claims, see the list of standard OIDC claims. |
Click Save.
You have a valid OpenID Connect (OIDC) token.
You added a Machine access configuration for the RHACS instance you want to access.
Prepare the POST request’s JSON data:
{
"idToken": "<id_token>"
}
Send a POST request to the API /v1/auth/m2m/exchange.
Wait for the API response:
{
"accessToken": "<access_token>"
}
Use the returned access token to access the RHACS instance.
If you are using GitHub Actions, you can use the stackrox/central-login GitHub Action. |