Skip to content

Commit

Permalink
Merge branch '2.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinsona committed Mar 28, 2019
2 parents 3e3353e + b7bca87 commit 878a635
Show file tree
Hide file tree
Showing 125 changed files with 450 additions and 447 deletions.
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ appropriate to the circumstances. Maintainers are obligated to maintain confiden
with regard to the reporter of an incident.

This Code of Conduct is adapted from the
http://contributor-covenant.org[Contributor Covenant], version 1.3.0, available at
http://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/]
https://contributor-covenant.org[Contributor Covenant], version 1.3.0, available at
https://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/]
14 changes: 7 additions & 7 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ added after the original pull request but before a merge.
* A few unit tests would help a lot as well -- someone has to do it.
* If no-one else is using your branch, please rebase it against the current master (or
other target branch in the main project).
* When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
message (where `XXXX` is the issue number).

Expand All @@ -75,15 +75,15 @@ added after the original pull request but before a merge.
== Working with the Code
If you don't have an IDE preference we would recommend that you use
https://spring.io/tools/sts[Spring Tools Suite] or
http://eclipse.org[Eclipse] when working with the code. We use the
http://eclipse.org/m2e/[M2Eclipse] eclipse plugin for maven support. Other IDEs and tools
https://eclipse.org[Eclipse] when working with the code. We use the
https://eclipse.org/m2e/[M2Eclipse] eclipse plugin for maven support. Other IDEs and tools
should also work without issue.



=== Building from Source
Spring Boot source can be build from the command line using
http://maven.apache.org/run-maven/index.html[Apache Maven] on JDK 1.8 or above.
Spring Boot source can be built from the command line using
https://maven.apache.org/run-maven/index.html[Apache Maven] on JDK 1.8 or above.
We include '`Maven Wrapper`' scripts (`./mvnw` or `mvnw.bat`) that you can run rather
than needing to install Maven locally.

Expand Down Expand Up @@ -148,7 +148,7 @@ Spring Boot includes a `.setup` files which can be used with the Eclipse Install
provision a new environment. To use the installer:

* Download and run the latest Eclipse Installer from
http://www.eclipse.org/downloads/[eclipse.org/downloads/] (under "Get Eclipse").
https://www.eclipse.org/downloads/[eclipse.org/downloads/] (under "Get Eclipse").
* Switch to "Advanced Mode" using the drop down menu on the right.
* Select "`Eclipse IDE for Java Developers`" under "`Eclipse.org`" as the product to
install and click "`next`".
Expand All @@ -170,7 +170,7 @@ easier to navigate.

==== Manual Installation with M2Eclipse
If you prefer to install Eclipse yourself you should use the
http://eclipse.org/m2e/[M2Eclipse] eclipse plugin. If you don't already have m2eclipse
https://eclipse.org/m2e/[M2Eclipse] eclipse plugin. If you don't already have m2eclipse
installed it is available from the "Eclipse marketplace".

Spring Boot includes project specific source formatting settings, in order to have these
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ public void responseToOptionsRequestIncludesCorsHeaders() {
this.contextRunner.run(withWebTestClient((client) -> client.options()
.uri("/cfApplication/test").accept(MediaType.APPLICATION_JSON)
.header("Access-Control-Request-Method", "POST")
.header("Origin", "http://example.com").exchange().expectStatus().isOk()
.header("Origin", "https://example.com").exchange().expectStatus().isOk()
.expectHeader()
.valueEquals("Access-Control-Allow-Origin", "http://example.com")
.valueEquals("Access-Control-Allow-Origin", "https://example.com")
.expectHeader().valueEquals("Access-Control-Allow-Methods", "GET,POST")));
}

Expand Down Expand Up @@ -203,7 +203,7 @@ public CloudFoundryWebFluxEndpointHandlerMapping cloudFoundryWebEndpointServletH
EndpointMediaTypes endpointMediaTypes,
CloudFoundrySecurityInterceptor interceptor) {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.setAllowedOrigins(Arrays.asList("http://example.com"));
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST"));
return new CloudFoundryWebFluxEndpointHandlerMapping(
new EndpointMapping("/cfApplication"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void cloudFoundryPlatformActive() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -131,7 +131,7 @@ public void cloudfoundryapplicationProducesActuatorMediaType() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
WebTestClient webTestClient = WebTestClient
.bindToApplicationContext(context).build();
Expand All @@ -145,7 +145,7 @@ public void cloudFoundryPlatformActiveSetsApplicationId() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -162,7 +162,7 @@ public void cloudFoundryPlatformActiveSetsCloudControllerUrl() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -173,7 +173,7 @@ public void cloudFoundryPlatformActiveSetsCloudControllerUrl() {
String cloudControllerUrl = (String) ReflectionTestUtils
.getField(interceptorSecurityService, "cloudControllerUrl");
assertThat(cloudControllerUrl)
.isEqualTo("http://my-cloud-controller.com");
.isEqualTo("https://my-cloud-controller.com");
});
}

Expand All @@ -198,7 +198,7 @@ public void cloudFoundryPathsIgnoredBySpringSecurity() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
WebFilterChainProxy chainProxy = context
.getBean(WebFilterChainProxy.class);
Expand Down Expand Up @@ -245,7 +245,7 @@ public void allEndpointsAvailableUnderCloudFoundryWithoutEnablingWebIncludes() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -263,7 +263,7 @@ public void endpointPathCustomizationIsNotApplied() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -287,7 +287,7 @@ public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() {
AutoConfigurations.of(HealthEndpointAutoConfiguration.class))
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
Collection<ExposableWebEndpoint> endpoints = getHandlerMapping(
context).getEndpoints();
Expand Down Expand Up @@ -322,7 +322,7 @@ public void skipSslValidation() {
AutoConfigurations.of(HealthEndpointAutoConfiguration.class))
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com",
"vcap.application.cf_api:https://my-cloud-controller.com",
"management.cloudfoundry.skip-ssl-validation:true")
.run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(
Expand All @@ -345,7 +345,7 @@ public void sslValidationNotSkippedByDefault() {
AutoConfigurations.of(HealthEndpointAutoConfiguration.class))
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void setup() {
@Test
public void preHandleWhenRequestIsPreFlightShouldBeOk() {
MockServerWebExchange request = MockServerWebExchange.from(MockServerHttpRequest
.options("/a").header(HttpHeaders.ORIGIN, "http://example.com")
.options("/a").header(HttpHeaders.ORIGIN, "https://example.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET").build());
StepVerifier.create(this.interceptor.preHandle(request, "/a")).consumeNextWith(
(response) -> assertThat(response.getStatus()).isEqualTo(HttpStatus.OK))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ReactiveCloudFoundrySecurityServiceTests {
private static final String CLOUD_CONTROLLER_PERMISSIONS = CLOUD_CONTROLLER
+ "/v2/apps/my-app-id/permissions";

private static final String UAA_URL = "http://my-cloud-controller.com/uaa";
private static final String UAA_URL = "https://my-cloud-controller.com/uaa";

private ReactiveCloudFoundrySecurityService securityService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void validateTokenWhenExpiredShouldThrowException() throws Exception {
public void validateTokenWhenIssuerIsNotValidShouldThrowException() throws Exception {
given(this.securityService.fetchTokenKeys()).willReturn(Mono.just(VALID_KEYS));
given(this.securityService.getUaaUrl())
.willReturn(Mono.just("http://other-uaa.com"));
.willReturn(Mono.just("https://other-uaa.com"));
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\", \"typ\": \"JWT\", \"scope\": [\"actuator.read\"]}";
String claims = "{ \"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\", \"scope\": [\"foo.bar\"]}";
StepVerifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void cloudFoundryPlatformActive() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -109,7 +109,7 @@ public void cloudfoundryapplicationProducesActuatorMediaType() throws Exception
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
mockMvc.perform(get("/cloudfoundryapplication"))
Expand All @@ -123,7 +123,7 @@ public void cloudFoundryPlatformActiveSetsApplicationId() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -140,7 +140,7 @@ public void cloudFoundryPlatformActiveSetsCloudControllerUrl() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -151,7 +151,7 @@ public void cloudFoundryPlatformActiveSetsCloudControllerUrl() {
String cloudControllerUrl = (String) ReflectionTestUtils
.getField(interceptorSecurityService, "cloudControllerUrl");
assertThat(cloudControllerUrl)
.isEqualTo("http://my-cloud-controller.com");
.isEqualTo("https://my-cloud-controller.com");
});
}

Expand All @@ -160,7 +160,7 @@ public void skipSslValidation() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com",
"vcap.application.cf_api:https://my-cloud-controller.com",
"management.cloudfoundry.skip-ssl-validation:true")
.run((context) -> {
CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(
Expand Down Expand Up @@ -230,7 +230,7 @@ public void allEndpointsAvailableUnderCloudFoundryWithoutExposeAllOnWeb() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.run((context) -> {
CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(
context);
Expand All @@ -248,7 +248,7 @@ public void endpointPathCustomizationIsNotApplied() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com",
"vcap.application.cf_api:https://my-cloud-controller.com",
"management.endpoints.web.path-mapping.test=custom")
.withUserConfiguration(TestConfiguration.class).run((context) -> {
CloudFoundryWebEndpointServletHandlerMapping handlerMapping = getHandlerMapping(
Expand All @@ -272,7 +272,7 @@ public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() {
this.contextRunner
.withPropertyValues("VCAP_APPLICATION:---",
"vcap.application.application_id:my-app-id",
"vcap.application.cf_api:http://my-cloud-controller.com")
"vcap.application.cf_api:https://my-cloud-controller.com")
.withConfiguration(
AutoConfigurations.of(HealthIndicatorAutoConfiguration.class,
HealthEndpointAutoConfiguration.class))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public void responseToOptionsRequestIncludesCorsHeaders() {
load(TestEndpointConfiguration.class, (client) -> client.options()
.uri("/cfApplication/test").accept(MediaType.APPLICATION_JSON)
.header("Access-Control-Request-Method", "POST")
.header("Origin", "http://example.com").exchange().expectStatus().isOk()
.header("Origin", "https://example.com").exchange().expectStatus().isOk()
.expectHeader()
.valueEquals("Access-Control-Allow-Origin", "http://example.com")
.valueEquals("Access-Control-Allow-Origin", "https://example.com")
.expectHeader().valueEquals("Access-Control-Allow-Methods", "GET,POST"));
}

Expand Down Expand Up @@ -198,7 +198,7 @@ public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServl
EndpointMediaTypes endpointMediaTypes,
CloudFoundrySecurityInterceptor interceptor) {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.setAllowedOrigins(Arrays.asList("http://example.com"));
corsConfiguration.setAllowedOrigins(Arrays.asList("https://example.com"));
corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST"));
return new CloudFoundryWebEndpointServletHandlerMapping(
new EndpointMapping("/cfApplication"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void setup() {
@Test
public void preHandleWhenRequestIsPreFlightShouldReturnTrue() {
this.request.setMethod("OPTIONS");
this.request.addHeader(HttpHeaders.ORIGIN, "http://example.com");
this.request.addHeader(HttpHeaders.ORIGIN, "https://example.com");
this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
SecurityResponse response = this.interceptor.preHandle(this.request,
EndpointId.of("test"));
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -49,12 +49,12 @@
*/
public class CloudFoundrySecurityServiceTests {

private static final String CLOUD_CONTROLLER = "http://my-cloud-controller.com";
private static final String CLOUD_CONTROLLER = "https://my-cloud-controller.com";

private static final String CLOUD_CONTROLLER_PERMISSIONS = CLOUD_CONTROLLER
+ "/v2/apps/my-app-id/permissions";

private static final String UAA_URL = "http://my-uaa.com";
private static final String UAA_URL = "https://my-uaa.com";

private CloudFoundrySecurityService securityService;

Expand Down Expand Up @@ -148,7 +148,7 @@ public void getAccessLevelWhenCloudControllerIsNotReachableThrowsException() {
@Test
public void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA() {
this.server.expect(requestTo(CLOUD_CONTROLLER + "/info"))
.andRespond(withSuccess("{\"token_endpoint\":\"http://my-uaa.com\"}",
.andRespond(withSuccess("{\"token_endpoint\":\"https://my-uaa.com\"}",
MediaType.APPLICATION_JSON));
String tokenKeyValue = "-----BEGIN PUBLIC KEY-----\n"
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0m59l2u9iDnMbrXHfqkO\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void validateTokenWhenExpiredShouldThrowException() throws Exception {
@Test
public void validateTokenWhenIssuerIsNotValidShouldThrowException() throws Exception {
given(this.securityService.fetchTokenKeys()).willReturn(VALID_KEYS);
given(this.securityService.getUaaUrl()).willReturn("http://other-uaa.com");
given(this.securityService.getUaaUrl()).willReturn("https://other-uaa.com");
String header = "{ \"alg\": \"RS256\", \"kid\": \"valid-key\", \"typ\": \"JWT\", \"scope\": [\"actuator.read\"]}";
String claims = "{ \"exp\": 2147483647, \"iss\": \"http://localhost:8080/uaa/oauth/token\"}";
assertThatExceptionOfType(CloudFoundryAuthorizationException.class)
Expand Down
Loading

0 comments on commit 878a635

Please sign in to comment.