Merge branch '1.4.x' into 1.5.x
This commit is contained in:
@@ -183,14 +183,15 @@ public class EndpointWebMvcManagementContextConfiguration {
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
Environment environment = context.getEnvironment();
|
||||
String config = environment.resolvePlaceholders("${logging.file:}");
|
||||
ConditionMessage.Builder message = ConditionMessage
|
||||
.forCondition("Log File");
|
||||
ConditionMessage.Builder message = ConditionMessage.forCondition("Log File");
|
||||
if (StringUtils.hasText(config)) {
|
||||
return ConditionOutcome.match(message.found("logging.file").items(config));
|
||||
return ConditionOutcome
|
||||
.match(message.found("logging.file").items(config));
|
||||
}
|
||||
config = environment.resolvePlaceholders("${logging.path:}");
|
||||
if (StringUtils.hasText(config)) {
|
||||
return ConditionOutcome.match(message.found("logging.path").items(config));
|
||||
return ConditionOutcome
|
||||
.match(message.found("logging.path").items(config));
|
||||
}
|
||||
config = new RelaxedPropertyResolver(environment, "endpoints.logfile.")
|
||||
.getProperty("external-file");
|
||||
|
||||
@@ -98,7 +98,8 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
MongoDataAutoConfiguration.class, RabbitAutoConfiguration.class,
|
||||
RedisAutoConfiguration.class, SolrAutoConfiguration.class })
|
||||
@EnableConfigurationProperties({ HealthIndicatorProperties.class })
|
||||
@Import({ ElasticsearchHealthIndicatorConfiguration.ElasticsearchClientHealthIndicatorConfiguration.class,
|
||||
@Import({
|
||||
ElasticsearchHealthIndicatorConfiguration.ElasticsearchClientHealthIndicatorConfiguration.class,
|
||||
ElasticsearchHealthIndicatorConfiguration.ElasticsearchJestHealthIndicatorConfiguration.class })
|
||||
public class HealthIndicatorAutoConfiguration {
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ public class InfoContributorProperties {
|
||||
return this.git;
|
||||
}
|
||||
|
||||
|
||||
public static class Git {
|
||||
|
||||
/**
|
||||
|
||||
@@ -98,8 +98,7 @@ public class JolokiaAutoConfiguration {
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
boolean endpointsEnabled = isEnabled(context, "endpoints.", true);
|
||||
ConditionMessage.Builder message = ConditionMessage
|
||||
.forCondition("Jolokia");
|
||||
ConditionMessage.Builder message = ConditionMessage.forCondition("Jolokia");
|
||||
if (isEnabled(context, "endpoints.jolokia.", endpointsEnabled)) {
|
||||
return ConditionOutcome.match(message.because("enabled"));
|
||||
}
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
package org.springframework.boot.actuate.autoconfigure;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
@@ -179,7 +178,7 @@ public class ManagementServerProperties implements SecurityPrerequisite {
|
||||
/**
|
||||
* Comma-separated list of roles that can access the management endpoint.
|
||||
*/
|
||||
private List<String> roles = new ArrayList<String>(Collections.singletonList("ADMIN"));
|
||||
private List<String> roles = Arrays.asList("ADMIN");
|
||||
|
||||
/**
|
||||
* Session creating policy to use (always, never, if_required, stateless).
|
||||
|
||||
@@ -398,9 +398,9 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.data.elasticsearch.properties.path.home:target",
|
||||
"management.health.diskspace.enabled:false");
|
||||
this.context.register(JestClientConfiguration.class,
|
||||
JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class,
|
||||
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
|
||||
this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
|
||||
ElasticsearchAutoConfiguration.class, ManagementServerProperties.class,
|
||||
HealthIndicatorAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
@@ -414,9 +414,8 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
public void elasticsearchJestHealthIndicator() {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"management.health.diskspace.enabled:false");
|
||||
this.context.register(JestClientConfiguration.class,
|
||||
JestAutoConfiguration.class, ManagementServerProperties.class,
|
||||
HealthIndicatorAutoConfiguration.class);
|
||||
this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
|
||||
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
@@ -432,9 +431,9 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
"management.health.elasticsearch.enabled:false",
|
||||
"spring.data.elasticsearch.properties.path.home:target",
|
||||
"management.health.diskspace.enabled:false");
|
||||
this.context.register(JestClientConfiguration.class,
|
||||
JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class,
|
||||
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
|
||||
this.context.register(JestClientConfiguration.class, JestAutoConfiguration.class,
|
||||
ElasticsearchAutoConfiguration.class, ManagementServerProperties.class,
|
||||
HealthIndicatorAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
|
||||
@@ -82,8 +82,7 @@ public class ManagementServerPropertiesAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void managementRolesAllowsIndexedAccess() {
|
||||
ManagementServerProperties properties = load(
|
||||
"management.security.roles[0]=FOO");
|
||||
ManagementServerProperties properties = load("management.security.roles[0]=FOO");
|
||||
assertThat(properties.getSecurity().getRoles()).containsOnly("FOO");
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ public class AuthorizationAuditListenerTests {
|
||||
@Test
|
||||
public void testDetailsAreIncludedInAuditEvent() throws Exception {
|
||||
Object details = new Object();
|
||||
UsernamePasswordAuthenticationToken authentication =
|
||||
new UsernamePasswordAuthenticationToken("user", "password");
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
|
||||
"user", "password");
|
||||
authentication.setDetails(details);
|
||||
this.listener.onApplicationEvent(new AuthorizationFailureEvent(this,
|
||||
Arrays.<ConfigAttribute>asList(new SecurityConfig("USER")),
|
||||
|
||||
Reference in New Issue
Block a user