Commit e4b8e174 authored by Dave Syer's avatar Dave Syer

Add test case for gh-699

parent 35931556
......@@ -20,6 +20,7 @@ import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
......@@ -108,6 +109,21 @@ public class SampleMethodSecurityApplicationTests {
.getBody().contains("Access denied"));
}
@Test
public void testManagementProtected() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate()
.getForEntity("http://localhost:" + port + "/beans", String.class);
assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode());
}
@Test
@Ignore("https://github.com/spring-projects/spring-boot/issues/699")
public void testManagementAuthorizedAccess() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate("user", "user")
.getForEntity("http://localhost:" + port + "/beans", String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
private void getCsrf(MultiValueMap<String, String> form, HttpHeaders headers) {
ResponseEntity<String> page = new TestRestTemplate().getForEntity(
"http://localhost:" + port + "/login", String.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment