docs/docs/en/guide/security/oidc-local-environment-setup.md
If you are developing or testing the OIDC authentication feature, you'll need a local OIDC provider. This guide explains how to set up Keycloak using Docker and configure it for DolphinScheduler development.
For convenience, we provide a pre-configured Keycloak realm export that sets up the necessary client, users, and groups.
cd dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/resources/docker/oidc-login/
docker-compose.yaml in this directory is configured to start Keycloak and import the realm automatically.docker-compose up -d keycloak
This command starts a Keycloak container on port 8081 (to avoid conflicts with other services) and imports realm-export.json.
http://localhost:8081.admin and password admin.master realm to the dolphinscheduler realm.dolphinscheduler-client), Users (admin_user, general_user), and Groups (dolphinscheduler-admins) to see the imported configuration.Modify your dolphinscheduler-api/src/main/resources/application.yaml to enable OIDC and connect to your local Keycloak instance.
security:
authentication:
type: OIDC
oidc:
enable: true
providers:
keycloak:
display-name: "Login with Keycloak"
# Point to your local Keycloak realm
issuer-uri: http://localhost:8080/realms/dolphinscheduler
client-id: dolphinscheduler-client
client-secret: dolphinscheduler-client-secret
scope: openid, profile, email, groups
user-name-attribute: preferred_username
groups-claim: groups
user:
auto-create: true
default-tenant-code: "default"
default-queue: "default"
user-type: "ADMIN_USER"
Note:
- Even though the Keycloak container's external port is
8081, its internal issuer URL is still based on port8080. The configuration inapplication.yamlshould usehttp://localhost:8080unless you have modified the issuer URL inside Keycloak itself.scope: openid, profile, email, groups
openid: Mandatory for OIDC.profile: Often provides claims used for the username, likepreferred_usernameorname.groups: A common (but sometimes custom) scope needed to retrieve the user's role/group memberships
Start the backend services in your IDE as described in the "Normal Mode" guide, ensuring you start at least:
MasterServerApiApplicationServeror,
StandaloneServer (if you prefer standalone mode)Run the frontend development server:
cd dolphinscheduler-ui
pnpm install
pnpm run dev
You can now access the UI at http://localhost:5173, where you will see the "Login with Keycloak" button.
It is recommended to set up pre-commit before pushing your code to GitHub (see docs/docs/en/contribute/development-environment-setup.md). If you encounter issues with pre-commit, to avoid CI failures and maintain code quality, always perform the following checks manually:
./mvnw spotless:apply
cd dolphinscheduler-ui
pnpm run lint