Extract actuator security into separate classes

So spring-security + a web app is secure by default
(you don't need the actuator).
This commit is contained in:
Dave Syer
2013-11-20 17:54:59 +00:00
parent 285dd5b270
commit bd26b28aa5
28 changed files with 663 additions and 313 deletions

View File

@@ -32,10 +32,8 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.SimpleCommandLinePropertySource;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ResourceUtils;
/**
@@ -108,17 +106,6 @@ public class LoggingApplicationContextInitializer implements
LoggingSystem loggingSystem = LoggingSystem.get(springApplication.getClass()
.getClassLoader());
loggingSystem.beforeInitialize();
if (this.parseArgs && this.springBootLogging == null
&& !ObjectUtils.isEmpty(args)) {
SimpleCommandLinePropertySource parsedArgs = new SimpleCommandLinePropertySource(
args);
if (parsedArgs.containsProperty("debug")) {
this.springBootLogging = LogLevel.DEBUG;
}
if (parsedArgs.containsProperty("trace")) {
this.springBootLogging = LogLevel.TRACE;
}
}
}
/**
@@ -130,6 +117,15 @@ public class LoggingApplicationContextInitializer implements
ConfigurableEnvironment environment = applicationContext.getEnvironment();
if (this.parseArgs && this.springBootLogging == null) {
if (environment.containsProperty("debug")) {
this.springBootLogging = LogLevel.DEBUG;
}
if (environment.containsProperty("trace")) {
this.springBootLogging = LogLevel.TRACE;
}
}
for (Map.Entry<String, String> mapping : ENVIRONMENT_SYSTEM_PROPERTY_MAPPING
.entrySet()) {
if (environment.containsProperty(mapping.getKey())) {

View File

@@ -132,7 +132,7 @@ public class LoggingApplicationContextInitializerTests {
@Test
public void parseDebugArg() throws Exception {
this.initializer.initialize(this.springApplication, new String[] { "--debug" });
TestUtils.addEnviroment(this.context, "debug");
this.initializer.initialize(this.context);
this.logger.debug("testatdebug");
this.logger.trace("testattrace");
@@ -142,8 +142,7 @@ public class LoggingApplicationContextInitializerTests {
@Test
public void parseTraceArg() throws Exception {
this.context = new GenericApplicationContext();
this.initializer.initialize(this.springApplication, new String[] { "--trace" });
TestUtils.addEnviroment(this.context, "trace");
this.initializer.initialize(this.context);
this.logger.debug("testatdebug");
this.logger.trace("testattrace");