From 5a3e2d2d7f8b1a8a93d7ae9360adbaf2dd9c3fd9 Mon Sep 17 00:00:00 2001 From: Sven-Torben Janus Date: Tue, 11 Jul 2023 22:46:58 +0200 Subject: [PATCH] chore!(deps): Update Keycloak dependencies to 22.0.0 This includes breaking changes due to transition from Java EE to Jakarta EE. As part of upgrading to Quarkus 3.x Keycloak migrated its codebase from Java EE to the successor Jakarta EE. This updates reflects the changes. --- .github/ISSUE_TEMPLATE/bug.yml | 4 +-- .github/workflows/buildAndTest.yml | 2 +- README.md | 2 +- docker-compose.yml | 2 +- docs/index.md | 4 +-- pom.xml | 27 +++---------------- .../hidpd/AuthenticationChallenge.java | 4 +-- .../hidpd/BaseUriLoginFormsProvider.java | 2 +- .../hidpd/HomeIdpDiscoveryAuthenticator.java | 4 +-- .../authentication/hidpd/LoginForm.java | 4 +-- .../authentication/hidpd/LoginPage.java | 8 +----- .../authentication/hidpd/Redirector.java | 4 +-- .../authentication/hidpd/RememberMe.java | 3 +-- .../authentication/AuthenticatorConfig.java | 8 +++--- .../authentication/hidpd/LoginPageTest.java | 3 --- 15 files changed, 25 insertions(+), 56 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index af9f2f1..cc9dd3a 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -38,8 +38,8 @@ body: label: Version description: | examples: - - **Keycloak**: 21.1.2 - - **This extension**: 21.2.0 + - **Keycloak**: 22.0.0 + - **This extension**: 22.0.0 value: | - Keycloak: - This extension: diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index 810fbe9..4f1db4c 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - keycloak_version: [ 21.0.2, 21.1.0, 21.1.2, latest ] + keycloak_version: [ 22.0.0, latest ] experimental: [false] include: - keycloak_version: nightly diff --git a/README.md b/README.md index 278f496..5f70156 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This is a simple Keycloak authenticator to redirect users to their home identity provider during login. ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/sventorben/keycloak-home-idp-discovery?sort=semver) -![Keycloak Dependency Version](https://img.shields.io/badge/Keycloak-21.1.2-blue) +![Keycloak Dependency Version](https://img.shields.io/badge/Keycloak-22.0.0-blue) ![GitHub Release Date](https://img.shields.io/github/release-date-pre/sventorben/keycloak-home-idp-discovery) ![Github Last Commit](https://img.shields.io/github/last-commit/sventorben/keycloak-home-idp-discovery) diff --git a/docker-compose.yml b/docker-compose.yml index cf77bce..61a6750 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: keycloak: container_name: keycloak - image: quay.io/keycloak/keycloak:21.1.2 + image: quay.io/keycloak/keycloak:22.0.0 environment: KEYCLOAK_ADMIN: admin KEYCLOAK_ADMIN_PASSWORD: admin diff --git a/docs/index.md b/docs/index.md index 2d1d15c..da6d868 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,7 +9,7 @@ nav_order: 1 This is a simple Keycloak authenticator to redirect users to their home identity provider during login. ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/sventorben/keycloak-home-idp-discovery?sort=semver) -![Keycloak Dependency Version](https://img.shields.io/badge/Keycloak-21.1.2-blue) +![Keycloak Dependency Version](https://img.shields.io/badge/Keycloak-22.0.0-blue) ![GitHub Release Date](https://img.shields.io/github/release-date-pre/sventorben/keycloak-home-idp-discovery) ![Github Last Commit](https://img.shields.io/github/last-commit/sventorben/keycloak-home-idp-discovery) @@ -18,7 +18,7 @@ This is a simple Keycloak authenticator to redirect users to their home identity ## What is it good for? -When a federated user wants to login via Keycloak, Keycloak will present a username/password form and a list of configured identity providers to the user. The user needs to choose an identity provider to get redirected. +When a federated user wants to log in via Keycloak, Keycloak will present a username/password form and a list of configured identity providers to the user. The user needs to choose an identity provider to get redirected. This authenticator allows to skip the step of selecting an identity provider. ## How does it work? diff --git a/pom.xml b/pom.xml index 0b073c4..edb2601 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.sventorben.keycloak keycloak-home-idp-discovery - 21.3.1-SNAPSHOT + 22.0.0-SNAPSHOT Keycloak: Home IdP Discovery A Keycloak authenticator to redirect users to their home IdP @@ -51,7 +51,7 @@ 17 - 21.1.2 + 22.0.0 ${version.keycloak} @@ -156,27 +156,6 @@ - - org.jboss.resteasy - resteasy-client - 4.7.4.Final - test - - - - org.jboss.resteasy - resteasy-jackson2-provider - 4.7.4.Final - test - - - - org.jboss.resteasy - resteasy-jaxb-provider - 4.7.4.Final - test - - org.junit @@ -273,7 +252,7 @@ com.github.dasniko testcontainers-keycloak - 2.5.0 + 3.0.0 test diff --git a/src/main/java/de/sventorben/keycloak/authentication/hidpd/AuthenticationChallenge.java b/src/main/java/de/sventorben/keycloak/authentication/hidpd/AuthenticationChallenge.java index 8b882d4..9223786 100755 --- a/src/main/java/de/sventorben/keycloak/authentication/hidpd/AuthenticationChallenge.java +++ b/src/main/java/de/sventorben/keycloak/authentication/hidpd/AuthenticationChallenge.java @@ -1,12 +1,12 @@ package de.sventorben.keycloak.authentication.hidpd; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import org.jboss.resteasy.specimpl.MultivaluedMapImpl; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.models.IdentityProviderModel; import org.keycloak.services.managers.AuthenticationManager; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; import java.util.List; final class AuthenticationChallenge { diff --git a/src/main/java/de/sventorben/keycloak/authentication/hidpd/BaseUriLoginFormsProvider.java b/src/main/java/de/sventorben/keycloak/authentication/hidpd/BaseUriLoginFormsProvider.java index b476c95..230583f 100755 --- a/src/main/java/de/sventorben/keycloak/authentication/hidpd/BaseUriLoginFormsProvider.java +++ b/src/main/java/de/sventorben/keycloak/authentication/hidpd/BaseUriLoginFormsProvider.java @@ -1,10 +1,10 @@ package de.sventorben.keycloak.authentication.hidpd; +import jakarta.ws.rs.core.UriBuilder; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.forms.login.freemarker.FreeMarkerLoginFormsProvider; import org.keycloak.services.resources.LoginActionsService; -import javax.ws.rs.core.UriBuilder; import java.net.URI; /** diff --git a/src/main/java/de/sventorben/keycloak/authentication/hidpd/HomeIdpDiscoveryAuthenticator.java b/src/main/java/de/sventorben/keycloak/authentication/hidpd/HomeIdpDiscoveryAuthenticator.java index e9c3d1a..e0b5fc0 100755 --- a/src/main/java/de/sventorben/keycloak/authentication/hidpd/HomeIdpDiscoveryAuthenticator.java +++ b/src/main/java/de/sventorben/keycloak/authentication/hidpd/HomeIdpDiscoveryAuthenticator.java @@ -1,5 +1,7 @@ package de.sventorben.keycloak.authentication.hidpd; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import org.jboss.logging.Logger; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationFlowError; @@ -15,8 +17,6 @@ import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.services.managers.AuthenticationManager; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; import java.util.List; import static org.keycloak.protocol.oidc.OIDCLoginProtocol.LOGIN_HINT_PARAM; diff --git a/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginForm.java b/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginForm.java index d95fe82..5672cdb 100755 --- a/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginForm.java +++ b/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginForm.java @@ -1,12 +1,12 @@ package de.sventorben.keycloak.authentication.hidpd; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.forms.login.LoginFormsProvider; import org.keycloak.forms.login.freemarker.model.IdentityProviderBean; import org.keycloak.models.IdentityProviderModel; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; import java.net.URI; import java.util.List; import java.util.stream.Collectors; diff --git a/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginPage.java b/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginPage.java index c97ba1a..1d3223f 100755 --- a/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginPage.java +++ b/src/main/java/de/sventorben/keycloak/authentication/hidpd/LoginPage.java @@ -2,18 +2,12 @@ import org.jboss.logging.Logger; import org.keycloak.authentication.AuthenticationFlowContext; -import org.keycloak.protocol.oidc.OIDCLoginProtocol; import org.keycloak.sessions.AuthenticationSessionModel; import org.keycloak.util.TokenUtil; -import javax.ws.rs.core.MultivaluedMap; - import java.util.Set; -import static org.keycloak.protocol.oidc.OIDCLoginProtocol.PROMPT_PARAM; -import static org.keycloak.protocol.oidc.OIDCLoginProtocol.PROMPT_VALUE_CONSENT; -import static org.keycloak.protocol.oidc.OIDCLoginProtocol.PROMPT_VALUE_LOGIN; -import static org.keycloak.protocol.oidc.OIDCLoginProtocol.PROMPT_VALUE_SELECT_ACCOUNT; +import static org.keycloak.protocol.oidc.OIDCLoginProtocol.*; import static org.keycloak.protocol.saml.SamlProtocol.SAML_FORCEAUTHN_REQUIREMENT; import static org.keycloak.protocol.saml.SamlProtocol.SAML_LOGIN_REQUEST_FORCEAUTHN; diff --git a/src/main/java/de/sventorben/keycloak/authentication/hidpd/Redirector.java b/src/main/java/de/sventorben/keycloak/authentication/hidpd/Redirector.java index 7254206..839d7c2 100755 --- a/src/main/java/de/sventorben/keycloak/authentication/hidpd/Redirector.java +++ b/src/main/java/de/sventorben/keycloak/authentication/hidpd/Redirector.java @@ -1,5 +1,6 @@ package de.sventorben.keycloak.authentication.hidpd; +import jakarta.ws.rs.core.Response; import org.jboss.logging.Logger; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.broker.provider.AuthenticationRequest; @@ -10,13 +11,10 @@ import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakUriInfo; import org.keycloak.models.RealmModel; -import org.keycloak.protocol.oidc.OIDCLoginProtocol; import org.keycloak.services.Urls; import org.keycloak.services.managers.ClientSessionCode; import org.keycloak.sessions.AuthenticationSessionModel; -import javax.ws.rs.core.Response; - import static org.keycloak.services.resources.IdentityBrokerService.getIdentityProviderFactory; final class Redirector { diff --git a/src/main/java/de/sventorben/keycloak/authentication/hidpd/RememberMe.java b/src/main/java/de/sventorben/keycloak/authentication/hidpd/RememberMe.java index 2f2a1e5..9ab5784 100644 --- a/src/main/java/de/sventorben/keycloak/authentication/hidpd/RememberMe.java +++ b/src/main/java/de/sventorben/keycloak/authentication/hidpd/RememberMe.java @@ -1,12 +1,11 @@ package de.sventorben.keycloak.authentication.hidpd; +import jakarta.ws.rs.core.MultivaluedMap; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.events.Details; import org.keycloak.models.RealmModel; import org.keycloak.services.managers.AuthenticationManager; -import javax.ws.rs.core.MultivaluedMap; - final class RememberMe { private final AuthenticationFlowContext context; diff --git a/src/test/java/de/sventorben/keycloak/authentication/AuthenticatorConfig.java b/src/test/java/de/sventorben/keycloak/authentication/AuthenticatorConfig.java index 381adc5..56ba181 100755 --- a/src/test/java/de/sventorben/keycloak/authentication/AuthenticatorConfig.java +++ b/src/test/java/de/sventorben/keycloak/authentication/AuthenticatorConfig.java @@ -1,11 +1,11 @@ package de.sventorben.keycloak.authentication; +import jakarta.ws.rs.core.Response; import org.keycloak.admin.client.Keycloak; import org.keycloak.admin.client.resource.AuthenticationManagementResource; import org.keycloak.representations.idm.AuthenticationExecutionInfoRepresentation; import org.keycloak.representations.idm.AuthenticatorConfigRepresentation; -import javax.ws.rs.core.Response; import java.util.Map; import java.util.function.Consumer; @@ -95,8 +95,10 @@ private void updateAuthenticatorConfig(Consumer