Switch off CSRF filter

Might need to revisit later.
This commit is contained in:
Dave Syer
2013-08-22 14:19:26 +01:00
committed by Phillip Webb
parent 43fc107437
commit 1e0e2e7102
10 changed files with 195 additions and 132 deletions

View File

@@ -30,7 +30,7 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.properties.ManagementServerProperties;
import org.springframework.boot.actuate.properties.SecurityProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
@@ -127,7 +127,7 @@ public class ManagementAddressSampleActuatorApplicationTests {
}
private String getPassword() {
return context.getBean(ManagementServerProperties.class).getUser().getPassword();
return context.getBean(SecurityProperties.class).getUser().getPassword();
}
private RestTemplate getRestTemplate() {

View File

@@ -29,7 +29,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.properties.ManagementServerProperties;
import org.springframework.boot.actuate.properties.SecurityProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
@@ -100,7 +100,7 @@ public class NoManagementSampleActuatorApplicationTests {
}
private String getPassword() {
return context.getBean(ManagementServerProperties.class).getUser().getPassword();
return context.getBean(SecurityProperties.class).getUser().getPassword();
}
private RestTemplate getRestTemplate(final String username, final String password) {

View File

@@ -29,7 +29,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.properties.ManagementServerProperties;
import org.springframework.boot.actuate.properties.SecurityProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
@@ -86,7 +86,8 @@ public class SampleActuatorApplicationTests {
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();
assertEquals("Wrong body: " + body, "Unauthorized", body.get("error"));
assertFalse(entity.getHeaders().containsKey("Set-Cookie"));
assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders()
.containsKey("Set-Cookie"));
}
@Test
@@ -168,7 +169,7 @@ public class SampleActuatorApplicationTests {
}
private String getPassword() {
return context.getBean(ManagementServerProperties.class).getUser().getPassword();
return context.getBean(SecurityProperties.class).getUser().getPassword();
}
private RestTemplate getRestTemplate() {

View File

@@ -29,7 +29,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.properties.ManagementServerProperties;
import org.springframework.boot.actuate.properties.SecurityProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
@@ -100,7 +100,7 @@ public class ShutdownSampleActuatorApplicationTests {
}
private String getPassword() {
return context.getBean(ManagementServerProperties.class).getUser().getPassword();
return context.getBean(SecurityProperties.class).getUser().getPassword();
}
private RestTemplate getRestTemplate(final String username, final String password) {

View File

@@ -78,7 +78,8 @@ public class UnsecureSampleActuatorApplicationTests {
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();
assertEquals("Hello Phil", body.get("message"));
assertFalse(entity.getHeaders().containsKey("Set-Cookie"));
assertFalse("Wrong headers: " + entity.getHeaders(), entity.getHeaders()
.containsKey("Set-Cookie"));
}
private RestTemplate getRestTemplate() {