Change default behaviour of /health when not secured

The default is now to reveal all details unless sensitive=true
(instead of only revealing then if sensitive was explicitly false).
The definition of "secure" also changes to something more sensible
where it is only true if security is enabled.

Fixes gh-2816
This commit is contained in:
Dave Syer
2015-06-26 13:44:52 +01:00
parent c3c1d91f74
commit 1f6ac52b96
5 changed files with 43 additions and 5 deletions

View File

@@ -29,7 +29,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
/**
* Tests for /health with {@code endpoints.health.sensitive=false}.
@@ -51,7 +51,7 @@ public class NonSensitiveHealthTests {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.port + "/health", String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertTrue("Wrong body: " + entity.getBody(),
assertFalse("Wrong body: " + entity.getBody(),
entity.getBody().contains("\"hello\":1"));
}