From fc7d5dae3813c35136fbb221d859ce004ae72be9 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Thu, 21 Dec 2023 09:05:41 +0100 Subject: [PATCH] feat: Cleanup Dependencies to rely on Spring Dependencies Tree - Meeds-io/MIPs#57 --- sso-agent/pom.xml | 4 +- sso-saml-plugin/pom.xml | 23 ++- .../saml/plugin/filter/SAML2LogoutFilter.java | 2 +- .../plugin/valve/BaseFormAuthenticator.java | 2 +- .../src/main/patches/javax.persistence.patch | 175 ++++++++++++++++++ 5 files changed, 195 insertions(+), 11 deletions(-) create mode 100644 sso-saml-plugin/src/main/patches/javax.persistence.patch diff --git a/sso-agent/pom.xml b/sso-agent/pom.xml index 1c88dbf75..bffcd7ee4 100644 --- a/sso-agent/pom.xml +++ b/sso-agent/pom.xml @@ -42,8 +42,8 @@ provided - org.apache.httpcomponents - httpclient + org.apache.httpcomponents.client5 + httpclient5 provided diff --git a/sso-saml-plugin/pom.xml b/sso-saml-plugin/pom.xml index 85956e6ff..ceb592aac 100644 --- a/sso-saml-plugin/pom.xml +++ b/sso-saml-plugin/pom.xml @@ -202,7 +202,7 @@ provided - org.hibernate + org.hibernate.orm hibernate-core provided @@ -286,8 +286,8 @@ exo.core.component.organization.api - org.apache.httpcomponents - httpclient + org.apache.httpcomponents.client5 + httpclient5 org.mockito @@ -405,8 +405,7 @@ ${basedir}/src/main/patches/java.security.acl.Group.patch - - ${project.build.directory}/java.security.acl.Group-patches-applied.txt + ${project.build.directory}/java.security.acl.Group-patches-applied.txt skip process-resources @@ -418,8 +417,18 @@ javax.servlet-patch ${basedir}/src/main/patches/javax.servlet.patch - - ${project.build.directory}/javax.servlet-patches-applied.txt + ${project.build.directory}/javax.servlet-patches-applied.txt + + process-resources + + apply + + + + javax.persistence-patch + + ${basedir}/src/main/patches/javax.persistence.patch + ${project.build.directory}/javax.persistence-patches-applied.txt process-resources diff --git a/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/filter/SAML2LogoutFilter.java b/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/filter/SAML2LogoutFilter.java index 31c32e8a9..272a45656 100644 --- a/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/filter/SAML2LogoutFilter.java +++ b/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/filter/SAML2LogoutFilter.java @@ -2,7 +2,7 @@ import java.io.IOException; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.gatein.sso.agent.filter.api.SSOInterceptor; import org.gatein.sso.agent.filter.api.SSOInterceptorInitializationContext; import org.picketlink.common.constants.GeneralConstants; diff --git a/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/valve/BaseFormAuthenticator.java b/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/valve/BaseFormAuthenticator.java index eb8571056..6748283ee 100644 --- a/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/valve/BaseFormAuthenticator.java +++ b/sso-saml-plugin/src/main/java/org/gatein/sso/saml/plugin/valve/BaseFormAuthenticator.java @@ -35,7 +35,7 @@ import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.tomcat.util.descriptor.web.LoginConfig; import org.gatein.sso.saml.plugin.filter.SAMLSPServletContextWrapper; import org.picketlink.common.ErrorCodes; diff --git a/sso-saml-plugin/src/main/patches/javax.persistence.patch b/sso-saml-plugin/src/main/patches/javax.persistence.patch new file mode 100644 index 000000000..b6cb973df --- /dev/null +++ b/sso-saml-plugin/src/main/patches/javax.persistence.patch @@ -0,0 +1,175 @@ +diff -uNr picketlink-orig/org/jboss/security/acl/ACLEntryImpl.java picketlink/org/jboss/security/acl/ACLEntryImpl.java +--- picketlink-orig/org/jboss/security/acl/ACLEntryImpl.java 2013-10-08 17:01:34.000000000 +0100 ++++ picketlink/org/jboss/security/acl/ACLEntryImpl.java 2023-12-21 09:00:31.807478000 +0100 +@@ -23,14 +23,14 @@ + + import java.io.Serializable; + +-import javax.persistence.Entity; +-import javax.persistence.GeneratedValue; +-import javax.persistence.Id; +-import javax.persistence.ManyToOne; +-import javax.persistence.PostLoad; +-import javax.persistence.PrePersist; +-import javax.persistence.Table; +-import javax.persistence.Transient; ++import jakarta.persistence.Entity; ++import jakarta.persistence.GeneratedValue; ++import jakarta.persistence.Id; ++import jakarta.persistence.ManyToOne; ++import jakarta.persistence.PostLoad; ++import jakarta.persistence.PrePersist; ++import jakarta.persistence.Table; ++import jakarta.persistence.Transient; + + import org.jboss.security.PicketBoxMessages; + import org.jboss.security.identity.Identity; +diff -uNr picketlink-orig/org/jboss/security/acl/ACLImpl.java picketlink/org/jboss/security/acl/ACLImpl.java +--- picketlink-orig/org/jboss/security/acl/ACLImpl.java 2013-10-08 17:01:34.000000000 +0100 ++++ picketlink/org/jboss/security/acl/ACLImpl.java 2023-12-21 09:00:31.811478000 +0100 +@@ -28,15 +28,15 @@ + import java.util.HashMap; + import java.util.Map; + +-import javax.persistence.CascadeType; +-import javax.persistence.Column; +-import javax.persistence.Entity; +-import javax.persistence.FetchType; +-import javax.persistence.GeneratedValue; +-import javax.persistence.Id; +-import javax.persistence.OneToMany; +-import javax.persistence.Table; +-import javax.persistence.Transient; ++import jakarta.persistence.CascadeType; ++import jakarta.persistence.Column; ++import jakarta.persistence.Entity; ++import jakarta.persistence.FetchType; ++import jakarta.persistence.GeneratedValue; ++import jakarta.persistence.Id; ++import jakarta.persistence.OneToMany; ++import jakarta.persistence.Table; ++import jakarta.persistence.Transient; + + import org.hibernate.annotations.Cascade; + import org.jboss.security.PicketBoxMessages; +diff -uNr picketlink-orig/org/jboss/security/acl/JPAPersistenceStrategy.java picketlink/org/jboss/security/acl/JPAPersistenceStrategy.java +--- picketlink-orig/org/jboss/security/acl/JPAPersistenceStrategy.java 2013-10-08 17:01:34.000000000 +0100 ++++ picketlink/org/jboss/security/acl/JPAPersistenceStrategy.java 2023-12-21 09:00:31.819478000 +0100 +@@ -5,11 +5,11 @@ + import java.util.HashMap; + import java.util.Map; + +-import javax.persistence.EntityManager; +-import javax.persistence.EntityManagerFactory; +-import javax.persistence.EntityTransaction; +-import javax.persistence.NoResultException; +-import javax.persistence.Persistence; ++import jakarta.persistence.EntityManager; ++import jakarta.persistence.EntityManagerFactory; ++import jakarta.persistence.EntityTransaction; ++import jakarta.persistence.NoResultException; ++import jakarta.persistence.Persistence; + + import org.jboss.security.PicketBoxMessages; + import org.jboss.security.authorization.Resource; +diff -uNr picketlink-orig/org/jboss/security/acl/Util.java picketlink/org/jboss/security/acl/Util.java +--- picketlink-orig/org/jboss/security/acl/Util.java 2013-10-08 17:01:34.000000000 +0100 ++++ picketlink/org/jboss/security/acl/Util.java 2023-12-21 09:00:31.819478000 +0100 +@@ -112,7 +112,7 @@ + /** + *

+ * Obtains an {@code Object} that can represent the specified resource uniquely. It first tries to find +- * a {@code Field} annotated with a {@code javax.persistence.Id} annotation. If such field is found, the ++ * a {@code Field} annotated with a {@code jakarta.persistence.Id} annotation. If such field is found, the + * method tries to read the field's value. If no annotated field is found, this method just tries to + * invoke a {@code getId()} method on the resource. + *

+@@ -125,10 +125,10 @@ + { + Class resourceClass = resource.getClass(); + Object resourceKey = null; +- // first search for a field with a javax.persistence.Id annotation. ++ // first search for a field with a jakarta.persistence.Id annotation. + for (Field field : resourceClass.getDeclaredFields()) + { +- if (field.getAnnotation(javax.persistence.Id.class) != null) ++ if (field.getAnnotation(jakarta.persistence.Id.class) != null) + { + // found a field - try to get its value reflectively. + try +diff -uNr picketlink-orig/org/picketlink/identity/federation/core/sts/registry/AbstractJPARegistry.java picketlink/org/picketlink/identity/federation/core/sts/registry/AbstractJPARegistry.java +--- picketlink-orig/org/picketlink/identity/federation/core/sts/registry/AbstractJPARegistry.java 2015-02-23 17:06:38.000000000 +0100 ++++ picketlink/org/picketlink/identity/federation/core/sts/registry/AbstractJPARegistry.java 2023-12-21 09:00:31.819478000 +0100 +@@ -21,8 +21,8 @@ + import org.picketlink.common.PicketLinkLogger; + import org.picketlink.common.PicketLinkLoggerFactory; + +-import javax.persistence.EntityManagerFactory; +-import javax.persistence.Persistence; ++import jakarta.persistence.EntityManagerFactory; ++import jakarta.persistence.Persistence; + + /** + * @author Pedro Silva +diff -uNr picketlink-orig/org/picketlink/identity/federation/core/sts/registry/JPABasedRevocationRegistry.java picketlink/org/picketlink/identity/federation/core/sts/registry/JPABasedRevocationRegistry.java +--- picketlink-orig/org/picketlink/identity/federation/core/sts/registry/JPABasedRevocationRegistry.java 2015-02-23 17:06:38.000000000 +0100 ++++ picketlink/org/picketlink/identity/federation/core/sts/registry/JPABasedRevocationRegistry.java 2023-12-21 09:00:31.823478000 +0100 +@@ -17,8 +17,8 @@ + */ + package org.picketlink.identity.federation.core.sts.registry; + +-import javax.persistence.EntityManager; +-import javax.persistence.EntityTransaction; ++import jakarta.persistence.EntityManager; ++import jakarta.persistence.EntityTransaction; + + /** + *

+diff -uNr picketlink-orig/org/picketlink/identity/federation/core/sts/registry/JPABasedTokenRegistry.java picketlink/org/picketlink/identity/federation/core/sts/registry/JPABasedTokenRegistry.java +--- picketlink-orig/org/picketlink/identity/federation/core/sts/registry/JPABasedTokenRegistry.java 2015-08-21 10:05:52.000000000 +0100 ++++ picketlink/org/picketlink/identity/federation/core/sts/registry/JPABasedTokenRegistry.java 2023-12-21 09:00:31.823478000 +0100 +@@ -18,8 +18,8 @@ + + package org.picketlink.identity.federation.core.sts.registry; + +-import javax.persistence.EntityManager; +-import javax.persistence.EntityTransaction; ++import jakarta.persistence.EntityManager; ++import jakarta.persistence.EntityTransaction; + import java.io.IOException; + + /** +diff -uNr picketlink-orig/org/picketlink/identity/federation/core/sts/registry/RevokedToken.java picketlink/org/picketlink/identity/federation/core/sts/registry/RevokedToken.java +--- picketlink-orig/org/picketlink/identity/federation/core/sts/registry/RevokedToken.java 2015-02-23 17:06:38.000000000 +0100 ++++ picketlink/org/picketlink/identity/federation/core/sts/registry/RevokedToken.java 2023-12-21 09:00:31.823478000 +0100 +@@ -17,9 +17,9 @@ + */ + package org.picketlink.identity.federation.core.sts.registry; + +-import javax.persistence.Column; +-import javax.persistence.Entity; +-import javax.persistence.Id; ++import jakarta.persistence.Column; ++import jakarta.persistence.Entity; ++import jakarta.persistence.Id; + + /** + *

+diff -uNr picketlink-orig/org/picketlink/identity/federation/core/sts/registry/SecurityToken.java picketlink/org/picketlink/identity/federation/core/sts/registry/SecurityToken.java +--- picketlink-orig/org/picketlink/identity/federation/core/sts/registry/SecurityToken.java 2015-02-23 17:06:38.000000000 +0100 ++++ picketlink/org/picketlink/identity/federation/core/sts/registry/SecurityToken.java 2023-12-21 09:00:31.823478000 +0100 +@@ -17,10 +17,10 @@ + */ + package org.picketlink.identity.federation.core.sts.registry; + +-import javax.persistence.Column; +-import javax.persistence.Entity; +-import javax.persistence.Id; +-import javax.persistence.Lob; ++import jakarta.persistence.Column; ++import jakarta.persistence.Entity; ++import jakarta.persistence.Id; ++import jakarta.persistence.Lob; + import java.io.ByteArrayInputStream; + import java.io.ByteArrayOutputStream; + import java.io.ObjectInputStream;