Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
349987d9
Commit
349987d9
authored
Feb 21, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch show details default to ShowDetails.NEVER
Closes gh-11869
parent
46021928
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
7 deletions
+42
-7
HealthEndpointProperties.java
...ctuate/autoconfigure/health/HealthEndpointProperties.java
+1
-1
HealthEndpointWebExtensionTests.java
...autoconfigure/health/HealthEndpointWebExtensionTests.java
+19
-2
ReactiveHealthEndpointWebExtensionTests.java
...igure/health/ReactiveHealthEndpointWebExtensionTests.java
+21
-3
production-ready-features.adoc
...oot-docs/src/main/asciidoc/production-ready-features.adoc
+1
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java
View file @
349987d9
...
...
@@ -34,7 +34,7 @@ public class HealthEndpointProperties {
/**
* When to show full health details.
*/
private
ShowDetails
showDetails
=
ShowDetails
.
WHEN_AUTHORIZED
;
private
ShowDetails
showDetails
=
ShowDetails
.
NEVER
;
/**
* Roles used to determine whether or not a user is authorized to be shown details.
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointWebExtensionTests.java
View file @
349987d9
...
...
@@ -90,17 +90,34 @@ public class HealthEndpointWebExtensionTests {
}
@Test
public
void
authenticatedUsersAreShownDetailsByDefault
()
{
public
void
authenticatedUsersAre
Not
ShownDetailsByDefault
()
{
this
.
contextRunner
.
run
((
context
)
->
{
HealthEndpointWebExtension
extension
=
context
.
getBean
(
HealthEndpointWebExtension
.
class
);
SecurityContext
securityContext
=
mock
(
SecurityContext
.
class
);
given
(
securityContext
.
getPrincipal
()).
willReturn
(
mock
(
Principal
.
class
));
assertThat
(
extension
.
getHealth
(
securityContext
).
getBody
().
getDetails
())
.
is
Not
Empty
();
.
isEmpty
();
});
}
@Test
public
void
authenticatedUsersWhenAuthorizedCanBeShownDetails
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.endpoint.health.show-details=when-authorized"
)
.
run
((
context
)
->
{
HealthEndpointWebExtension
extension
=
context
.
getBean
(
HealthEndpointWebExtension
.
class
);
SecurityContext
securityContext
=
mock
(
SecurityContext
.
class
);
given
(
securityContext
.
getPrincipal
())
.
willReturn
(
mock
(
Principal
.
class
));
assertThat
(
extension
.
getHealth
(
securityContext
).
getBody
().
getDetails
())
.
isNotEmpty
();
});
}
@Test
public
void
unauthenticatedUsersCanBeShownDetails
()
{
this
.
contextRunner
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthEndpointWebExtensionTests.java
View file @
349987d9
...
...
@@ -86,7 +86,9 @@ public class ReactiveHealthEndpointWebExtensionTests {
@Test
public
void
regularAndReactiveHealthIndicatorsMatch
()
{
this
.
contextRunner
.
withUserConfiguration
(
HealthIndicatorsConfiguration
.
class
)
this
.
contextRunner
.
withPropertyValues
(
"management.endpoint.health.show-details=always"
)
.
withUserConfiguration
(
HealthIndicatorsConfiguration
.
class
)
.
run
((
context
)
->
{
HealthEndpoint
endpoint
=
context
.
getBean
(
HealthEndpoint
.
class
);
ReactiveHealthEndpointWebExtension
extension
=
context
...
...
@@ -115,17 +117,33 @@ public class ReactiveHealthEndpointWebExtensionTests {
}
@Test
public
void
authenticatedUsersAreShownDetailsByDefault
()
{
public
void
authenticatedUsersAre
Not
ShownDetailsByDefault
()
{
this
.
contextRunner
.
run
((
context
)
->
{
ReactiveHealthEndpointWebExtension
extension
=
context
.
getBean
(
ReactiveHealthEndpointWebExtension
.
class
);
SecurityContext
securityContext
=
mock
(
SecurityContext
.
class
);
given
(
securityContext
.
getPrincipal
()).
willReturn
(
mock
(
Principal
.
class
));
assertThat
(
extension
.
health
(
securityContext
).
block
().
getBody
().
getDetails
())
.
is
Not
Empty
();
.
isEmpty
();
});
}
@Test
public
void
authenticatedUsersWhenAuthorizedCanBeShownDetails
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.endpoint.health.show-details=when-authorized"
)
.
run
((
context
)
->
{
ReactiveHealthEndpointWebExtension
extension
=
context
.
getBean
(
ReactiveHealthEndpointWebExtension
.
class
);
SecurityContext
securityContext
=
mock
(
SecurityContext
.
class
);
given
(
securityContext
.
getPrincipal
())
.
willReturn
(
mock
(
Principal
.
class
));
assertThat
(
extension
.
health
(
securityContext
).
block
().
getBody
()
.
getDetails
()).
isNotEmpty
();
});
}
@Test
public
void
unauthenticatedUsersCanBeShownDetails
()
{
this
.
contextRunner
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc
View file @
349987d9
...
...
@@ -531,7 +531,7 @@ following values:
|Details are shown to all users.
|===
The default value is `
when-authorized
`. A user is considered to be authorized when they
The default value is `
never
`. A user is considered to be authorized when they
are in one or more of the endpoint's roles. If the endpoint has no configured roles
(the default) all authenticated users are considered to be authorized. The roles can
be configured using the `management.endpoint.health.roles` property.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment