mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Merge pull request #15784 from vpavic
* pr/15784: Remove duplicate code from HealthWebEndpointResponseMapper
This commit is contained in:
commit
9e0b1c297d
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -88,10 +88,7 @@ public class HealthWebEndpointResponseMapper {
|
|||||||
*/
|
*/
|
||||||
public WebEndpointResponse<Health> map(Health health, SecurityContext securityContext,
|
public WebEndpointResponse<Health> map(Health health, SecurityContext securityContext,
|
||||||
ShowDetails showDetails) {
|
ShowDetails showDetails) {
|
||||||
if (showDetails == ShowDetails.NEVER
|
if (!canSeeDetails(securityContext, showDetails)) {
|
||||||
|| (showDetails == ShowDetails.WHEN_AUTHORIZED
|
|
||||||
&& (securityContext.getPrincipal() == null
|
|
||||||
|| !isUserInRole(securityContext)))) {
|
|
||||||
health = Health.status(health.getStatus()).build();
|
health = Health.status(health.getStatus()).build();
|
||||||
}
|
}
|
||||||
return createWebEndpointResponse(health);
|
return createWebEndpointResponse(health);
|
||||||
|
Loading…
Reference in New Issue
Block a user