Spring security 请求在webflux应用程序的2端测试中被阻止

Spring security 请求在webflux应用程序的2端测试中被阻止,spring-security,spring-webflux,Spring Security,Spring Webflux,我在end 2 end测试中遇到的另一个问题是,设置无效凭据将导致发送的请求被阻止,直到超时 源代码: 另一种情况是,如果用户没有权限,也会导致请求被阻止 @Test public void deletingPostsWhenUserCredentialsThenForbidden_mutateWith() throws Exception { this.rest .mutate().filter(basicAuthentication("user", "password

我在end 2 end测试中遇到的另一个问题是,设置无效凭据将导致发送的请求被阻止,直到超时

源代码:

另一种情况是,如果用户没有权限,也会导致请求被阻止

@Test
public void deletingPostsWhenUserCredentialsThenForbidden_mutateWith() throws Exception {
    this.rest
        .mutate().filter(basicAuthentication("user", "password")).build()
        .delete()
        .uri("/posts/1")
        .exchange()
        .expectStatus().is4xxClientError()
        .expectBody().isEmpty();
}
在这个示例中,我使用Reactor Netty作为运行时,类似的测试在
ApplicationTests
中通过(在模拟环境中使用
bindToApplicationContext
),并在
IntegrationTests
中失败(在2端测试中使用
bindToServer

@Test
public void deletingPostsWhenUserCredentialsThenForbidden_mutateWith() throws Exception {
    this.rest
        .mutate().filter(basicAuthentication("user", "password")).build()
        .delete()
        .uri("/posts/1")
        .exchange()
        .expectStatus().is4xxClientError()
        .expectBody().isEmpty();
}