|
|
@@ -34,7 +34,6 @@ import java.util.TreeSet;
|
|
|
import java.util.function.Supplier;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
-import org.junit.jupiter.api.Disabled;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import tools.jackson.databind.json.JsonMapper;
|
|
|
|
|
|
@@ -50,6 +49,7 @@ import org.springframework.security.authorization.method.AuthorizationAdvisorPro
|
|
|
import org.springframework.security.authorization.method.AuthorizationProxy;
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
+import org.springframework.security.jackson.CoreJacksonModule;
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|
|
@@ -340,15 +340,13 @@ public class AuthorizationAdvisorProxyFactoryTests {
|
|
|
assertThat(factory.proxy(35)).isEqualTo(35);
|
|
|
}
|
|
|
|
|
|
- // TODO Find why callbacks property is serialized with Jackson 3, not with Jackson 2
|
|
|
- // FIXME: https://github.com/spring-projects/spring-security/issues/18077
|
|
|
- @Disabled("callbacks property is serialized with Jackson 3, not with Jackson 2")
|
|
|
@Test
|
|
|
public void serializeWhenAuthorizationProxyObjectThenOnlyIncludesProxiedProperties() {
|
|
|
SecurityContextHolder.getContext().setAuthentication(this.admin);
|
|
|
AuthorizationAdvisorProxyFactory factory = AuthorizationAdvisorProxyFactory.withDefaults();
|
|
|
User user = proxy(factory, this.alan);
|
|
|
- JsonMapper mapper = new JsonMapper();
|
|
|
+ // gh-18077
|
|
|
+ JsonMapper mapper = JsonMapper.builder().addModule(new CoreJacksonModule()).build();
|
|
|
String serialized = mapper.writeValueAsString(user);
|
|
|
Map<String, Object> properties = mapper.readValue(serialized, Map.class);
|
|
|
assertThat(properties).hasSize(3).containsKeys("id", "firstName", "lastName");
|