Skip to content

Commit

Permalink
chore: add patches for clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Aug 21, 2023
1 parent 5dde542 commit 6c6df6c
Show file tree
Hide file tree
Showing 4 changed files with 863 additions and 0 deletions.
97 changes: 97 additions & 0 deletions dev/clustering/idp-4.3.1.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
diff --git a/idp-parent/pom.xml b/idp-parent/pom.xml
index 5301dd763..f26e3c3e1 100644
--- a/idp-parent/pom.xml
+++ b/idp-parent/pom.xml
@@ -22,6 +22,14 @@
<version>4.3.1</version>
<packaging>pom</packaging>

+ <repositories>
+ <repository>
+ <id>shib</id>
+ <name>Shib</name>
+ <url>https://build.shibboleth.net/nexus/content/repositories/releases/</url>
+ </repository>
+ </repositories>
+
<modules>
<module>../idp-core</module>
<module>../idp-schema</module>
diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java
index a609d239f..d8a64fe8c 100644
--- a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/ExternalAuthentication.java
@@ -41,7 +41,7 @@ import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.logic.Constraint;

/** Public interface supporting external authentication outside the webflow engine. */
-public abstract class ExternalAuthentication {
+public abstract class ExternalAuthentication implements java.io.IOException {

/** Parameter supplied to locate the SWF object needed in the servlet context. */
@Nonnull @NotEmpty public static final String SWF_KEY = "net.shibboleth.idp.flowExecutor";
diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/CloneablePrincipal.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/CloneablePrincipal.java
index 044a34217..9966ecc42 100644
--- a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/CloneablePrincipal.java
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/CloneablePrincipal.java
@@ -20,7 +20,7 @@ package net.shibboleth.idp.authn.principal;
import java.security.Principal;

/** Principal that can be cloned without knowledge of the underlying type. */
-public interface CloneablePrincipal extends Principal, Cloneable {
+public interface CloneablePrincipal extends Principal, Cloneable, java.io.Serializable {

/**
* Creates and returns a copy of this object.
diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/PrincipalServiceManager.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/PrincipalServiceManager.java
index 02cc83bce..51beac25f 100644
--- a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/PrincipalServiceManager.java
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/PrincipalServiceManager.java
@@ -42,7 +42,7 @@ import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
*
* @since 4.1.0
*/
-public class PrincipalServiceManager {
+public class PrincipalServiceManager implements java.io.Serializable {

/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(PrincipalServiceManager.class);
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
index 7f0a2e52d..8ae88d21a 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
@@ -41,7 +41,7 @@ import net.shibboleth.utilities.java.support.collection.CollectionSupport;

/**
* Class to contain a processed form of the {@link UIInfo} suitable for display purposes. */
-public class IdPUIInfo {
+public class IdPUIInfo implements java.io.Serializable {

/** logger. */
private static final Logger LOG = LoggerFactory.getLogger(IdPUIInfo.class);
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SAMLArtifactConfiguration.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SAMLArtifactConfiguration.java
index fda5af020..3bafc604e 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SAMLArtifactConfiguration.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/SAMLArtifactConfiguration.java
@@ -25,7 +25,7 @@ import javax.annotation.Nullable;
* <p>While sufficient for known SAML 1 and 2 artifact types, the interface
* may be extended if necessary to carry type-specific additions.</p>
*/
-public interface SAMLArtifactConfiguration {
+public interface SAMLArtifactConfiguration extends java.io.Serializable {

/**
* Get the type code of the artifact to use.
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java
index 0877d0930..3c3382ad0 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/config/logic/AllowedSAMLPresentersPredicate.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
* Predicate which evaluates the inbound {@link SAMLPresenterEntityContext#getEntityId()}
* against a specified collection of entityIDs.
*/
-public class AllowedSAMLPresentersPredicate implements Predicate<ProfileRequestContext> {
+public class AllowedSAMLPresentersPredicate implements Predicate<ProfileRequestContext>, java.io.Serializable {

/** Logger. */
@Nonnull private Logger log = LoggerFactory.getLogger(AllowedSAMLPresentersPredicate.class);
125 changes: 125 additions & 0 deletions dev/clustering/java-support-8.4.0.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
diff --git a/pom.xml b/pom.xml
index f91007f..f4f3570 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,13 +3,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
-
+<!--
<parent>
<groupId>net.shibboleth</groupId>
<artifactId>parent</artifactId>
<version>11.3.5</version>
</parent>
-
+-->
<name>java-support</name>
<groupId>net.shibboleth.utilities</groupId>
<artifactId>java-support</artifactId>
@@ -22,8 +22,35 @@

<properties>
<automatic.module.name>net.shibboleth.utilities.java.support</automatic.module.name>
+ <slf4j.groupId>org.slf4j</slf4j.groupId>
+ <nashorn.jdk.version>15.3</nashorn.jdk.version>
+
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
</properties>

+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>net.shibboleth</groupId>
+ <artifactId>parent</artifactId>
+ <version>11.3.5</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <repositories>
+ <repository>
+ <id>shib</id>
+ <name>Shib</name>
+ <url>https://build.shibboleth.net/nexus/content/repositories/releases/</url>
+ <releases></releases>
+ <snapshots></snapshots>
+ </repository>
+ </repositories>
+
<scm>
<connection>scm:git:https://git.shibboleth.net/git/${project.artifactId}</connection>
<developerConnection>scm:git:[email protected]:${project.artifactId}</developerConnection>
@@ -117,6 +144,7 @@
<!-- Runtime Dependencies -->

<!-- Test Dependencies -->
+<!--
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@@ -137,7 +165,7 @@
<artifactId>spring-web</artifactId>
<scope>test</scope>
</dependency>
-
+-->
</dependencies>

<profiles>
diff --git a/src/main/java/net/shibboleth/utilities/java/support/collection/ClassIndexedSet.java b/src/main/java/net/shibboleth/utilities/java/support/collection/ClassIndexedSet.java
index 7b3fbdd..98e217f 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/collection/ClassIndexedSet.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/collection/ClassIndexedSet.java
@@ -34,7 +34,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
*
* @param <T> the type of object stored by this class
*/
-public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T> {
+public class ClassIndexedSet<T> extends AbstractSet<T> implements Set<T>, java.io.Serializable {

/** Storage for set members. */
private final HashSet<T> set;
diff --git a/src/main/java/net/shibboleth/utilities/java/support/collection/ClassToInstanceMultiMap.java b/src/main/java/net/shibboleth/utilities/java/support/collection/ClassToInstanceMultiMap.java
index 54cdf78..35a9a81 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/collection/ClassToInstanceMultiMap.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/collection/ClassToInstanceMultiMap.java
@@ -44,7 +44,7 @@ import javax.annotation.concurrent.NotThreadSafe;
* @param <B> a bound for the types of values in the map
*/
@NotThreadSafe
-public class ClassToInstanceMultiMap<B> {
+public class ClassToInstanceMultiMap<B> implements java.io.Serializable {

/** Whether supertypes should also be indexed. */
private final boolean indexSupertypes;
diff --git a/src/main/java/net/shibboleth/utilities/java/support/component/AbstractIdentifiableInitializableComponent.java b/src/main/java/net/shibboleth/utilities/java/support/component/AbstractIdentifiableInitializableComponent.java
index 6f4f26a..b5e432d 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/component/AbstractIdentifiableInitializableComponent.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/component/AbstractIdentifiableInitializableComponent.java
@@ -27,7 +27,7 @@ import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
*/
@ThreadSafe
public abstract class AbstractIdentifiableInitializableComponent extends AbstractIdentifiedInitializableComponent
- implements IdentifiableComponent {
+ implements IdentifiableComponent, java.io.Serializable {

/** {@inheritDoc} */
@Override public synchronized void setId(@Nonnull @NotEmpty final String componentId) {
diff --git a/src/main/java/net/shibboleth/utilities/java/support/component/Component.java b/src/main/java/net/shibboleth/utilities/java/support/component/Component.java
index c5b0170..1ffac53 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/component/Component.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/component/Component.java
@@ -18,6 +18,6 @@
package net.shibboleth.utilities.java.support.component;

/** A marker interface that represents something used as a discrete part of a larger system. */
-public interface Component {
+public interface Component extends java.io.Serializable {

}
\ No newline at end of file
132 changes: 132 additions & 0 deletions dev/clustering/jetty.project-jetty-10.0.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
diff -aurN '--exclude=.git' '--exclude=guava-*jre.jar' "jetty.project-jetty-10.0.15\\jetty-server.orig/src/main/java/org/eclipse/jetty/server/session/GluuObjectOutputStream.java" "jetty.project-jetty-10.0.15\\jetty-server/src/main/java/org/eclipse/jetty/server/session/GluuObjectOutputStream.java"
--- "jetty.project-jetty-10.0.15\\jetty-server.orig/src/main/java/org/eclipse/jetty/server/session/GluuObjectOutputStream.java" 1970-01-01 03:00:00.000000000 +0300
+++ "jetty.project-jetty-10.0.15\\jetty-server/src/main/java/org/eclipse/jetty/server/session/GluuObjectOutputStream.java" 2023-08-18 19:59:20.000000000 +0300
@@ -0,0 +1,36 @@
+package org.eclipse.jetty.server.session;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+
+public class GluuObjectOutputStream extends java.io.ObjectOutputStream {
+ private ObjectOutputStream oos = new ObjectOutputStream(new NullOutputStream());
+
+ public GluuObjectOutputStream(OutputStream out) throws IOException {
+ super(out);
+ enableReplaceObject(true);
+ }
+
+ @Override
+ protected Object replaceObject(Object obj) throws IOException {
+ try {
+ oos.writeObject(obj);
+ return obj;
+ } catch (Throwable ex) {
+ if (obj instanceof Serializable) {
+ return obj;
+ }
+
+ System.err.println("Skipping serialization of CLASS <<<" + obj.getClass() + ">>> object " + obj);
+ }
+
+ return null;
+ }
+
+ public class NullOutputStream extends OutputStream {
+ @Override
+ public void write(int b) throws IOException {}
+ }
+}
diff -aurN '--exclude=.git' '--exclude=guava-*jre.jar' "jetty.project-jetty-10.0.15\\jetty-server.orig/src/main/java/org/eclipse/jetty/server/session/SessionData.java" "jetty.project-jetty-10.0.15\\jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionData.java"
--- "jetty.project-jetty-10.0.15\\jetty-server.orig/src/main/java/org/eclipse/jetty/server/session/SessionData.java" 2023-04-11 20:24:32.000000000 +0300
+++ "jetty.project-jetty-10.0.15\\jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionData.java" 2023-08-18 20:21:10.000000000 +0300
@@ -13,8 +13,10 @@

package org.eclipse.jetty.server.session;

+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
+import java.util.Base64;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
@@ -68,8 +70,12 @@
public static void serializeAttributes(SessionData data, java.io.ObjectOutputStream out)
throws IOException
{
+ LOG.info("---------------------->>> SERIALIZE START");
int entries = data._attributes.size();
out.writeObject(entries);
+
+ //dumpAtributes(data, out);
+
for (Entry<String, Object> entry : data._attributes.entrySet())
{
out.writeUTF(entry.getKey());
@@ -109,10 +115,31 @@
if (LOG.isDebugEnabled())
LOG.debug("Attribute {} class={} isServerLoader={}", entry.getKey(), clazz.getName(), (!isContextLoader));
out.writeBoolean(!isContextLoader);
- out.writeObject(entry.getValue());
+
+ // Temporary code for trace
+ byte[] serializedDump = dumpObject(entry.getValue());
+ LOG.info("Attribute {} with class name {}. Serialized value size is: {}, dump in base64: {}", entry.getKey(), clazz.getName(), serializedDump.length, Base64.getEncoder().encodeToString(serializedDump));
+
+ out.write(serializedDump);
}
+ LOG.info("----------------------<<< SERIALIZE END");
}

+ private static byte[] dumpObject(Object value) throws IOException {
+ byte[] result = null;
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try (java.io.ObjectOutputStream out = new GluuObjectOutputStream(bos)) {
+ // Skip header
+ out.flush();
+ bos.reset();
+
+ out.writeObject(value);
+ out.flush();
+ result = bos.toByteArray();
+ }
+ return result;
+ }
+
/**
* De-serialize the attribute map of a session.
*
@@ -126,6 +153,7 @@
public static void deserializeAttributes(SessionData data, java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException
{
+ LOG.info("---------------------->>> DESERIALIZE START");
Object o = in.readObject();
if (o instanceof Integer)
{
@@ -143,8 +171,13 @@
boolean isServerClassLoader = in.readBoolean(); //use server or webapp classloader to load
if (LOG.isDebugEnabled())
LOG.debug("Deserialize {} isServerLoader={} serverLoader={} tccl={}", name, isServerClassLoader, serverLoader, contextLoader);
- Object value = ((ClassLoadingObjectInputStream)in).readObject(isServerClassLoader ? serverLoader : contextLoader);
- data._attributes.put(name, value);
+ try {
+ Object value = ((ClassLoadingObjectInputStream)in).readObject(isServerClassLoader ? serverLoader : contextLoader);
+ data._attributes.put(name, value);
+ LOG.info("Deserialize {} isServerLoader={} serverLoader={} tccl={}", name, isServerClassLoader, serverLoader, contextLoader);
+ } catch (java.io.OptionalDataException ex) {
+ LOG.info("Faield to deserialize {}", name);
+ }
}
}
else
@@ -155,6 +188,7 @@
data._attributes = new ConcurrentHashMap<>();
data.putAllAttributes((Map<String, Object>)o);
}
+ LOG.info("----------------------<<< DESERIALIZE END");
}

public SessionData(String id, String cpath, String vhost, long created, long accessed, long lastAccessed, long maxInactiveMs)
Loading

0 comments on commit 6c6df6c

Please sign in to comment.