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 { try {
return valueOf(type.toUpperCase()); return valueOf(type.toUpperCase());
} }
catch (IllegalArgumentException ex) { catch (IllegalArgumentException ignored) {
} }
} }
return null; return null;

View File

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

View File

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