Skip to content

Commit

Permalink
chore!(deps): Update Keycloak dependencies to 22.0.0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sventorben committed Jul 11, 2023
1 parent 64f1ba7 commit 5a3e2d2
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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?
Expand Down
27 changes: 3 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>de.sventorben.keycloak</groupId>
<artifactId>keycloak-home-idp-discovery</artifactId>
<version>21.3.1-SNAPSHOT</version>
<version>22.0.0-SNAPSHOT</version>

<name>Keycloak: Home IdP Discovery</name>
<description>A Keycloak authenticator to redirect users to their home IdP</description>
Expand Down Expand Up @@ -51,7 +51,7 @@
<maven.compiler.release>17</maven.compiler.release>

<!-- For compilation -->
<version.keycloak>21.1.2</version.keycloak>
<version.keycloak>22.0.0</version.keycloak>

<!-- For compatibility tests -->
<keycloak.version>${version.keycloak}</keycloak.version>
Expand Down Expand Up @@ -156,27 +156,6 @@
<dependencyManagement>
<dependencies>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>4.7.4.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>4.7.4.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>4.7.4.Final</version>
<scope>test</scope>
</dependency>

<!-- Tests -->
<dependency>
<groupId>org.junit</groupId>
Expand Down Expand Up @@ -273,7 +252,7 @@
<dependency>
<groupId>com.github.dasniko</groupId>
<artifactId>testcontainers-keycloak</artifactId>
<version>2.5.0</version>
<version>3.0.0</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -95,8 +95,10 @@ private void updateAuthenticatorConfig(Consumer<AuthenticatorConfigRepresentatio
if (authenticationConfigId == null) {
authenticatorConfig = new AuthenticatorConfigRepresentation();
authenticatorConfig.setAlias(authenticatorConfigAlias);
Response response = flows.newExecutionConfig(execution.getId(), authenticatorConfig);
String location = response.getHeaderString("Location");
String location;
try (Response response = flows.newExecutionConfig(execution.getId(), authenticatorConfig)) {
location = response.getHeaderString("Location");
}
authenticationConfigId = location.substring(location.lastIndexOf("/") + 1);
} else {
authenticatorConfig = flows.getAuthenticatorConfig(authenticationConfigId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;

import static org.assertj.core.api.Assertions.assertThat;
import static org.keycloak.protocol.oidc.OIDCLoginProtocol.PROMPT_PARAM;
import static org.keycloak.protocol.oidc.OIDCLoginProtocol.PROMPT_VALUE_CONSENT;
Expand Down

0 comments on commit 5a3e2d2

Please sign in to comment.