이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 4. Enabling and configuring the Keycloak plugin


The Keycloak backend plugin, which integrates Keycloak into Developer Hub, has the following capabilities:

  • Synchronization of Keycloak users in a realm.
  • Synchronization of Keycloak groups and their users in a realm.
Note

The supported Red Hat Build of Keycloak (RHBK) version is 26.0.

4.1. Enabling the Keycloak plugin

Prerequisites

  • To enable the Keycloak plugin, you must set the following environment variables:

    • KEYCLOAK_BASE_URL
    • KEYCLOAK_LOGIN_REALM
    • KEYCLOAK_REALM
    • KEYCLOAK_CLIENT_ID
    • KEYCLOAK_CLIENT_SECRET

Procedure

  1. The Keycloak plugin is pre-loaded in Developer Hub with basic configuration properties. To enable it, set the disabled property to false as follows:

    global:
      dynamic:
        includes:
          - dynamic-plugins.default.yaml
        plugins:
          - package: ./dynamic-plugins/dist/backstage-community-plugin-catalog-backend-module-keycloak-dynamic
            disabled: false
    Copy to Clipboard Toggle word wrap

4.2. Configuring the Keycloak plugin

Procedure

  1. To configure the Keycloak plugin, add the following in your app-config.yaml file:

    schedule

    Configure the schedule frequency, timeout, and initial delay. The fields support cron, ISO duration, "human duration" as used in code.

         catalog:
           providers:
             keycloakOrg:
               default:
                 schedule:
                   frequency: { minutes: 1 }
                   timeout: { minutes: 1 }
                   initialDelay: { seconds: 15 }
    Copy to Clipboard Toggle word wrap
    userQuerySize and groupQuerySize

    Optionally, configure the Keycloak query parameters to define the number of users and groups to query at a time. Default values are 100 for both fields.

       catalog:
         providers:
           keycloakOrg:
             default:
               userQuerySize: 100
               groupQuerySize: 100
    Copy to Clipboard Toggle word wrap
    Authentication

    Communication between Developer Hub and Keycloak is enabled by using the Keycloak API. Username and password, or client credentials are supported authentication methods.

    The following table describes the parameters that you can configure to enable the plugin under catalog.providers.keycloakOrg.<ENVIRONMENT_NAME> object in the app-config.yaml file:

    Expand
    NameDescriptionDefault ValueRequired

    baseUrl

    Location of the Keycloak server, such as https://localhost:8443/auth.

    ""

    Yes

    realm

    Realm to synchronize

    master

    No

    loginRealm

    Realm used to authenticate

    master

    No

    username

    Username to authenticate

    ""

    Yes if using password based authentication

    password

    Password to authenticate

    ""

    Yes if using password based authentication

    clientId

    Client ID to authenticate

    ""

    Yes if using client credentials based authentication

    clientSecret

    Client Secret to authenticate

    ""

    Yes if using client credentials based authentication

    userQuerySize

    Number of users to query at a time

    100

    No

    groupQuerySize

    Number of groups to query at a time

    100

    No

  2. When using client credentials

    1. Set the access type to confidential.
    2. Enable service accounts.
    3. Add the following roles from the realm-management client role:

      • query-groups
      • query-users
      • view-users
  3. Optionally, if you have self-signed or corporate certificate issues, you can set the following environment variable before starting Developer Hub:

    NODE_TLS_REJECT_UNAUTHORIZED=0
    Copy to Clipboard Toggle word wrap
    Warning

    Setting the environment variable is not recommended.

4.3. Keycloack plugin metrics

The Keycloak backend plugin supports OpenTelemetry metrics that you can use to monitor fetch operations and diagnose potential issues.

4.3.1. Available Counters

Expand
Table 4.1. Keycloak metrics
Metric NameDescription

backend_keycloak_fetch_task_failure_count_total

Counts fetch task failures where no data was returned due to an error.

backend_keycloak_fetch_data_batch_failure_count_total

Counts partial data batch failures. Even if some batches fail, the plugin continues fetching others.

4.3.2. Labels

All counters include the taskInstanceId label, which uniquely identifies each scheduled fetch task. You can use this label to trace failures back to individual task executions.

Users can enter queries in the Prometheus UI or Grafana to explore and manipulate metric data.

In the following examples, a Prometheus Query Language (PromQL) expression returns the number of backend failures.

Example to get the number of backend failures associated with a taskInstanceId

backend_keycloak_fetch_data_batch_failure_count_total{taskInstanceId="df040f82-2e80-44bd-83b0-06a984ca05ba"} 1
Copy to Clipboard Toggle word wrap

Example to get the number of backend failures during the last hour

sum(backend_keycloak_fetch_data_batch_failure_count_total) - sum(backend_keycloak_fetch_data_batch_failure_count_total offset 1h)
Copy to Clipboard Toggle word wrap

Note

PromQL supports arithmetic operations, comparison operators, logical/set operations, aggregation, and various functions. Users can combine these features to analyze time-series data effectively.

Additionally, the results can be visualized using Grafana.

4.3.3. Exporting Metrics

You can export metrics using any OpenTelemetry-compatible backend, such as Prometheus.

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat