mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 01:02:14 +00:00
Ignore Serialization in Test Components
Since we don't need to ensure the serializability of test components across versions, we can ignore missing version UIDs when those test components aren't about testing Java serialization. Issue gh-17038
This commit is contained in:
parent
39fdceab59
commit
c3c2bcd6b7
@ -740,17 +740,11 @@ class SpringSecurityCoreVersionSerializableTests {
|
||||
}
|
||||
}
|
||||
|
||||
static Stream<Path> getCurrentSerializedFiles() throws IOException {
|
||||
static Stream<Path> getCurrentSerializedFiles() throws Exception {
|
||||
assertThat(currentVersionFolder.toFile().exists())
|
||||
.as("Make sure that the " + currentVersionFolder + " exists and is not empty")
|
||||
.isTrue();
|
||||
try (Stream<Path> files = Files.list(currentVersionFolder)) {
|
||||
if (files.findFirst().isEmpty()) {
|
||||
fail("Please make sure to run SpringSecurityCoreVersionSerializableTests#serializeCurrentVersionClasses for the "
|
||||
+ getPreviousVersion() + " version");
|
||||
}
|
||||
}
|
||||
return Files.list(currentVersionFolder);
|
||||
return getClassesToSerialize().map((clazz) -> currentVersionFolder.resolve(clazz.getName() + ".serialized"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
@ -55,6 +55,7 @@ public class Authz {
|
||||
return Mono.just(checkResult(result));
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class AuthzResult extends AuthorizationDecision {
|
||||
|
||||
public AuthzResult(boolean granted) {
|
||||
|
@ -16,18 +16,15 @@
|
||||
|
||||
package org.springframework.security.access.annotation;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Joe Scalise
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BusinessServiceImpl<E extends Entity> implements BusinessService {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4249394090237180795L;
|
||||
|
||||
@Override
|
||||
@Secured({ "ROLE_USER" })
|
||||
public void someUserMethod1() {
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.security.access.annotation;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -24,11 +23,9 @@ import org.springframework.security.access.prepost.PostFilter;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.access.prepost.PreFilter;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ExpressionProtectedBusinessServiceImpl implements BusinessService {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3320014879907436606L;
|
||||
|
||||
@Override
|
||||
public void someAdminMethod() {
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.security.access.annotation;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -27,11 +26,9 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
* @author Luke Taylor
|
||||
*/
|
||||
@PermitAll
|
||||
@SuppressWarnings("serial")
|
||||
public class Jsr250BusinessServiceImpl implements BusinessService {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -7550211450382764339L;
|
||||
|
||||
@Override
|
||||
@RolesAllowed("ROLE_USER")
|
||||
public void someUserMethod1() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user