Search in sources :

Example 1 with CsrfTokenRepository

use of org.springframework.security.web.csrf.CsrfTokenRepository in project spring-security by spring-projects.

the class SecurityMockMvcRequestPostProcessorsCsrfDebugFilterTests method findCookieCsrfTokenRepository.

// SEC-3836
@Test
public void findCookieCsrfTokenRepository() throws Exception {
    MockHttpServletRequest request = post("/").buildRequest(wac.getServletContext());
    CsrfTokenRepository csrfTokenRepository = WebTestUtils.getCsrfTokenRepository(request);
    assertThat(csrfTokenRepository).isNotNull();
    assertThat(csrfTokenRepository).isEqualTo(Config.cookieCsrfTokenRepository);
}
Also used : MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) CookieCsrfTokenRepository(org.springframework.security.web.csrf.CookieCsrfTokenRepository) CsrfTokenRepository(org.springframework.security.web.csrf.CsrfTokenRepository) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 CookieCsrfTokenRepository (org.springframework.security.web.csrf.CookieCsrfTokenRepository)1 CsrfTokenRepository (org.springframework.security.web.csrf.CsrfTokenRepository)1