From 53dfa7c56b95540ac7cefee8a57f22f0c16e8080 Mon Sep 17 00:00:00 2001 From: Miquel Simon Date: Mon, 8 Jun 2020 09:12:45 +0200 Subject: [PATCH] KEYCLOAK-14109. Added profiles for Spring 2.3 version. KEYCLOAK-14737. Updated Jetty version to 9.4.29, as required per Spring 2.3. --- .../jetty/KeycloakJettyAuthenticator.java | 5 +-- adapters/saml/jetty/jetty9.4/pom.xml | 2 +- .../saml/jetty/Jetty9SessionManager.java | 13 +++++-- .../saml/jetty/KeycloakSamlAuthenticator.java | 5 +-- pom.xml | 1 + .../test-apps/spring-boot-adapter-app/pom.xml | 35 ++++++++++++++++++- .../tests/other/springboot-tests/pom.xml | 7 ++++ 7 files changed, 60 insertions(+), 8 deletions(-) diff --git a/adapters/oidc/jetty/jetty9.4/src/main/java/org/keycloak/adapters/jetty/KeycloakJettyAuthenticator.java b/adapters/oidc/jetty/jetty9.4/src/main/java/org/keycloak/adapters/jetty/KeycloakJettyAuthenticator.java index 800ba119e0..3ae9327cfe 100644 --- a/adapters/oidc/jetty/jetty9.4/src/main/java/org/keycloak/adapters/jetty/KeycloakJettyAuthenticator.java +++ b/adapters/oidc/jetty/jetty9.4/src/main/java/org/keycloak/adapters/jetty/KeycloakJettyAuthenticator.java @@ -50,8 +50,9 @@ public class KeycloakJettyAuthenticator extends AbstractKeycloakJettyAuthenticat protected Authentication createAuthentication(UserIdentity userIdentity, final Request request) { return new KeycloakAuthentication(getAuthMethod(), userIdentity) { @Override - public void logout() { - logoutCurrent(request); + public Authentication logout(ServletRequest servletRequest) { + logoutCurrent((Request) servletRequest); + return super.logout(servletRequest); } }; } diff --git a/adapters/saml/jetty/jetty9.4/pom.xml b/adapters/saml/jetty/jetty9.4/pom.xml index 2e7953349e..de3a45c4c3 100644 --- a/adapters/saml/jetty/jetty9.4/pom.xml +++ b/adapters/saml/jetty/jetty9.4/pom.xml @@ -29,7 +29,7 @@ keycloak-saml-jetty94-adapter Keycloak Jetty 9.4.x SAML Integration - 9.4.2.v20170220 + ${jetty94.version} org.keycloak.adapters.jetty.* diff --git a/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/Jetty9SessionManager.java b/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/Jetty9SessionManager.java index e21fcc1c66..bd560577b1 100755 --- a/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/Jetty9SessionManager.java +++ b/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/Jetty9SessionManager.java @@ -17,6 +17,7 @@ package org.keycloak.adapters.saml.jetty; +import org.eclipse.jetty.server.session.Session; import org.eclipse.jetty.server.session.SessionHandler; import org.keycloak.adapters.jetty.spi.JettySessionManager; @@ -34,7 +35,15 @@ public class Jetty9SessionManager implements JettySessionManager { } @Override - public HttpSession getHttpSession(String id) { - return sessionHandler.getHttpSession(id); + public HttpSession getHttpSession(String extendedId) { + // inlined code from sessionHandler.getHttpSession(extendedId) since the method visibility changed to protected + + String id = sessionHandler.getSessionIdManager().getId(extendedId); + Session session = sessionHandler.getSession(id); + + if (session != null && !session.getExtendedId().equals(extendedId)) { + session.setIdChanged(true); + } + return session; } } diff --git a/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/KeycloakSamlAuthenticator.java b/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/KeycloakSamlAuthenticator.java index 8d76fe1a8a..4ec71cd178 100644 --- a/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/KeycloakSamlAuthenticator.java +++ b/adapters/saml/jetty/jetty9.4/src/main/java/org/keycloak/adapters/saml/jetty/KeycloakSamlAuthenticator.java @@ -47,8 +47,9 @@ public class KeycloakSamlAuthenticator extends AbstractSamlAuthenticator { public Authentication createAuthentication(UserIdentity userIdentity, final Request request) { return new KeycloakAuthentication(getAuthMethod(), userIdentity) { @Override - public void logout() { - logoutCurrent(request); + public Authentication logout(ServletRequest servletRequest) { + logoutCurrent((Request) servletRequest); + return super.logout(servletRequest); } }; } diff --git a/pom.xml b/pom.xml index b031a74499..ddd79bd475 100755 --- a/pom.xml +++ b/pom.xml @@ -178,6 +178,7 @@ 1.5.20.RELEASE 2.1.3.RELEASE 2.2.0.RELEASE + 2.3.0.RELEASE 0.12.0.RELEASE diff --git a/testsuite/integration-arquillian/test-apps/spring-boot-adapter-app/pom.xml b/testsuite/integration-arquillian/test-apps/spring-boot-adapter-app/pom.xml index a31af7183f..4d3ac95938 100644 --- a/testsuite/integration-arquillian/test-apps/spring-boot-adapter-app/pom.xml +++ b/testsuite/integration-arquillian/test-apps/spring-boot-adapter-app/pom.xml @@ -17,7 +17,7 @@ 1.8 ${jetty94.version} - 1.5 + 2.3 false keycloak-tomcat-adapter @@ -438,6 +438,39 @@ + + spring.boot.2.3 + + + + springboot-version + 2.3 + + + + + ${spring-boot23.version} + + + + + + org.eclipse.jetty + jetty-bom + ${jetty.version} + pom + + + + + + + org.keycloak + keycloak-spring-boot-2-adapter + + + + spring-boot-adapter-tomcat diff --git a/testsuite/integration-arquillian/tests/other/springboot-tests/pom.xml b/testsuite/integration-arquillian/tests/other/springboot-tests/pom.xml index cff23b2e1d..59a7692621 100644 --- a/testsuite/integration-arquillian/tests/other/springboot-tests/pom.xml +++ b/testsuite/integration-arquillian/tests/other/springboot-tests/pom.xml @@ -215,6 +215,13 @@ + + springboot23 + + 2.3 + + + turn-on-repo-url