Use HTTPS for external links wherever possible

See gh-16318
This commit is contained in:
Spring Operator
2019-03-26 04:15:27 -05:00
committed by Andy Wilkinson
parent 94633cfd89
commit bbbfee6480
13 changed files with 23 additions and 23 deletions

View File

@@ -115,7 +115,7 @@ public class CloudFoundryActuatorAutoConfigurationTests {
"cloudFoundrySecurityService");
String cloudControllerUrl = (String) ReflectionTestUtils
.getField(interceptorSecurityService, "cloudControllerUrl");
assertThat(cloudControllerUrl).isEqualTo("http://my-cloud-controller.com");
assertThat(cloudControllerUrl).isEqualTo("https://my-cloud-controller.com");
}
@Test
@@ -189,7 +189,7 @@ public class CloudFoundryActuatorAutoConfigurationTests {
private CloudFoundryEndpointHandlerMapping getHandlerMapping() {
EnvironmentTestUtils.addEnvironment(this.context, "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");
this.context.refresh();
return this.context.getBean("cloudFoundryEndpointHandlerMapping",
CloudFoundryEndpointHandlerMapping.class);

View File

@@ -74,7 +74,7 @@ public class CloudFoundrySecurityInterceptorTests {
@Test
public void preHandleWhenRequestIsPreFlightShouldReturnTrue() throws Exception {
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");
boolean preHandle = this.interceptor.preHandle(this.request, this.response,
this.handlerMethod);

View File

@@ -50,12 +50,12 @@ public class CloudFoundrySecurityServiceTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
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;
@@ -152,7 +152,7 @@ public class CloudFoundrySecurityServiceTests {
public void fetchTokenKeysWhenSuccessfulShouldReturnListOfKeysFromUAA()
throws Exception {
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"

View File

@@ -182,7 +182,7 @@ public class TokenValidatorTests {
@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\"}";
this.thrown

View File

@@ -75,7 +75,7 @@ public abstract class AbstractEndpointHandlerMappingTests {
mapping.setSecurityInterceptor(securityInterceptor);
mapping.afterPropertiesSet();
MockHttpServletRequest request = request("POST", "/a");
request.addHeader("Origin", "http://example.com");
request.addHeader("Origin", "https://example.com");
assertThat(mapping.getHandler(request).getInterceptors().length).isEqualTo(3);
assertThat(mapping.getHandler(request).getInterceptors()[2])
.isEqualTo(securityInterceptor);