adorsys / adorsys/keycloak-config-cli

KeyProvider Import

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

描述

### Current Behavior

Hi,

I am trying to import a KeyProvider.

Image

In the screenshot you can see what the import file looks like. The content of the private key is a variable substitution. The original declaration is:
`"$(file:UTF-8:$(env:SIGNING_PRIVATE_KEY_A_PATH))"`

Image

The newlines of the PEM file are not correctly parsed by the yaml parser. As you can see after the
`-----BEGIN PRIVATE KEY-----` there is a space but it has to be a newline character. This leads to an error in keycloak:
`Failed to decode private key`

### Expected Behavior

The contents of the file are correctly parsed and imported in keycloak.

### Steps To Reproduce

```markdown
Create a valid import file for component and KeyProvider

Insert a valid private key.

Try to import

Example file:
https://gist.github.com/inituser123/f8cfc723e017413dfe83ca28e1f456b9
```

### Deployment Method

Docker

### Environment

- Keycloak Version: [26.6.2]
- keycloak-config-cli Version: [6.5.0-26.5.4]
- Java Version: [21]

### Relevant configuration (sanitized)

```yaml

```

### Logs / error output

```shell

```

### Anything else?

The error is most probably in the `KeycloakImportProvider` method `readContent`. There the `String content` is loaded as `yaml`.

貢獻指南

開啟貢獻指南

研究方向

Locate the `KeycloakImportProvider` class and inspect its `readContent` method, where the issue says PEM text is parsed as YAML. Trace the KeyProvider import flow to where `$(file:UTF-8:...)` substitutions are resolved and where line breaks in the key material are handled. Then look for tests around KeyProvider/component import parsing, run them (or add a case) with a multiline PEM fixture, and verify the import no longer returns `Failed to decode private key`.

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

評估

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

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

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