See gh-18736
This commit is contained in:
mattisonchao 2019-10-25 11:04:50 +08:00 committed by Stephane Nicoll
parent 7827d1261e
commit f61da8b723
3 changed files with 5 additions and 8 deletions

View File

@ -75,7 +75,7 @@ public enum ApiVersion {
try {
return valueOf(type.toUpperCase());
}
catch (IllegalArgumentException ex) {
catch (IllegalArgumentException ignored) {
}
}
return null;

View File

@ -65,13 +65,13 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
private Map<EndpointId, PathMappedEndpoint> getEndpoints(Collection<EndpointsSupplier<?>> suppliers) {
Map<EndpointId, PathMappedEndpoint> endpoints = new LinkedHashMap<>();
suppliers.forEach((supplier) -> {
for (EndpointsSupplier<?> supplier : suppliers) {
supplier.getEndpoints().forEach((endpoint) -> {
if (endpoint instanceof PathMappedEndpoint) {
endpoints.put(endpoint.getEndpointId(), (PathMappedEndpoint) endpoint);
}
});
});
}
return Collections.unmodifiableMap(endpoints);
}

View File

@ -100,11 +100,8 @@ public class HealthWebEndpointResponseMapper {
}
private boolean canSeeDetails(SecurityContext securityContext, ShowDetails showDetails) {
if (showDetails == ShowDetails.NEVER || (showDetails == ShowDetails.WHEN_AUTHORIZED
&& (securityContext.getPrincipal() == null || !isUserInRole(securityContext)))) {
return false;
}
return true;
return showDetails != ShowDetails.NEVER && (showDetails != ShowDetails.WHEN_AUTHORIZED
|| (securityContext.getPrincipal() != null && isUserInRole(securityContext)));
}
private boolean isUserInRole(SecurityContext securityContext) {