Merge branch '2.0.x' into 2.1.x

Closes gh-17078
This commit is contained in:
Andy Wilkinson
2019-06-07 10:50:34 +01:00
2691 changed files with 27746 additions and 46049 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,16 +61,14 @@ public class SampleReactiveOAuth2ResourceServerApplicationTests {
@Test
public void getWhenValidTokenShouldBeOk() {
this.webTestClient.get().uri("/")
.headers((headers) -> headers.setBearerAuth(VALID_TOKEN)).exchange()
.expectStatus().isOk().expectBody(String.class)
.isEqualTo("Hello, subject!");
this.webTestClient.get().uri("/").headers((headers) -> headers.setBearerAuth(VALID_TOKEN)).exchange()
.expectStatus().isOk().expectBody(String.class).isEqualTo("Hello, subject!");
}
@Test
public void getWhenNoTokenShouldBeUnauthorized() {
this.webTestClient.get().uri("/").exchange().expectStatus().isUnauthorized()
.expectHeader().valueEquals(HttpHeaders.WWW_AUTHENTICATE, "Bearer");
this.webTestClient.get().uri("/").exchange().expectStatus().isUnauthorized().expectHeader()
.valueEquals(HttpHeaders.WWW_AUTHENTICATE, "Bearer");
}
private static MockResponse mockResponse() {
@@ -91,8 +89,7 @@ public class SampleReactiveOAuth2ResourceServerApplicationTests {
+ "V9gWuOzSJ0iEuWvtQ6eGBP5M6m7pccLNZfwUse8Cb4Ngx3XiTlyuqM7pv0LPyppZusfEHVEdeelou7Dy9k0OQ_nJTI3b2E1WBoHC5"
+ "8CJ453lo4gcBm1efURN3LIVc1V9NQY_ESBKVdwqYyoJPEanURLVGRd6cQKn6YrCbbIRHjqAyqOE-z3KmgDJnPriljfR5XhSGyM9eq"
+ "D9Xpy6zu_MAeMJJfSArp857zLPk-Wf5VP9STAcjyfdBIybMKnwBYr2qHMT675hQ\"}]}";
return new MockResponse()
.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
return new MockResponse().setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.setResponseCode(200).setBody(body);
}