好吧,那是旧的CSRF好东西,然后…
logging.level.org.springframework.security=DEBUG
2018-10-02 10:11:41.285调试12992–[main]
ossecurity.web.csrf.CsrfFilter:为http:// localhost / applications /
foo找到无效的CSRF令牌
Application app = Application.builder() .pre(APP_CODE).name(APP_NAME) .build(); mockMvc.perform(post("/applications").with(csrf()) // oups... .accept(MediaType.APPLICATION_JSON_UTF8) .contentType(MediaType.APPLICATION_JSON_UTF8) .content(mapper.writevalueAsString(app))) .andExpect(authenticated()) .andExpect(status().isOk()); // there we go!


