parent
37011720c9
commit
8130965259
|
@ -89,7 +89,9 @@ public class HttpSecurityTests {
|
|||
WebTestClient client = buildClient();
|
||||
|
||||
EntityExchangeResult<String> result = client
|
||||
.mutate()
|
||||
.filter(basicAuthentication("rob", "rob"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
|
|
|
@ -68,7 +68,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void basicWorks() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -79,7 +81,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void basicWhenPasswordInvalid401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -90,7 +94,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void authorizationAdmin403() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -101,7 +107,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void authorizationAdmin200() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(adminCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -111,7 +119,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void basicMissingUser401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(basicAuthentication("missing-user", "password"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -121,7 +131,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void basicInvalidPassword401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -141,7 +153,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void sessionWorks() throws Exception {
|
||||
ExchangeResult result = this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -160,7 +174,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void me() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/me")
|
||||
.exchange()
|
||||
|
@ -171,7 +187,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void monoMe() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/mono/me")
|
||||
.exchange()
|
||||
|
@ -182,7 +200,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void principal() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -193,7 +213,9 @@ public class HelloWebfluxApplicationITests {
|
|||
@Test
|
||||
public void headers() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
|
|
@ -70,7 +70,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void basicWorks() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -81,7 +83,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void basicWhenPasswordInvalid401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -92,7 +96,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void authorizationAdmin403() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -103,7 +109,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void authorizationAdmin200() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(adminCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -113,7 +121,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void basicMissingUser401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(basicAuthentication("missing-user", "password"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -123,7 +133,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void basicInvalidPassword401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -143,7 +155,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void sessionWorks() throws Exception {
|
||||
ExchangeResult result = this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -165,7 +179,9 @@ public class HelloWebfluxApplicationTests {
|
|||
WebTestClient mockRest = WebTestClient.bindToApplicationContext(this.context).webFilter(exchangeMutator).build();
|
||||
|
||||
mockRest
|
||||
.mutate()
|
||||
.filter(exchangeMutator.perClient(withUser()))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -181,7 +197,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void me() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/me")
|
||||
.exchange()
|
||||
|
@ -192,7 +210,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void monoMe() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/mono/me")
|
||||
.exchange()
|
||||
|
@ -203,7 +223,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void principal() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -214,7 +236,9 @@ public class HelloWebfluxApplicationTests {
|
|||
@Test
|
||||
public void headers() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
|
|
@ -70,7 +70,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void basicWorks() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -81,7 +83,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void basicWhenPasswordInvalid401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -92,7 +96,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void authorizationAdmin403() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -103,7 +109,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void authorizationAdmin200() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(adminCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -113,7 +121,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void basicMissingUser401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(basicAuthentication("missing-user", "password"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -123,7 +133,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void basicInvalidPassword401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -143,7 +155,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void sessionWorks() throws Exception {
|
||||
ExchangeResult result = this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -162,7 +176,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void principal() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -173,7 +189,9 @@ public class HelloWebfluxFnApplicationITests {
|
|||
@Test
|
||||
public void headers() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
|
|
@ -76,7 +76,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void basicWorks() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -87,7 +89,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void basicWhenPasswordInvalid401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -98,7 +102,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void authorizationAdmin403() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -109,7 +115,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void authorizationAdmin200() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(adminCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -119,7 +127,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void basicMissingUser401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(basicAuthentication("missing-user", "password"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -129,7 +139,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void basicInvalidPassword401() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(invalidPassword())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/admin")
|
||||
.exchange()
|
||||
|
@ -149,7 +161,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void sessionWorks() throws Exception {
|
||||
ExchangeResult result = this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -171,7 +185,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
WebTestClient mockRest = WebTestClient.bindToRouterFunction(this.routerFunction).webFilter(exchangeMutator, springSecurityFilterChain).build();
|
||||
|
||||
mockRest
|
||||
.mutate()
|
||||
.filter(exchangeMutator.perClient(withUser()))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -187,7 +203,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void principal() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
@ -198,7 +216,9 @@ public class HelloWebfluxFnApplicationTests {
|
|||
@Test
|
||||
public void headers() throws Exception {
|
||||
this.rest
|
||||
.mutate()
|
||||
.filter(robsCredentials())
|
||||
.build()
|
||||
.get()
|
||||
.uri("/principal")
|
||||
.exchange()
|
||||
|
|
|
@ -62,7 +62,9 @@ public class WebClientOAuth2PocTests {
|
|||
this.server.enqueue(new MockResponse().setResponseCode(200).setBody("OK"));
|
||||
|
||||
ClientResponse response = this.webClient
|
||||
.mutate()
|
||||
.filter(basicIfNeeded("rob", "rob"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
|
@ -80,7 +82,9 @@ public class WebClientOAuth2PocTests {
|
|||
this.server.enqueue(new MockResponse().setResponseCode(200).setBody("OK"));
|
||||
|
||||
ClientResponse response = this.webClient
|
||||
.mutate()
|
||||
.filter(basicIfNeeded("rob", "rob"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
|
|
|
@ -99,7 +99,9 @@ public class AuthenticationWebFilterTests {
|
|||
.build();
|
||||
|
||||
EntityExchangeResult<String> result = client
|
||||
.mutate()
|
||||
.filter(basicAuthentication("test","this"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
|
@ -120,7 +122,9 @@ public class AuthenticationWebFilterTests {
|
|||
.build();
|
||||
|
||||
EntityExchangeResult<Void> result = client
|
||||
.mutate()
|
||||
.filter(basicAuthentication("test", "this"))
|
||||
.build()
|
||||
.get()
|
||||
.uri("/")
|
||||
.exchange()
|
||||
|
|
Loading…
Reference in New Issue