From 66181f42b32047c3fb704cf03c57ab961f4cd8fa Mon Sep 17 00:00:00 2001 From: Calebasah Date: Tue, 5 Nov 2024 17:37:07 +0100 Subject: [PATCH 1/7] Modify RequiredActionsImportService --- .../keycloak/config/service/RequiredActionsImportService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/adorsys/keycloak/config/service/RequiredActionsImportService.java b/src/main/java/de/adorsys/keycloak/config/service/RequiredActionsImportService.java index 134e0339d..602c0db55 100644 --- a/src/main/java/de/adorsys/keycloak/config/service/RequiredActionsImportService.java +++ b/src/main/java/de/adorsys/keycloak/config/service/RequiredActionsImportService.java @@ -63,7 +63,7 @@ public void doImport(RealmImport realmImport) { List existingRequiredActions = requiredActionRepository.getAll(realmName); - if (importConfigProperties.getManaged().getClientScope() == ImportManagedPropertiesValues.FULL) { + if (importConfigProperties.getManaged().getRequiredAction() == ImportManagedPropertiesValues.FULL) { deleteRequiredActionsMissingInImport(realmName, requiredActions, existingRequiredActions); } From aefbb0dff84fcda7d1fb82309237c310356f5086 Mon Sep 17 00:00:00 2001 From: Calebasah Date: Wed, 6 Nov 2024 10:22:23 +0100 Subject: [PATCH 2/7] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62985bc76..4d4c9a245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Fix required action import handling for no-delete option [#834](https://github.com/adorsys/keycloak-config-cli/issues/834) + ### Fixed - Allow environment variables from existing secrets [#822](https://github.com/adorsys/keycloak-config-cli/issues/822) ### Fixed From 9d3c40d574627341d777f4eb50072f227493d91c Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Wed, 6 Nov 2024 15:36:40 +0100 Subject: [PATCH 3/7] improved logging for realm retrieval errors --- CHANGELOG.md | 2 ++ .../keycloak/config/service/checksum/ChecksumService.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62985bc76..01b306fc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- improved logging for realm retrieval errors [#1010](https://github.com/adorsys/keycloak-config-cli/issues/1010) ### Fixed - Allow environment variables from existing secrets [#822](https://github.com/adorsys/keycloak-config-cli/issues/822) ### Fixed diff --git a/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java b/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java index 735e4b14d..92f6956f8 100644 --- a/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java +++ b/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java @@ -52,6 +52,9 @@ public ChecksumService(RealmRepository realmRepository, ImportConfigProperties i public void doImport(RealmImport realmImport) { RealmRepresentation existingRealm = realmRepository.get(realmImport.getRealm()); + if (existingRealm == null) { + throw new InvalidImportException("The specified realm does not exist: " + realmImport.getRealm()); + } Map customAttributes = existingRealm.getAttributes(); String importChecksum = realmImport.getChecksum(); From 738c4cbab3a34043b70df4ba23f0662a41dfe97a Mon Sep 17 00:00:00 2001 From: AssahBismarkabah Date: Wed, 6 Nov 2024 16:17:44 +0100 Subject: [PATCH 4/7] fix test failures in workflow --- .../keycloak/config/service/checksum/ChecksumService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java b/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java index 92f6956f8..87bd7b21a 100644 --- a/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java +++ b/src/main/java/de/adorsys/keycloak/config/service/checksum/ChecksumService.java @@ -52,9 +52,6 @@ public ChecksumService(RealmRepository realmRepository, ImportConfigProperties i public void doImport(RealmImport realmImport) { RealmRepresentation existingRealm = realmRepository.get(realmImport.getRealm()); - if (existingRealm == null) { - throw new InvalidImportException("The specified realm does not exist: " + realmImport.getRealm()); - } Map customAttributes = existingRealm.getAttributes(); String importChecksum = realmImport.getChecksum(); @@ -67,6 +64,9 @@ public void doImport(RealmImport realmImport) { public boolean hasToBeUpdated(RealmImport realmImport) { RealmRepresentation existingRealm = realmRepository.get(realmImport.getRealm()); + if (existingRealm == null) { + throw new InvalidImportException("The specified realm does not exist: " + realmImport.getRealm()); + } Map customAttributes = existingRealm.getAttributes(); String readChecksum = customAttributes.get(getCustomAttributeKey(realmImport)); From b8bf02c1a6096c4887c1bd5306a954643f715544 Mon Sep 17 00:00:00 2001 From: Motouom Victoire Date: Fri, 8 Nov 2024 10:51:45 +0100 Subject: [PATCH 5/7] Add navigation menu to the README --- CHANGELOG.md | 1 + README.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b86cd91..17ae39286 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +- improved logging for realm retrieval errors [#1010](https://github.com/adorsys/keycloak-config-cli/issues/1010) ### Added - improved logging for realm retrieval errors [#1010](https://github.com/adorsys/keycloak-config-cli/issues/1010) ### Fixed diff --git a/README.md b/README.md index f69688c84..5344a7596 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,29 @@ [![codecov](https://codecov.io/gh/adorsys/keycloak-config-cli/branch/main/graph/badge.svg)](https://codecov.io/gh/adorsys/keycloak-config-cli) [![GitHub license](https://img.shields.io/github/license/adorsys/keycloak-config-cli)](https://github.com/adorsys/keycloak-config-cli/blob/main/LICENSE.txt) +# Table of Contents + +- [Config Files](#config-files) +- [Variable Substitution](#variable-substitution) + - [Supported Substitutions](#supported-substitutions) +- [Logging](#logging) + - [JSON Logging Support](#json-logging-support) + - [Log Level](#log-level) +- [Supported Features](#supported-features) +- [Compatibility with Keycloak](#compatibility-with-keycloak) +- [Build this Project](#build-this-project) +- [Run Integration Tests](#run-integration-tests) +- [Run this Project](#run-this-project) +- [Docker](#docker) +- [Helm](#helm) +- [Configuration](#configuration) + - [CLI Options / Environment Variables](#cli-options--environment-variables) + - [Keycloak Options](#keycloak-options) + - [Import Options](#import-options) + - [Spring Boot Options](#spring-boot-options) +- [Perform Release](#perform-release) +- [Commercial Support](#commercial-support) + # keycloak-config-cli keycloak-config-cli is a Keycloak utility to ensure the desired configuration state for a realm based on a JSON/YAML file. The format of the JSON/YAML file based on the export realm format. Store and handle the configuration files inside git just like normal code. A Keycloak restart isn't required to apply the configuration. From 36b79f1ff2a3ce1206b0916b01749a68e3d3034e Mon Sep 17 00:00:00 2001 From: Motouom Victoire Date: Fri, 8 Nov 2024 11:17:02 +0100 Subject: [PATCH 6/7] Applied changes requested. --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5344a7596..a7a60d7b7 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,7 @@ - [Config Files](#config-files) - [Variable Substitution](#variable-substitution) - - [Supported Substitutions](#supported-substitutions) - [Logging](#logging) - - [JSON Logging Support](#json-logging-support) - - [Log Level](#log-level) - [Supported Features](#supported-features) - [Compatibility with Keycloak](#compatibility-with-keycloak) - [Build this Project](#build-this-project) @@ -21,10 +18,6 @@ - [Docker](#docker) - [Helm](#helm) - [Configuration](#configuration) - - [CLI Options / Environment Variables](#cli-options--environment-variables) - - [Keycloak Options](#keycloak-options) - - [Import Options](#import-options) - - [Spring Boot Options](#spring-boot-options) - [Perform Release](#perform-release) - [Commercial Support](#commercial-support) @@ -114,6 +107,8 @@ Further development requirements - Java Development Kit (JDK) - Docker Desktop or an alternative replacement (e.g Rancher Desktop) +Before running `mvn verify`, you have to set the JAVA_HOME environment variable to prevent some test failures. + ```shell ./mvnw verify From e5b17a6c3e4365701567382be7eef0ebd11327ae Mon Sep 17 00:00:00 2001 From: Motouom Victoire Date: Fri, 8 Nov 2024 11:26:12 +0100 Subject: [PATCH 7/7] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17ae39286..4e0cacd7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -- improved logging for realm retrieval errors [#1010](https://github.com/adorsys/keycloak-config-cli/issues/1010) +### Added +- Added Navigation in the readme [#1010](https://github.com/adorsys/keycloak-config-cli/issues/1010) ### Added - improved logging for realm retrieval errors [#1010](https://github.com/adorsys/keycloak-config-cli/issues/1010) ### Fixed