adorsys / adorsys/keycloak-config-cli

Import Workflow doesn't work

未關閉 適合新手
#1,667 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Java
星號
1.2k
分支
201
PR 合併指標
30 天內沒有已合併 PR

描述

### Current Behavior

In Keycloak 26.6.4 Workflow import doesn't work. Two scenario:

### Workflow already exists in Keycloak realm
When workflow already exists:
```yaml
name: workflow
enabled: true
on: user-role-granted
steps:
- uses: do-something
with:
message: We are here
```
When try import catch error with message: Error during Keycloak import: jakarta.ws.rs.ProcessingException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `java.util.ArrayList` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('We are here')\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 183] (through reference chain: java.util.ArrayList[0]->de.adorsys.keycloak.config.model.WorkflowRepresentation[\"steps\"]->java.util.ArrayList[0]->de.adorsys.keycloak.config.model.WorkflowRepresentation$WorkflowStepRepresentation[\"with\"]->java.util.LinkedHashMap[\"message\"])

### Creating new worklfow
When try create workflow from sample:
```json
{
"enabled": true,
"realm": "realmWithWorkflows",
"workflows": [
{
"name": "Delete inactive users",
"enabled": true,
"on": "user-authenticated",
"if": "has-user-attribute(type:user)",
"schedule": {
"after": "5y",
"batch-size": 50
},
"concurrency": {
"restart-in-progress": "true"
},
"steps": [
{
"uses": "delete-user",
"after": "5y"
}
]
}
]
}
```
Catch error when keycloak return 400 error. In Keycloak logs found message:
```json
{
"timestamp": "2026-08-05T19:47:18.712733116Z",
"sequence": 6116,
"loggerClassName": "org.jboss.logging.Logger",
"loggerName": "org.keycloak.services.error.KeycloakErrorHandler",
"level": "ERROR",
"message": "Uncaught server error",
"threadName": "executor-thread-346",
"threadId": 24535,
"mdc": {},
"ndc": "",
"hostName": "keycloak-6dcb884fd-klz54",
"processName": "/usr/lib/jvm/java-21-openjdk-21.0.11.0.10-2.el9.x86_64/bin/java",
"processId": 93,
"exception": {
"refId": 1,
"exceptionType": "java.lang.NullPointerException",
"message": "Cannot invoke \"java.util.List.iterator()\" because \"valueList\" is null",
"frames": [
{
"class": "org.keycloak.common.util.MultivaluedMap",
"method": "addAll",
"line": 41
},
{
"class": "java.util.HashMap",
"method": "forEach",
"line": 1429
},
{
"class": "org.keycloak.models.workflow.Workflow",
"method": "",
"line": 65
},
{
"class": "org.keycloak.models.workflow.DefaultWorkflowProvider",
"method": "toModel",
"line": 332
},
{
"class": "org.keycloak.workflow.admin.resource.WorkflowsResource",
"method": "create",
"line": 69
},
{
"class": "org.keycloak.workflow.admin.resource.WorkflowsResource$quarkusrestinvoker$create_ae855f23d3398a49b9ee6360f9772d24a0c748c1",
"method": "invoke"
},
{
"class": "org.jboss.resteasy.reactive.server.handlers.InvocationHandler",
"method": "handle",
"line": 29
},
{
"class": "io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext",
"method": "invokeHandler",
"line": 190
},
{
"class": "org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext",
"method": "run",
"line": 147
},
{
"class": "io.quarkus.vertx.core.runtime.VertxCoreRecorder$15",
"method": "runWith",
"line": 677
},
{
"class": "org.jboss.threads.EnhancedQueueExecutor$Task",
"method": "doRunWith",
"line": 2651
},
{
"class": "org.jboss.threads.EnhancedQueueExecutor$Task",
"method": "run",
"line": 2630
},
{
"class": "org.jboss.threads.EnhancedQueueExecutor",
"method": "runThreadBody",
"line": 1622
},
{
"class": "org.jboss.threads.EnhancedQueueExecutor$ThreadBody",
"method": "run",
"line": 1589
},
{
"class": "org.jboss.threads.DelegatingRunnable",
"method": "run",
"line": 11
},
{
"class": "org.jboss.threads.ThreadLocalResettingRunnable",
"method": "run",
"line": 11
},
{
"class": "io.netty.util.concurrent.FastThreadLocalRunnable",
"method": "run",
"line": 30
},
{
"class": "java.lang.Thread",
"method": "run",
"line": 1583
}
]
},
"service.name": "keycloak"
}
```

In keycloak [Rest Api](https://www.keycloak.org/docs-api/latest/rest-api/index.html#WorkflowStepRepresentation) in step field called config, but in `de.adorsys.keycloak.config.model.WorkflowRepresentation$WorkflowStepRepresentation` field with this name doesn't exists, but exists with name with.

### Expected Behavior

Import work and workflow created

### Steps To Reproduce

```markdown
Import workflow from sample https://github.com/adorsys/keycloak-config-cli/blob/main/src/test/resources/import-files/workflows/00_create_realm_with_workflow.json
```

### Deployment Method

Docker

### Environment

- Keycloak Version: 26.6.4
- keycloak-config-cli Version: docker image adorsys/keycloak-config-cli:6.5.1-26.5.5
- Java Version: 21

### Relevant configuration (sanitized)

```yaml

```

### Logs / error output

```shell

```

### Anything else?

_No response_

貢獻指南

開啟貢獻指南

研究方向

Start by opening `de.adorsys.keycloak.config.model.WorkflowRepresentation$WorkflowStepRepresentation` to inspect the step field names used during import, then compare that with the REST expectation (`config`) and the sample `src/test/resources/import-files/workflows/00_create_realm_with_workflow.json`. Follow the stack trace into `org.keycloak.workflow.admin.resource.WorkflowsResource` and `org.keycloak.models.workflow.DefaultWorkflowProvider` to see where the malformed map/list mapping is converted. Run the sample import against a local docker image and verify it completes without 400/`ProcessingException` and without the `valueList` NPE in logs.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
cli
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
冷清
描述清晰度
基本清楚
新手友好度
74/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。