This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/master by this push:
     new a7652a6a92 Moving to Spring Boot 3.3 and CAS 7.1 (#768)
a7652a6a92 is described below

commit a7652a6a92dd38fc734afec3fa568cd692d27399
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Sat Jun 29 10:28:17 2024 +0200

    Moving to Spring Boot 3.3 and CAS 7.1 (#768)
---
 .../jpa/entity/JPAJSONEntityListener.java          |  2 +-
 .../org/apache/syncope/fit/AbstractITCase.java     | 14 +++++++---
 .../org/apache/syncope/fit/AbstractUIITCase.java   | 16 ++++++++---
 pom.xml                                            |  8 +++---
 .../syncope/wa/starter/SyncopeWAApplication.java   |  7 -----
 .../syncope/wa/starter/config/WAContext.java       |  3 ++
 .../idp/metadata/WASamlIdPMetadataLocator.java     |  4 ++-
 .../WASurrogateAuthenticationService.java          | 11 ++++++--
 .../apache/syncope/wa/starter/AbstractTest.java    | 32 +++++++++++-----------
 .../WASurrogateAuthenticationServiceTest.java      |  2 +-
 10 files changed, 59 insertions(+), 40 deletions(-)

diff --git 
a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAJSONEntityListener.java
 
b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAJSONEntityListener.java
index bb86ed0f52..305e9d8772 100644
--- 
a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAJSONEntityListener.java
+++ 
b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAJSONEntityListener.java
@@ -53,7 +53,7 @@ public abstract class JPAJSONEntityListener<A extends Any<?>> 
{
 
     protected void list2json(final JSONAttributable<A> entity) {
         entity.setPlainAttrsJSON(entity.getPlainAttrList().isEmpty()
-                ? "[{}]"
+                ? "[]"
                 : POJOHelper.serialize(entity.getPlainAttrList()));
     }
 }
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index e05f1a1def..6ceef5df77 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -38,6 +38,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
@@ -480,13 +481,18 @@ public abstract class AbstractITCase {
         WEBAUTHN_REGISTRATION_SERVICE = 
ANONYMOUS_CLIENT.getService(WebAuthnRegistrationService.class);
         IMPERSONATION_SERVICE = 
ANONYMOUS_CLIENT.getService(ImpersonationService.class);
 
-        JsonNode beans = JSON_MAPPER.readTree(
-                (InputStream) WebClient.create(
-                        StringUtils.substringBeforeLast(ADDRESS, "/") + 
"/actuator/beans",
+        String beansJSON = await().atMost(10, 
TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(() -> {
+            try {
+                return 
WebClient.create(StringUtils.substringBeforeLast(ADDRESS, "/") + 
"/actuator/beans",
                         ANONYMOUS_UNAME,
                         ANONYMOUS_KEY,
                         null).
-                        accept(MediaType.APPLICATION_JSON).get().getEntity());
+                        
accept(MediaType.APPLICATION_JSON).get().readEntity(String.class);
+            } catch (Exception e) {
+                return null;
+            }
+        }, Objects::nonNull);
+        JsonNode beans = JSON_MAPPER.readTree(beansJSON);
 
         JsonNode uwfAdapter = beans.findValues("uwfAdapter").get(0);
         IS_FLOWABLE_ENABLED = 
uwfAdapter.get("resource").asText().contains("Flowable");
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractUIITCase.java 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractUIITCase.java
index bae049623a..20d5c8db9d 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractUIITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractUIITCase.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.fit;
 
+import static org.awaitility.Awaitility.await;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.fail;
@@ -29,8 +30,10 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
 import java.lang.reflect.Method;
+import java.util.Objects;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -91,13 +94,18 @@ public abstract class AbstractUIITCase {
         assertNotNull(ANONYMOUS_UNAME);
         assertNotNull(ANONYMOUS_KEY);
 
-        JsonNode beans = JSON_MAPPER.readTree(
-                (InputStream) WebClient.create(
-                        StringUtils.substringBeforeLast(ADDRESS, "/") + 
"/actuator/beans",
+        String beansJSON = await().atMost(10, 
TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(() -> {
+            try {
+                return 
WebClient.create(StringUtils.substringBeforeLast(ADDRESS, "/") + 
"/actuator/beans",
                         ANONYMOUS_UNAME,
                         ANONYMOUS_KEY,
                         null).
-                        accept(MediaType.APPLICATION_JSON).get().getEntity());
+                        
accept(MediaType.APPLICATION_JSON).get().readEntity(String.class);
+            } catch (Exception e) {
+                return null;
+            }
+        }, Objects::nonNull);
+        JsonNode beans = JSON_MAPPER.readTree(beansJSON);
 
         JsonNode uwfAdapter = beans.findValues("uwfAdapter").get(0);
         IS_FLOWABLE_ENABLED = 
uwfAdapter.get("resource").asText().contains("Flowable");
diff --git a/pom.xml b/pom.xml
index 8d3fc70366..d72371f48f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -409,11 +409,11 @@ under the License.
     <connid.okta.version>3.0.4</connid.okta.version>
     <connid.cmd.version>0.5</connid.cmd.version>
 
-    <cxf.version>4.0.4</cxf.version>
+    <cxf.version>4.1.0-SNAPSHOT</cxf.version>
     <bouncycastle.version>1.78.1</bouncycastle.version>
     <nimbus-jose-jwt.version>9.40</nimbus-jose-jwt.version>
 
-    <spring-boot.version>3.2.7</spring-boot.version>
+    <spring-boot.version>3.3.1</spring-boot.version>
     <spring-cloud-gateway.version>4.1.4</spring-cloud-gateway.version>
 
     <openjpa.version>4.0.0</openjpa.version>
@@ -437,7 +437,7 @@ under the License.
 
     <pac4j.version>6.0.4.1</pac4j.version>
 
-    <cas.version>7.0.5.1</cas.version>
+    <cas.version>7.1.0-RC4</cas.version>
     <cas-client.version>4.0.4</cas-client.version>
 
     <h2.version>2.2.224</h2.version>
@@ -501,7 +501,7 @@ under the License.
     <docker.postgresql.version>16</docker.postgresql.version>
     <docker.mysql.version>8.0</docker.mysql.version>
     <docker.mariadb.version>11</docker.mariadb.version>
-    <docker.neo4j.version>5.20.0</docker.neo4j.version>
+    <docker.neo4j.version>5.21.0</docker.neo4j.version>
 
     <jdbc.postgresql.version>42.7.3</jdbc.postgresql.version>
     <jdbc.mysql.version>8.4.0</jdbc.mysql.version>
diff --git 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java
 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java
index b5e4525c47..9c291af8b1 100644
--- 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java
+++ 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java
@@ -23,7 +23,6 @@ import java.util.Map;
 import org.apache.syncope.wa.bootstrap.WAProperties;
 import org.apache.syncope.wa.bootstrap.WARestClient;
 import org.apache.syncope.wa.starter.config.WARefreshContextJob;
-import org.apereo.cas.config.GoogleAuthenticatorLdapConfiguration;
 import org.apereo.cas.configuration.CasConfigurationProperties;
 import org.apereo.cas.configuration.CasConfigurationPropertiesValidator;
 import 
org.apereo.cas.support.saml.idp.metadata.generator.SamlIdPMetadataGenerator;
@@ -56,12 +55,6 @@ import 
org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 @SpringBootApplication(exclude = {
-    /*
-     * List of CAS-specific classes that we want to exclude from 
auto-configuration.
-     * This is required when there is a competing option/implementation 
available in Syncope that needs to be
-     * conditionally activated.
-     */
-    GoogleAuthenticatorLdapConfiguration.class,
     /*
      * List of Spring Boot classes that we want to disable and remove from 
auto-configuration.
      */
diff --git 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java
index 3042232d1c..18fdb485ae 100644
--- 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java
+++ 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java
@@ -97,6 +97,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.context.ApplicationContext;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -251,11 +252,13 @@ public class WAContext {
             final CipherExecutor<String, String> cipherExecutor,
             @Qualifier("samlIdPMetadataCache")
             final Cache<String, SamlIdPMetadataDocument> samlIdPMetadataCache,
+            final ApplicationContext applicationContext,
             final WARestClient waRestClient) {
 
         return new WASamlIdPMetadataLocator(
                 cipherExecutor,
                 samlIdPMetadataCache,
+                applicationContext,
                 waRestClient);
     }
 
diff --git 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/WASamlIdPMetadataLocator.java
 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/WASamlIdPMetadataLocator.java
index 8805cced02..f8faec6148 100644
--- 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/WASamlIdPMetadataLocator.java
+++ 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/WASamlIdPMetadataLocator.java
@@ -33,6 +33,7 @@ import 
org.apereo.cas.support.saml.services.idp.metadata.SamlIdPMetadataDocument
 import org.apereo.cas.util.crypto.CipherExecutor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
 
 public class WASamlIdPMetadataLocator extends AbstractSamlIdPMetadataLocator {
 
@@ -43,9 +44,10 @@ public class WASamlIdPMetadataLocator extends 
AbstractSamlIdPMetadataLocator {
     public WASamlIdPMetadataLocator(
             final CipherExecutor<String, String> metadataCipherExecutor,
             final Cache<String, SamlIdPMetadataDocument> metadataCache,
+            final ApplicationContext applicationContext,
             final WARestClient waRestClient) {
 
-        super(metadataCipherExecutor, metadataCache);
+        super(metadataCipherExecutor, metadataCache, applicationContext);
         this.waRestClient = waRestClient;
     }
 
diff --git 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationService.java
 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationService.java
index 0292536159..fe6c126f19 100644
--- 
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationService.java
+++ 
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationService.java
@@ -40,7 +40,11 @@ public class WASurrogateAuthenticationService implements 
SurrogateAuthentication
     }
 
     @Override
-    public boolean canImpersonate(final String surrogate, final Principal 
principal, final Optional<Service> service) {
+    public boolean canImpersonate(
+            final String surrogate,
+            final Principal principal,
+            final Optional<? extends Service> service) {
+
         try {
             LOG.debug("Checking impersonation attempt by {} for {}", 
principal, surrogate);
 
@@ -53,7 +57,10 @@ public class WASurrogateAuthenticationService implements 
SurrogateAuthentication
     }
 
     @Override
-    public Collection<String> getImpersonationAccounts(final String username) {
+    public Collection<String> getImpersonationAccounts(
+            final String username,
+            final Optional<? extends Service> service) {
+
         return 
waRestClient.getService(ImpersonationService.class).read(username).
                 stream().
                 map(ImpersonationAccount::getImpersonated).
diff --git 
a/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java 
b/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java
index 226d6545e4..f06aa39938 100644
--- a/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java
+++ b/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java
@@ -37,10 +37,10 @@ import 
org.apereo.cas.authentication.attribute.AttributeDefinitionStore;
 import org.apereo.cas.authentication.principal.Principal;
 import org.apereo.cas.authentication.principal.PrincipalResolver;
 import org.apereo.cas.authentication.principal.Service;
+import org.apereo.cas.authentication.principal.attribute.PersonAttributeDao;
+import 
org.apereo.cas.authentication.principal.attribute.PersonAttributeDaoFilter;
+import org.apereo.cas.authentication.principal.attribute.PersonAttributes;
 import org.apereo.cas.services.RegisteredService;
-import org.apereo.services.persondir.IPersonAttributeDao;
-import org.apereo.services.persondir.IPersonAttributeDaoFilter;
-import org.apereo.services.persondir.IPersonAttributes;
 import org.junit.jupiter.api.BeforeEach;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -67,22 +67,22 @@ import org.springframework.test.context.TestPropertySource;
 @ContextConfiguration(initializers = ZookeeperTestingServer.class)
 public abstract class AbstractTest {
 
-    private static class DummyIPersonAttributeDao implements 
IPersonAttributeDao {
+    private static class DummyIPersonAttributeDao implements 
PersonAttributeDao {
 
         @Override
-        public IPersonAttributes getPerson(
-                final String string,
-                final Set<IPersonAttributes> set,
-                final IPersonAttributeDaoFilter ipadf) {
+        public PersonAttributes getPerson(
+                final String uid,
+                final Set<PersonAttributes> resultPeople,
+                final PersonAttributeDaoFilter filter) {
 
             return null;
         }
 
         @Override
-        public Set<IPersonAttributes> getPeople(
-                final Map<String, Object> map,
-                final IPersonAttributeDaoFilter ipadf,
-                final Set<IPersonAttributes> set) {
+        public Set<PersonAttributes> getPeople(
+                final Map<String, Object> query,
+                final PersonAttributeDaoFilter filter,
+                final Set<PersonAttributes> resultPeople) {
 
             return Set.of();
         }
@@ -93,7 +93,7 @@ public abstract class AbstractTest {
         }
 
         @Override
-        public int compareTo(final IPersonAttributeDao o) {
+        public int compareTo(final PersonAttributeDao o) {
             return 0;
         }
 
@@ -104,7 +104,7 @@ public abstract class AbstractTest {
 
         @Override
         public boolean equals(final Object obj) {
-            return obj instanceof IPersonAttributeDao;
+            return obj instanceof PersonAttributeDao;
         }
     }
 
@@ -215,13 +215,13 @@ public abstract class AbstractTest {
 
         @Bean(name = { "cachingAttributeRepository", 
PrincipalResolver.BEAN_NAME_ATTRIBUTE_REPOSITORY })
         @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
-        public IPersonAttributeDao cachingAttributeRepository() {
+        public PersonAttributeDao cachingAttributeRepository() {
             return new DummyIPersonAttributeDao();
         }
 
         @Bean(name = "aggregatingAttributeRepository")
         @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
-        public IPersonAttributeDao aggregatingAttributeRepository() {
+        public PersonAttributeDao aggregatingAttributeRepository() {
             return new DummyIPersonAttributeDao();
         }
     }
diff --git 
a/wa/starter/src/test/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationServiceTest.java
 
b/wa/starter/src/test/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationServiceTest.java
index 9e20d12dce..4fae8f43cd 100644
--- 
a/wa/starter/src/test/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationServiceTest.java
+++ 
b/wa/starter/src/test/java/org/apache/syncope/wa/starter/surrogate/WASurrogateAuthenticationServiceTest.java
@@ -50,7 +50,7 @@ public class WASurrogateAuthenticationServiceTest extends 
AbstractTest {
 
         impersonationService.create(owner, account);
 
-        
assertFalse(surrogateService.getImpersonationAccounts(owner).isEmpty());
+        assertFalse(surrogateService.getImpersonationAccounts(owner, 
Optional.empty()).isEmpty());
 
         Principal principal = 
PrincipalFactoryUtils.newPrincipalFactory().createPrincipal(owner);
         assertFalse(surrogateService.canImpersonate("unknown", principal, 
Optional.empty()));

Reply via email to