Commit 6575b31f authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #3059 from izeye/patch-12

* patch-12:
  Fix allowCredentials property handling
parents fc067d1b 88612393
...@@ -133,7 +133,7 @@ public class MvcEndpointCorsProperties { ...@@ -133,7 +133,7 @@ public class MvcEndpointCorsProperties {
corsConfiguration.setMaxAge(this.maxAge); corsConfiguration.setMaxAge(this.maxAge);
} }
if (this.allowCredentials != null) { if (this.allowCredentials != null) {
corsConfiguration.setAllowCredentials(true); corsConfiguration.setAllowCredentials(this.allowCredentials);
} }
return corsConfiguration; return corsConfiguration;
} }
......
...@@ -160,6 +160,15 @@ public class MvcEndpointCorsIntegrationTests { ...@@ -160,6 +160,15 @@ public class MvcEndpointCorsIntegrationTests {
header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")); header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"));
} }
@Test
public void credentialsCanBeDisabled() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"endpoints.cors.allowed-origins:foo.example.com",
"endpoints.cors.allow-credentials:false");
performAcceptedCorsRequest().andExpect(
header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS));
}
@Test @Test
public void jolokiaEndpointUsesGlobalCorsConfiguration() throws Exception { public void jolokiaEndpointUsesGlobalCorsConfiguration() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment