Skip to content

Commit

Permalink
Fix allowCredentials property handling
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye authored and snicoll committed May 28, 2015
1 parent fc067d1 commit 8861239
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ CorsConfiguration toCorsConfiguration() {
corsConfiguration.setMaxAge(this.maxAge);
}
if (this.allowCredentials != null) {
corsConfiguration.setAllowCredentials(true);
corsConfiguration.setAllowCredentials(this.allowCredentials);
}
return corsConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ public void credentialsCanBeAllowed() throws Exception {
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
public void jolokiaEndpointUsesGlobalCorsConfiguration() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
Expand Down

0 comments on commit 8861239

Please sign in to comment.