From d7550d73a3614134953b630f009d2e40cc184dd1 Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Fri, 25 Jan 2019 09:03:10 +0100 Subject: [PATCH] Remove duplicate code from HealthWebEndpointResponseMapper Closes gh-15784 --- .../actuate/health/HealthWebEndpointResponseMapper.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java index 78ada76360a..2b782e6f73c 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,10 +88,7 @@ public class HealthWebEndpointResponseMapper { */ public WebEndpointResponse map(Health health, SecurityContext securityContext, ShowDetails showDetails) { - if (showDetails == ShowDetails.NEVER - || (showDetails == ShowDetails.WHEN_AUTHORIZED - && (securityContext.getPrincipal() == null - || !isUserInRole(securityContext)))) { + if (!canSeeDetails(securityContext, showDetails)) { health = Health.status(health.getStatus()).build(); } return createWebEndpointResponse(health);