|
@@ -23,6 +23,7 @@ import org.springframework.security.core.context.SecurityContext;
|
|
|
import org.springframework.security.core.context.SecurityContextImpl;
|
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
|
import reactor.core.publisher.Mono;
|
|
|
+import reactor.test.StepVerifier;
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
@@ -30,18 +31,21 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|
|
* @author Rob Winch
|
|
|
* @since 5.0
|
|
|
*/
|
|
|
-public class ServerWebExchangeAttributeServerSecurityContextRepositoryTests {
|
|
|
- ServerWebExchangeAttributeServerSecurityContextRepository repository = new ServerWebExchangeAttributeServerSecurityContextRepository();
|
|
|
+public class NoOpServerSecurityContextRepositoryTests {
|
|
|
+ NoOpServerSecurityContextRepository repository = NoOpServerSecurityContextRepository.getInstance();
|
|
|
+
|
|
|
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build());
|
|
|
|
|
|
@Test
|
|
|
public void saveAndLoad() {
|
|
|
SecurityContext context = new SecurityContextImpl();
|
|
|
- this.repository.save(this.exchange, context).block();
|
|
|
|
|
|
- Mono<SecurityContext> loaded = this.repository.load(this.exchange);
|
|
|
+ Mono<SecurityContext> result =
|
|
|
+ this.repository.save(this.exchange, context)
|
|
|
+ .then(this.repository.load(this.exchange));
|
|
|
|
|
|
- assertThat(context).isSameAs(loaded.block());
|
|
|
+ StepVerifier.create(result)
|
|
|
+ .verifyComplete();
|
|
|
}
|
|
|
|
|
|
}
|