Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycloak 24.0.1 #998

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Used in docker-compose
# shellcheck disable=SC2034
KEYCLOAK_VERSION=23.0.1
KEYCLOAK_VERSION=24.0.1
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
env:
# we keep 18.0.2 for backwards compatibility with RH-SSO 7.6
- KEYCLOAK_VERSION: 18.0.2
- KEYCLOAK_VERSION: 20.0.5
- KEYCLOAK_VERSION: 21.1.1
- KEYCLOAK_VERSION: 22.0.4
- KEYCLOAK_VERSION: 23.0.1
- KEYCLOAK_VERSION: 23.0.7
- KEYCLOAK_VERSION: 24.0.1
steps:
- uses: actions/checkout@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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]
- Updated CI to use Keycloak 24.0.1
- Updated CI to use Keycloak 23.0.7
- Changed briefRepresentation from false to true (mistakenly considered full: [#25096](https://github.com/keycloak/keycloak/issues/25096))
- Removes compatibility of Versions 23.0.0, 23.0.1, 23.0.2 and 23.0.3
- Using getGroupByPath again after being fixed ([#25111](https://github.com/keycloak/keycloak/issues/25111))

## [5.10.0] - 2023-12-12
- Updated CI to use Keycloak 23.0.1
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM ${BUILDER_IMAGE} AS BUILDER

WORKDIR /app/

ARG KEYCLOAK_VERSION=23.0.1
ARG KEYCLOAK_VERSION=24.0.1
ARG MAVEN_CLI_OPTS="-ntp -B"

COPY .mvn .mvn
Expand Down
44 changes: 4 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<keycloak.version>23.0.1</keycloak.version>
<keycloak.version>24.0.1</keycloak.version>

<checkstyle-plugin.version>3.2.0</checkstyle-plugin.version>
<checkstyle.version>10.0</checkstyle.version>
Expand All @@ -74,7 +74,7 @@
<junit5-system-exit.version>1.1.2</junit5-system-exit.version>
<keepachangelog.version>2.1.1</keepachangelog.version>
<license-plugin.version>2.0.0</license-plugin.version>
<logstash-logback-encoder.version>7.4</logstash-logback-encoder.version>
<logstash-logback-encoder.version>7.3</logstash-logback-encoder.version>
<maven-failsafe-plugin.version>3.0.0-M5</maven-failsafe-plugin.version>
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
<maven-replacer.version>1.5.3</maven-replacer.version>
Expand Down Expand Up @@ -702,24 +702,6 @@
<id>pre-keycloak22</id>
<build>
<plugins>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>replace-grouputil-with-legacy</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.basedir}/src/main/java/de/adorsys/keycloak/config/util/GroupUtil.java.legacy</sourceFile>
<destinationFile>${project.basedir}/src/main/java/de/adorsys/keycloak/config/util/GroupUtil.java</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
Expand Down Expand Up @@ -773,7 +755,7 @@ import org.keycloak.representations.userprofile.config.UPConfig;</token>
<value>userProfileResource.update(newUserProfileConfiguration);</value>
</replacement>
<replacement>
<token>return groupResource.getSubGroups\(null, null, true\);</token>
<token>return groupResource.getSubGroups\(null, null, false\);</token>
<value>return groupResource.toRepresentation().getSubGroups();</value>
</replacement>
</replacements>
Expand All @@ -786,24 +768,6 @@ import org.keycloak.representations.userprofile.config.UPConfig;</token>
<id>pre-keycloak23</id>
<build>
<plugins>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>replace-grouputil-with-legacy</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.basedir}/src/main/java/de/adorsys/keycloak/config/util/GroupUtil.java.legacy</sourceFile>
<destinationFile>${project.basedir}/src/main/java/de/adorsys/keycloak/config/util/GroupUtil.java</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
Expand Down Expand Up @@ -853,7 +817,7 @@ import org.keycloak.representations.userprofile.config.UPConfig;</token>
<value>userProfileResource.update(newUserProfileConfiguration);</value>
</replacement>
<replacement>
<token>return groupResource.getSubGroups\(null, null, true\);</token>
<token>return groupResource.getSubGroups\(null, null, false\);</token>
<value>return groupResource.toRepresentation().getSubGroups();</value>
</replacement>
</replacements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package de.adorsys.keycloak.config.repository;

import de.adorsys.keycloak.config.exception.ImportProcessingException;
import de.adorsys.keycloak.config.util.GroupUtil;
import org.keycloak.admin.client.CreatedResponseUtil;
import org.keycloak.admin.client.resource.GroupResource;
import org.keycloak.admin.client.resource.GroupsResource;
Expand Down Expand Up @@ -121,7 +120,7 @@ public GroupRepresentation getSubGroupByName(String realmName, String parentGrou

public List<GroupRepresentation> getSubGroups(String realmName, String parentGroupId) {
var groupResource = getResourceById(realmName, parentGroupId);
return groupResource.getSubGroups(null, null, true);
return groupResource.getSubGroups(null, null, false);
}

public void addRealmRoles(String realmName, String groupId, List<String> roleNames) {
Expand Down Expand Up @@ -211,7 +210,7 @@ public GroupRepresentation getGroupById(String realmName, String groupId) {
}

public GroupRepresentation getGroupByPath(String realmName, String groupPath) {
return GroupUtil.getGroupByPath(this, realmRepository, realmName, groupPath);
return realmRepository.getResource(realmName).getGroupByPath(groupPath);
}

public void enablePermission(String realmName, String id) {
Expand Down
86 changes: 0 additions & 86 deletions src/main/java/de/adorsys/keycloak/config/util/GroupUtil.java

This file was deleted.

This file was deleted.

10 changes: 9 additions & 1 deletion src/test/java/de/adorsys/keycloak/config/AbstractImportIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ abstract public class AbstractImportIT extends AbstractImportTest {
KEYCLOAK_CONTAINER.setCommand("start-dev");
command.add("start-dev");
command.add("--features");
command.add("admin-fine-grained-authz,declarative-user-profile,client-policies,client-secret-rotation");

StringBuilder featuresBuilder =
new StringBuilder("admin-fine-grained-authz,client-policies,client-secret-rotation");

if (VersionUtil.lt(KEYCLOAK_VERSION, "24")) {
featuresBuilder.append(",declarative-user-profile");
}

command.add(featuresBuilder.toString());
}

if (System.getProperties().getOrDefault("skipContainerStart", "false").equals("false")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1752,23 +1752,23 @@ private List<GroupRepresentation> getSubGroups(GroupRepresentation groupRepresen
}

private void assertThatGroupAttributesAreEmpty(Map<String, List<String>> attributes) {
if (VersionUtil.lt(KEYCLOAK_VERSION, "23")) {
if (VersionUtil.lt(KEYCLOAK_VERSION, "23") || VersionUtil.ge(KEYCLOAK_VERSION, "23.0.5")) {
assertThat("attributes is null", attributes, aMapWithSize(0));
} else {
assertThat("attributes is null", attributes, is(nullValue()));
}
}

private void assertThatGroupRealmRolesAreEmpty(List<String> realmRoles) {
if (VersionUtil.lt(KEYCLOAK_VERSION, "23")) {
if (VersionUtil.lt(KEYCLOAK_VERSION, "23") || VersionUtil.ge(KEYCLOAK_VERSION, "23.0.5")) {
assertThat("realm roles is null", realmRoles, hasSize(0));
} else {
assertThat("realm roles is null", realmRoles, is(nullValue()));
}
}

private void assertThatGroupClientRolesAreEmpty(Map<String, List<String>> clientRoles) {
if (VersionUtil.lt(KEYCLOAK_VERSION, "23")) {
if (VersionUtil.lt(KEYCLOAK_VERSION, "23") || VersionUtil.ge(KEYCLOAK_VERSION, "23.0.5")) {
assertThat("client roles not null", clientRoles, aMapWithSize(0));
} else {
assertThat("client roles not null", clientRoles, is(nullValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import de.adorsys.keycloak.config.exception.ImportProcessingException;
import de.adorsys.keycloak.config.exception.InvalidImportException;
import de.adorsys.keycloak.config.exception.KeycloakRepositoryException;
import de.adorsys.keycloak.config.util.VersionUtil;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.keycloak.representations.idm.RealmRepresentation;
Expand Down Expand Up @@ -169,7 +170,12 @@ void shouldUpdateWebAuthnSettings() throws IOException {

assertThat(realm.getRealm(), is("simple"));
assertThat(realm.isEnabled(), is(true));
assertThat(realm.getWebAuthnPolicyPasswordlessUserVerificationRequirement(), is("required"));

// TODO: "webAuthnPolicyPasswordlessUserVerificationRequirement" is not set with Keycloak 24
// https://github.com/keycloak/keycloak/issues/27700
if (VersionUtil.lt(KEYCLOAK_VERSION,"24")) {
assertThat(realm.getWebAuthnPolicyPasswordlessUserVerificationRequirement(), is("required"));
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public static List<GroupRepresentation> getSubGroups(

return realmResource.groups()
.group(groupRepresentation.getId())
.getSubGroups(null, null, true);
.getSubGroups(null, null, false);
}
}
Loading
Loading