This documentation is for a release that is no longer maintained
See documentation for the latest supported version.Chapter 10. OpenID Connect authentication provider
Red Hat Developer Hub uses the OpenID Connect (OIDC) authentication provider to authenticate with third-party services that support the OIDC protocol.
10.1. Overview of using the OIDC authentication provider in Developer Hub Copy linkLink copied to clipboard!
You can configure the OIDC authentication provider in Developer Hub by updating your app-config.yaml file under the root auth configuration. For example:
10.2. Configuring Keycloak with the OIDC authentication provider Copy linkLink copied to clipboard!
Red Hat Developer Hub includes an OIDC authentication provider that can authenticate users by using Keycloak.
The user that you create in Keycloak must also be available in the Developer Hub catalog.
Procedure
-
In Keycloak, create a new realm, for example
RHDH. Add a new user.
- Username
-
Username for the user, for example:
rhdhuser - Email address of the user.
- First name
- First name of the user.
- Last name
- Last name of the user.
- Email verified
- Toggle to On.
- Click Create.
- Navigate to the Credentials tab.
- Click Set password.
- Enter the Password for the user account and toggle Temporary to Off.
Create a new Client ID, for example,
RHDH.- Client authentication
- Toggle to On.
- Valid redirect URIs
-
Set to the OIDC handler URL, for example,
https://<RHDH_URL>/api/auth/oidc/handler/frame.
- Navigate to the Credentials tab and copy the Client secret.
- Save the Client ID and the Client Secret for the next step.
In Developer Hub, add your Keycloak credentials in your Developer Hub secrets.
- Edit your Developer Hub secrets, such as secrets-rhdh.
Add the following key/value pairs:
AUTH_KEYCLOAK_CLIENT_ID-
Enter the Client ID that you generated in Keycloak, such as
RHDH. AUTH_KEYCLOAK_CLIENT_SECRET- Enter the Client Secret that you generated in Keycloak.
Set up the OIDC authentication provider in your Developer Hub custom configuration.
-
Edit your custom Developer Hub ConfigMap, such as
app-config-rhdh. In the
app-config-rhdh.yamlcontent, add theoidcprovider configuration under the rootauthconfiguration, and enable theoidcprovider for sign-in:app-config-rhdh.yamlfragmentCopy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Edit your custom Developer Hub ConfigMap, such as
Verification
-
Restart your
backstage-developer-hubapplication to apply the changes. - Your Developer Hub sign-in page displays Sign in using OIDC.
10.3. Migrating from OAuth2 Proxy with Keycloak to OIDC in Developer Hub Copy linkLink copied to clipboard!
If you are using OAuth2 Proxy as an authentication provider with Keycloak, and you want to migrate to OIDC, you can update your authentication provider configuration to use OIDC.
Procedure
-
In Keycloak, update the valid redirect URI to
https://<rhdh_url>/api/auth/oidc/handler/frame. Make sure to replace<rhdh_url>with your Developer Hub application URL, such as,my.rhdh.example.com. -
Replace the
oauth2Proxyconfiguration values in theauthsection of yourapp-config.yamlfile with theoidcconfiguration values. Update the
signInPageconfiguration value fromoauth2Proxytooidc.The following example shows the
auth.providersandsignInPageconfiguration foroauth2Proxyprior to migrating the authentication provider tooidc:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following example shows the
auth.providersandsignInPageconfiguration after migrating the authentication provider tooidc:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the OAuth2 Proxy sidecar container and update the
upstream.servicesection of your Helm chart’svalues.yamlfile as follows:-
service.ports.backend:7007 service.ports.targetPort:backendThe following example shows the
serviceconfiguration foroauth2Proxyprior to migrating the authentication provider tooidc:service: ports: name: http-backend backend: 4180 targetPort: oauth2Proxyservice: ports: name: http-backend backend: 4180 targetPort: oauth2ProxyCopy to Clipboard Copied! Toggle word wrap Toggle overflow The following example shows the
serviceconfiguration after migrating the authentication provider tooidc:service: ports: name: http-backend backend: 7007 targetPort: backendservice: ports: name: http-backend backend: 7007 targetPort: backendCopy to Clipboard Copied! Toggle word wrap Toggle overflow
-
- Upgrade the Developer Hub Helm chart.