Add support for OIDC Configuration Provider

Closes gh-13210
This commit is contained in:
Madhura Bhave
2018-07-17 16:02:03 -07:00
parent 4fee54cf24
commit f88ebc06ff
9 changed files with 187 additions and 12 deletions

View File

@@ -28,7 +28,9 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
"APP-CLIENT-ID=my-client-id", "APP-CLIENT-SECRET=my-client-secret" })
"APP-CLIENT-ID=my-client-id", "APP-CLIENT-SECRET=my-client-secret",
"GOOGLE-CLIENT-ID=my-google-client-id",
"GOOGLE-CLIENT-SECRET=my-google-client-secret" })
public class SampleReactiveOAuth2ClientApplicationTests {
@Autowired
@@ -36,17 +38,16 @@ public class SampleReactiveOAuth2ClientApplicationTests {
@Test
public void everythingShouldRedirectToLogin() {
this.webTestClient.get().uri("/").exchange()
.expectStatus().isFound()
.expectHeader().valueEquals("Location", "/login");
this.webTestClient.get().uri("/").exchange().expectStatus().isFound()
.expectHeader().valueEquals("Location", "/login");
}
@Test
public void loginShouldHaveBothOAuthClientsToChooseFrom() {
byte[] body = this.webTestClient.get().uri("/login").exchange()
.expectStatus().isOk()
.returnResult(String.class).getResponseBodyContent();
byte[] body = this.webTestClient.get().uri("/login").exchange().expectStatus()
.isOk().returnResult(String.class).getResponseBodyContent();
String bodyString = new String(body);
assertThat(bodyString).contains("/oauth2/authorization/google");
assertThat(bodyString).contains("/oauth2/authorization/github-client-1");
assertThat(bodyString).contains("/oauth2/authorization/github-client-2");
}