Currently, we use Hooks.onLastOperator to propagate the SecurityContext, request and response to the reactor operator chain in tests. See https://github.com/spring-projects/spring-security/blob/main/config/src/main/java/org/springframework/security/config/annotation/web/configuration/SecurityReactorContextConfiguration.java#L83 and https://github.com/spring-projects/spring-security/blob/main/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java#L75.

However, such hook does not cover some corner cases. We should investigate more and consider moving to a better propagation mechanism.

Related: - https://github.com/spring-projects/spring-security/issues/13733 - https://github.com/spring-projects/spring-security/issues/14207#issuecomment-1864629554

Comment From: marcusdacoregio

Closing as duplicate of https://github.com/spring-projects/spring-security/issues/13733