adorsys / adorsys/keycloak-config-cli

`organizations` key silently ignored when using Keycloak 26

Ouverte
#1,655 1 commentaire 6 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Java
Étoiles
1.2k
Forks
200
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Current Behavior

When importing a realm YAML containing an `organizations` section, keycloak-config-cli v6.5.1 silently ignores all organization entries. No organizations are created, no error is logged, not even at `DEBUG` level. The run exits with code 0.

### Expected Behavior

`OrganizationImportService` creates the organizations defined in the `organizations` key, as documented in https://adorsys.github.io/keycloak-config-cli/organizations/member-management/

### Steps To Reproduce

```markdown
1. Start Keycloak 26.5.5
2. Run keycloak-config-cli `latest-26.5.5` with the realm YAML below
3. Enable `LOGGING_LEVEL_DE_ADORSYS_KEYCLOAK_CONFIG=DEBUG`
4. Observe that no organizations are created and zero log output from `OrganizationImportService`
```

### Deployment Method

Docker

### Environment

- Keycloak Version: 26.5.5
- keycloak-config-cli Version: 6.5.1 (`latest-26.5.5`)
- Java Version: 21.0.11

### Relevant configuration (sanitized)

```yaml
realm: my-realm
enabled: true
organizationsEnabled: true

organizations:
- name: Acme Corp
alias: acme-corp
enabled: true
members:
- username: john.doe

keycloak-config:
image: adorsys/keycloak-config-cli:latest-26.5.5
environment:
KEYCLOAK_URL: http://keycloak:8080
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
KEYCLOAK_AVAILABILITYCHECK_ENABLED: "true"
IMPORT_FILES_LOCATIONS: /config/realm.yaml
LOGGING_LEVEL_DE_ADORSYS_KEYCLOAK_CONFIG: DEBUG
```

### Logs / error output

```shell
INFO KeycloakConfigRunner : Importing file 'file:/config/realm.yaml'
INFO KeycloakProvider : Server info available. Using version: 26.5.5
INFO KeycloakConfigRunner : keycloak-config-cli ran in 00:18.163.
```

### Anything else?

The `organizationsEnabled: true` flag **is** applied correctly (Organizations tab appears in Keycloak Admin UI). Only the individual `organizations` entries are ignored.

The issue was reproduced with both KC 26.5.5 and KC 26.6.4 against `latest-26.5.5`, ruling out a version mismatch as the cause.

**Suspected root cause:** Keycloak 26 added `organizations` as a native field to `RealmRepresentation`:

```java
private List organizations;
```

`RealmImport extends RealmRepresentation` registers its own handler:

```java
@JsonSetter("organizations")
public void setOrganizationsRaw(List> organizationsRaw) { ... }
```

Jackson may route the deserialized data into the parent class field (`RealmRepresentation.setOrganizations()`), leaving `organizationsRaw` as `null`. `OrganizationImportService.doImport()` then finds nothing to process and exits silently. This conflict did not exist before KC 26 because `RealmRepresentation` had no `organizations` field.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.