To ensure backward compatibility, Security components that implement Serializable should have a serialVersionUID.
Based on internal testing across a few dozen JVMs, it appears that the serialVersionUID is consistent for Security's components. As such, we can safely add the calculated serialVersionUID value to each class that is missing it during the 6.4.x maintenance cycle.
When addressing a class that is missing its serialVersionUID, please do the following:
-
Add the calculated serialVersionUID (IDEs can usually do this for you, or you can use serialver which ships with the JVM)
-
In SpringSecurityCoreVersionSerializableTests, add the class and an example construction to the generatorByClassName map
-
Run SpringSecurityCoreVersionSerializableTests#serializeCurrentVersionClasses.
-
If successful, it will create a {className}.serialized file in config/src/main/resources/serialized:
Run the other tests in SpringSecurityCoreVersionSerializableTests; because it's new, the class will not be added to the list in shouldBeAbleToDeserializeClassFromPreviousVersion; however, the class should no longer be in the output for listClassesMissingSerialVersion
Commit the Serialiizable class(es) and SpringSecurityCoreVersionSerializableTests
-
If unsuccessful, it is usually because one of its members is not serializable. Find the unserializable member; file a ticket to ensure that it is made Serializable
Here are the classes:
You can also see the list of Serializable files by running:
./gradlew :spring-security-config:test --tests "*MissingSerialVersion*" -Pserialization
To ensure backward compatibility, Security components that implement
Serializableshould have aserialVersionUID.Based on internal testing across a few dozen JVMs, it appears that the
serialVersionUIDis consistent for Security's components. As such, we can safely add the calculatedserialVersionUIDvalue to each class that is missing it during the 6.4.x maintenance cycle.Serializableclasses missingserialVersionUIDSerializableclass is missing aserialVersionUID@SuppressWarnings("Serial")to opt-out ofserialVersionUIDWhen addressing a class that is missing its
serialVersionUID, please do the following:Add the calculated
serialVersionUID(IDEs can usually do this for you, or you can useserialverwhich ships with the JVM)In
SpringSecurityCoreVersionSerializableTests, add the class and an example construction to thegeneratorByClassNamemapRun
SpringSecurityCoreVersionSerializableTests#serializeCurrentVersionClasses.If successful, it will create a
{className}.serializedfile inconfig/src/main/resources/serialized:Run the other tests in
SpringSecurityCoreVersionSerializableTests; because it's new, the class will not be added to the list inshouldBeAbleToDeserializeClassFromPreviousVersion; however, the class should no longer be in the output forlistClassesMissingSerialVersionCommit the
Serialiizableclass(es) andSpringSecurityCoreVersionSerializableTestsIf unsuccessful, it is usually because one of its members is not serializable. Find the unserializable member; file a ticket to ensure that it is made
SerializableHere are the classes:
org.springframework.security.web.access.expression.WebExpressionConfigAttributeYou can also see the list of
Serializablefiles by running:./gradlew :spring-security-config:test --tests "*MissingSerialVersion*" -Pserialization