#319 - Upgrade to Spring Boot 2.0 M6.
Tweaked setup of in-memory user accounts in Spring Security example to accommodate the changes in Password encoding. Tweaked Elasticsearch examples to use Log4j 2 instead of Logback as embedded Elasticsearch requires it to run properly.
This commit is contained in:
@@ -21,6 +21,8 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -30,7 +32,6 @@ import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.crypto.codec.Base64;
|
||||
import org.springframework.security.web.FilterChainProxy;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -86,7 +87,8 @@ public class UrlLevelSecurityTests {
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add(HttpHeaders.ACCEPT, MediaTypes.HAL_JSON_VALUE);
|
||||
headers.add(HttpHeaders.AUTHORIZATION, "Basic " + new String(Base64.encode(("greg:turnquist").getBytes())));
|
||||
headers.add(HttpHeaders.AUTHORIZATION,
|
||||
"Basic " + new String(Base64.getEncoder().encodeToString(("greg:turnquist").getBytes())));
|
||||
|
||||
mvc.perform(get("/employees").//
|
||||
headers(headers)).//
|
||||
@@ -103,7 +105,8 @@ public class UrlLevelSecurityTests {
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set(HttpHeaders.ACCEPT, MediaTypes.HAL_JSON_VALUE);
|
||||
headers.set(HttpHeaders.AUTHORIZATION, "Basic " + new String(Base64.encode(("ollie:gierke").getBytes())));
|
||||
headers.set(HttpHeaders.AUTHORIZATION,
|
||||
"Basic " + new String(Base64.getEncoder().encodeToString(("ollie:gierke").getBytes())));
|
||||
|
||||
mvc.perform(get("/employees").//
|
||||
headers(headers)).//
|
||||
@@ -112,11 +115,9 @@ public class UrlLevelSecurityTests {
|
||||
|
||||
headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
|
||||
String location = mvc
|
||||
.perform(post("/employees").//
|
||||
content(PAYLOAD).//
|
||||
headers(headers))
|
||||
.//
|
||||
String location = mvc.perform(post("/employees").//
|
||||
content(PAYLOAD).//
|
||||
headers(headers)).//
|
||||
andExpect(status().isCreated()).//
|
||||
andReturn().getResponse().getHeader(HttpHeaders.LOCATION);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user